summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-11-05 15:08:36 +0000
committerSanjay Patel <spatel@rotateright.com>2018-11-05 15:08:36 +0000
commit278db2fba16a8f7e822c0632d0e9f0288ff191e0 (patch)
treec09a38744e413f970e58c1fabf0f2f40ba2305ab /llvm/test/Transforms
parent63ecf07311ca717676f883897e8db7e21e8e885d (diff)
downloadbcm5719-llvm-278db2fba16a8f7e822c0632d0e9f0288ff191e0.tar.gz
bcm5719-llvm-278db2fba16a8f7e822c0632d0e9f0288ff191e0.zip
[InstCombine] add tests for select with FP identity op; NFC
llvm-svn: 346136
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/select-binop-cmp.ll64
1 files changed, 64 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/select-binop-cmp.ll b/llvm/test/Transforms/InstCombine/select-binop-cmp.ll
index 5609643235d..edbe310269a 100644
--- a/llvm/test/Transforms/InstCombine/select-binop-cmp.ll
+++ b/llvm/test/Transforms/InstCombine/select-binop-cmp.ll
@@ -166,6 +166,23 @@ define float @select_fadd_fcmp_2(float %x, float %y, float %v) {
ret float %C
}
+; TODO: This is logically equivalent to the previous test - fcmp ignores the sign of 0.0.
+
+define float @select_fadd_fcmp_2_poszero(float %x, float %y, float %v) {
+; CHECK-LABEL: @select_fadd_fcmp_2_poszero(
+; CHECK-NEXT: [[A:%.*]] = fcmp une float [[X:%.*]], 0.000000e+00
+; CHECK-NEXT: [[Z:%.*]] = fadd float [[V:%.*]], 0.000000e+00
+; CHECK-NEXT: [[B:%.*]] = fadd 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
+ %z = fadd float %v, 0.0 ; cannot produce -0.0
+ %B = fadd float %z, %x
+ %C = select i1 %A, float %y, float %B
+ ret float %C
+}
+
define float @select_fadd_fcmp_3(float %x, float %y) {
; CHECK-LABEL: @select_fadd_fcmp_3(
; CHECK-NEXT: [[A:%.*]] = fcmp une float [[X:%.*]], -0.000000e+00
@@ -178,6 +195,21 @@ define float @select_fadd_fcmp_3(float %x, float %y) {
ret float %C
}
+; TODO: This is logically equivalent to the previous test - fcmp ignores the sign of 0.0.
+
+define float @select_fadd_fcmp_3_poszero(float %x, float %y) {
+; CHECK-LABEL: @select_fadd_fcmp_3_poszero(
+; CHECK-NEXT: [[A:%.*]] = fcmp une float [[X:%.*]], 0.000000e+00
+; CHECK-NEXT: [[B:%.*]] = fadd float [[X]], 6.000000e+00
+; CHECK-NEXT: [[C:%.*]] = select i1 [[A]], float [[Y:%.*]], float [[B]]
+; CHECK-NEXT: ret float [[C]]
+;
+ %A = fcmp une float %x, 0.0
+ %B = fadd float 6.0, %x
+ %C = select i1 %A, float %y, float %B
+ ret float %C
+}
+
define float @select_fadd_fcmp_4(float %x, float %y, float %z) {
; CHECK-LABEL: @select_fadd_fcmp_4(
; CHECK-NEXT: [[A:%.*]] = fcmp une float [[X:%.*]], -0.000000e+00
@@ -204,6 +236,23 @@ define float @select_fadd_fcmp_5(float %x, float %y, float %v) {
ret float %C
}
+; TODO: This is logically equivalent to the previous test - fcmp ignores the sign of 0.0.
+
+define float @select_fadd_fcmp_5_poszero(float %x, float %y, float %v) {
+; CHECK-LABEL: @select_fadd_fcmp_5_poszero(
+; CHECK-NEXT: [[A:%.*]] = fcmp oeq float [[X:%.*]], 0.000000e+00
+; CHECK-NEXT: [[Z:%.*]] = fadd float [[V:%.*]], 0.000000e+00
+; CHECK-NEXT: [[B:%.*]] = fadd 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
+ %z = fadd float %v, 0.0 ; cannot produce -0.0
+ %B = fadd float %z, %x
+ %C = select i1 %A, float %B, float %y
+ ret float %C
+}
+
define float @select_fadd_fcmp_6(float %x, float %y, float %z) {
; CHECK-LABEL: @select_fadd_fcmp_6(
; CHECK-NEXT: [[A:%.*]] = fcmp oeq float [[X:%.*]], -0.000000e+00
@@ -216,6 +265,21 @@ define float @select_fadd_fcmp_6(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_6_poszero(float %x, float %y, float %z) {
+; CHECK-LABEL: @select_fadd_fcmp_6_poszero(
+; CHECK-NEXT: [[A:%.*]] = fcmp oeq float [[X:%.*]], 0.000000e+00
+; CHECK-NEXT: [[B:%.*]] = fadd float [[X]], 6.000000e+00
+; CHECK-NEXT: [[C:%.*]] = select i1 [[A]], float [[B]], float [[Y:%.*]]
+; CHECK-NEXT: ret float [[C]]
+;
+ %A = fcmp oeq float %x, 0.0
+ %B = fadd float %x, 6.0
+ %C = select i1 %A, float %B, float %y
+ ret float %C
+}
+
define float @select_fmul_fcmp(float %x, float %y, float %z) {
; CHECK-LABEL: @select_fmul_fcmp(
; CHECK-NEXT: [[A:%.*]] = fcmp oeq float [[X:%.*]], 1.000000e+00
OpenPOWER on IntegriCloud