[llvm] r346142 - [InstCombine] adjust tests for select with FP identity op; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 5 08:27:04 PST 2018
Author: spatel
Date: Mon Nov 5 08:27:03 2018
New Revision: 346142
URL: http://llvm.org/viewvc/llvm-project?rev=346142&view=rev
Log:
[InstCombine] adjust tests for select with FP identity op; NFC
These are mislabeled as negative tests.
Modified:
llvm/trunk/test/Transforms/InstCombine/select-binop-cmp.ll
Modified: llvm/trunk/test/Transforms/InstCombine/select-binop-cmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select-binop-cmp.ll?rev=346142&r1=346141&r2=346142&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/select-binop-cmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/select-binop-cmp.ll Mon Nov 5 08:27:03 2018
@@ -152,6 +152,21 @@ define float @select_fadd_fcmp(float %x,
ret float %C
}
+; TODO: This is logically equivalent to the previous test - fcmp ignores the sign of 0.0.
+
+define float @select_fadd_fcmp_poszero(float %x, float %y, float %z) {
+; CHECK-LABEL: @select_fadd_fcmp_poszero(
+; CHECK-NEXT: [[A:%.*]] = fcmp oeq float [[X:%.*]], 0.000000e+00
+; CHECK-NEXT: [[B:%.*]] = fadd nsz float [[Z:%.*]], [[X]]
+; CHECK-NEXT: [[C:%.*]] = select i1 [[A]], float [[B]], float [[Y:%.*]]
+; CHECK-NEXT: ret float [[C]]
+;
+ %A = fcmp oeq float %x, 0.0
+ %B = fadd nsz float %z, %x
+ %C = select i1 %A, float %B, float %y
+ ret float %C
+}
+
define float @select_fadd_fcmp_2(float %x, float %y, float %v) {
; CHECK-LABEL: @select_fadd_fcmp_2(
; CHECK-NEXT: [[A:%.*]] = fcmp une float [[X:%.*]], -0.000000e+00
@@ -222,6 +237,21 @@ define float @select_fadd_fcmp_4(float %
ret float %C
}
+; TODO: This is logically equivalent to the previous test - fcmp ignores the sign of 0.0.
+
+define float @select_fadd_fcmp_4_poszero(float %x, float %y, float %z) {
+; CHECK-LABEL: @select_fadd_fcmp_4_poszero(
+; CHECK-NEXT: [[A:%.*]] = fcmp une float [[X:%.*]], 0.000000e+00
+; CHECK-NEXT: [[B:%.*]] = fadd nsz float [[Z:%.*]], [[X]]
+; CHECK-NEXT: [[C:%.*]] = select i1 [[A]], float [[Y:%.*]], float [[B]]
+; CHECK-NEXT: ret float [[C]]
+;
+ %A = fcmp une float %x, 0.0
+ %B = fadd nsz float %z, %x
+ %C = select i1 %A, float %y, float %B
+ ret float %C
+}
+
define float @select_fadd_fcmp_5(float %x, float %y, float %v) {
; CHECK-LABEL: @select_fadd_fcmp_5(
; CHECK-NEXT: [[A:%.*]] = fcmp oeq float [[X:%.*]], -0.000000e+00
@@ -808,34 +838,6 @@ define float @select_fadd_fcmp_bad_14(fl
ret float %C
}
-; Invalid identity constant for FP op
-define float @select_fadd_fcmp_bad_15(float %x, float %y, float %z) {
-; CHECK-LABEL: @select_fadd_fcmp_bad_15(
-; CHECK-NEXT: [[A:%.*]] = fcmp une float [[X:%.*]], 0.000000e+00
-; CHECK-NEXT: [[B:%.*]] = fadd nsz float [[Z:%.*]], [[X]]
-; CHECK-NEXT: [[C:%.*]] = select i1 [[A]], float [[Y:%.*]], float [[B]]
-; CHECK-NEXT: ret float [[C]]
-;
- %A = fcmp une float %x, 0.0
- %B = fadd nsz float %z, %x
- %C = select i1 %A, float %y, float %B
- ret float %C
-}
-
-; Invalid identity constant for FP op
-define float @select_fadd_fcmp_bad_16(float %x, float %y, float %z) {
-; CHECK-LABEL: @select_fadd_fcmp_bad_16(
-; CHECK-NEXT: [[A:%.*]] = fcmp oeq float [[X:%.*]], 0.000000e+00
-; CHECK-NEXT: [[B:%.*]] = fadd nsz float [[Z:%.*]], [[X]]
-; CHECK-NEXT: [[C:%.*]] = select i1 [[A]], float [[B]], float [[Y:%.*]]
-; CHECK-NEXT: ret float [[C]]
-;
- %A = fcmp oeq float %x, 0.0
- %B = fadd nsz float %z, %x
- %C = select i1 %A, float %B, float %y
- ret float %C
-}
-
define float @select_fmul_fcmp_bad(float %x, float %y, float %z) {
; CHECK-LABEL: @select_fmul_fcmp_bad(
; CHECK-NEXT: [[A:%.*]] = fcmp oeq float [[X:%.*]], 3.000000e+00
@@ -914,8 +916,8 @@ define float @select_fdiv_fcmp_bad_2(flo
ret float %C
}
-; The transform is not valid when x = -0.0 and z = -0.0
-; (optimized code would return -0.0, but this returns +0.0).
+; The transform is not valid when x = -0.0 and z = -0.0
+; (optimized code would return -0.0, but this returns +0.0).
define float @select_fsub_fcmp_bad(float %x, float %y, float %z) {
; CHECK-LABEL: @select_fsub_fcmp_bad(
More information about the llvm-commits
mailing list