diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2018-11-05 16:27:03 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2018-11-05 16:27:03 +0000 |
| commit | 8b2a1f7fd92a858d8d71a4bc9dcbd20f8af62dc4 (patch) | |
| tree | 1e455fd9ec08d333ffcc5636bf0123212ff4d43c /llvm/test/Transforms | |
| parent | 9757d5d6c19d2679f73be637a90edf8da092e1e2 (diff) | |
| download | bcm5719-llvm-8b2a1f7fd92a858d8d71a4bc9dcbd20f8af62dc4.tar.gz bcm5719-llvm-8b2a1f7fd92a858d8d71a4bc9dcbd20f8af62dc4.zip | |
[InstCombine] adjust tests for select with FP identity op; NFC
These are mislabeled as negative tests.
llvm-svn: 346142
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/select-binop-cmp.ll | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/llvm/test/Transforms/InstCombine/select-binop-cmp.ll b/llvm/test/Transforms/InstCombine/select-binop-cmp.ll index 1604522293c..a2ddfb40f37 100644 --- a/llvm/test/Transforms/InstCombine/select-binop-cmp.ll +++ b/llvm/test/Transforms/InstCombine/select-binop-cmp.ll @@ -152,6 +152,21 @@ define float @select_fadd_fcmp(float %x, float %y, float %z) { 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 %x, float %y, float %z) { 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(float %x, float %y, float %z) { 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(float %x, float %y, float %z) { 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( |

