[llvm] SelectionDAG: Support nofpclass (PR #108350)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 09:54:08 PDT 2024


================
@@ -96,17 +285,89 @@ define float @minimumnum_float_nnan(float %x, float %y) {
 ; MIPS32R6:       # %bb.0:
 ; MIPS32R6-NEXT:    jr $ra
 ; MIPS32R6-NEXT:    min.s $f0, $f12, $f14
+;
+; MIPS64-LABEL: minimumnum_float_nnan:
+; MIPS64:       # %bb.0:
+; MIPS64-NEXT:    c.olt.s $f12, $f13
+; MIPS64-NEXT:    mov.s $f0, $f13
+; MIPS64-NEXT:    movt.s $f0, $f12, $fcc0
+; MIPS64-NEXT:    mfc1 $1, $f12
+; MIPS64-NEXT:    lui $2, 32768
+; MIPS64-NEXT:    xor $1, $1, $2
+; MIPS64-NEXT:    mov.s $f1, $f0
+; MIPS64-NEXT:    movz.s $f1, $f12, $1
+; MIPS64-NEXT:    mfc1 $1, $f13
+; MIPS64-NEXT:    xor $1, $1, $2
+; MIPS64-NEXT:    movz.s $f1, $f13, $1
+; MIPS64-NEXT:    mtc1 $zero, $f2
+; MIPS64-NEXT:    c.eq.s $f0, $f2
+; MIPS64-NEXT:    jr $ra
+; MIPS64-NEXT:    movt.s $f0, $f1, $fcc0
+  %z = call nnan float @llvm.minimumnum.f32(float %x, float %y)
+  ret float %z
+}
+
+define float @minimumnum_float_nnan_arg(float nofpclass(nan) %x, float nofpclass(nan) %y) {
----------------
arsenm wrote:

These tests won't cover the inf case. You also should test the separate nofpclass(qnan) and nofpclass(snan) cases, which individually are not strong enough to set the corresponding flag 

https://github.com/llvm/llvm-project/pull/108350


More information about the llvm-commits mailing list