[llvm] f8a3850 - [InstCombine] [NFC] Add a test for fneg.ll

Chenbing Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 12 19:40:35 PDT 2022


Author: Chenbing Zheng
Date: 2022-04-13T10:33:54+08:00
New Revision: f8a38500e388866687cd9c7d270885c4eee6e7d3

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

LOG: [InstCombine] [NFC] Add a test for fneg.ll

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 c111b0080ee0f..566a2d1eb7fb5 100644
--- a/llvm/test/Transforms/InstCombine/fneg.ll
+++ b/llvm/test/Transforms/InstCombine/fneg.ll
@@ -730,6 +730,19 @@ define float @fnabs(float %a) {
   ret float %fneg1
 }
 
+define float @fnabs_1(float %a) {
+; CHECK-LABEL: @fnabs_1(
+; CHECK-NEXT:    [[TMP1:%.*]] = call nsz float @llvm.fabs.f32(float [[A:%.*]])
+; CHECK-NEXT:    [[FNEG1:%.*]] = fneg float [[TMP1]]
+; CHECK-NEXT:    ret float [[FNEG1]]
+;
+  %fneg = fneg float %a
+  %cmp = fcmp olt float %a, %fneg
+  %sel = select nsz i1 %cmp, float %fneg, float %a
+  %fneg1 = fneg float %sel
+  ret float %fneg1
+}
+
 define float @select_fneg_both(float %x, float %y, i1 %b) {
 ; CHECK-LABEL: @select_fneg_both(
 ; CHECK-NEXT:    [[S_V:%.*]] = select i1 [[B:%.*]], float [[X:%.*]], float [[Y:%.*]]


        


More information about the llvm-commits mailing list