[llvm] ed8dae9 - [InstSimplify] add tests for strict fadd with SNaN operand; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 05:34:38 PST 2023


Author: Sanjay Patel
Date: 2023-02-08T08:21:18-05:00
New Revision: ed8dae9a438dd8b76a9760506fb7333ce7057d96

URL: https://github.com/llvm/llvm-project/commit/ed8dae9a438dd8b76a9760506fb7333ce7057d96
DIFF: https://github.com/llvm/llvm-project/commit/ed8dae9a438dd8b76a9760506fb7333ce7057d96.diff

LOG: [InstSimplify] add tests for strict fadd with SNaN operand; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/strictfp-fadd.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstSimplify/strictfp-fadd.ll b/llvm/test/Transforms/InstSimplify/strictfp-fadd.ll
index 1e770e752c1f8..f36b6180930cd 100644
--- a/llvm/test/Transforms/InstSimplify/strictfp-fadd.ll
+++ b/llvm/test/Transforms/InstSimplify/strictfp-fadd.ll
@@ -370,6 +370,31 @@ define float @fold_fadd_qnan_qnan_ebstrict() #0 {
   ret float %add
 }
 
+define float @fold_fadd_snan_variable_ebignore(float %x) #0 {
+; CHECK-LABEL: @fold_fadd_snan_variable_ebignore(
+; CHECK-NEXT:    ret float 0x7FF4000000000000
+;
+  %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff4000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
+  ret float %add
+}
+
+define float @fold_fadd_snan_variable_ebmaytrap(float %x) #0 {
+; CHECK-LABEL: @fold_fadd_snan_variable_ebmaytrap(
+; CHECK-NEXT:    ret float 0x7FF4000000000000
+;
+  %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff4000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
+  ret float %add
+}
+
+define float @fold_fadd_snan_variable_ebstrict(float %x) #0 {
+; CHECK-LABEL: @fold_fadd_snan_variable_ebstrict(
+; CHECK-NEXT:    [[ADD:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF4000000000000, float [[X:%.*]], metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
+; CHECK-NEXT:    ret float [[ADD]]
+;
+  %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff4000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
+  ret float %add
+}
+
 define float @fold_fadd_snan_qnan_ebmaytrap() #0 {
 ; CHECK-LABEL: @fold_fadd_snan_qnan_ebmaytrap(
 ; CHECK-NEXT:    ret float 0x7FFC000000000000


        


More information about the llvm-commits mailing list