[llvm] 788b08a - [InstCombine] add test for fneg of select with FMF; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 24 07:44:06 PST 2022


Author: Sanjay Patel
Date: 2022-02-24T10:42:25-05:00
New Revision: 788b08a58cef5888321bb74a57f8fcbf795fd47b

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

LOG: [InstCombine] add test for fneg of select with FMF; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/fneg.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/fneg.ll b/llvm/test/Transforms/InstCombine/fneg.ll
index 046c22e34bbd9..4c60a20d09ab3 100644
--- a/llvm/test/Transforms/InstCombine/fneg.ll
+++ b/llvm/test/Transforms/InstCombine/fneg.ll
@@ -648,6 +648,20 @@ define float @select_fneg_false_no_nsz(float %x, float %y, i1 %b) {
   ret float %r
 }
 
+; TODO: The removal of nsz in this pattern is not needed if the select condition can't be poison.
+
+define float @select_fneg_false_nsz_ok(float %x, float %y, i1 noundef %b) {
+; CHECK-LABEL: @select_fneg_false_nsz_ok(
+; CHECK-NEXT:    [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]
+; CHECK-NEXT:    [[R:%.*]] = select nnan ninf i1 [[B:%.*]], float [[X_NEG]], float [[Y:%.*]]
+; CHECK-NEXT:    ret float [[R]]
+;
+  %ny = fneg float %y
+  %s = select i1 %b, float %x, float %ny
+  %r = fneg nsz ninf nnan float %s
+  ret float %r
+}
+
 define float @select_fneg_false_nsz(float %x, float %y, i1 %b) {
 ; CHECK-LABEL: @select_fneg_false_nsz(
 ; CHECK-NEXT:    [[X_NEG:%.*]] = fneg nnan ninf nsz float [[X:%.*]]


        


More information about the llvm-commits mailing list