Skip to content

Commit 5d109fb

Browse files
committed
[MIPS] match llvm.{min,max}num with {min,max}.fmt for R6
- The behavior is similar to UCOMISD on x86, which is also used to compare two fp values, specifically on handling of NaNs.
1 parent 70b5b14 commit 5d109fb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

llvm/lib/Target/Mips/MipsISelLowering.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,15 @@ MipsTargetLowering::MipsTargetLowering(const MipsTargetMachine &TM,
358358
setOperationAction(ISD::FCOPYSIGN, MVT::f64, Custom);
359359
setOperationAction(ISD::FP_TO_SINT, MVT::i32, Custom);
360360

361+
// Lower fmin and fmax operations for MIPS R6.
362+
// Instructions are defined but never used.
363+
if (Subtarget.hasMips32r6()) {
364+
setOperationAction(ISD::FMINNUM, MVT::f32, Legal);
365+
setOperationAction(ISD::FMINNUM, MVT::f64, Legal);
366+
setOperationAction(ISD::FMAXNUM, MVT::f32, Legal);
367+
setOperationAction(ISD::FMAXNUM, MVT::f64, Legal);
368+
}
369+
361370
if (Subtarget.isGP64bit()) {
362371
setOperationAction(ISD::GlobalAddress, MVT::i64, Custom);
363372
setOperationAction(ISD::BlockAddress, MVT::i64, Custom);

0 commit comments

Comments
 (0)