diff options
Diffstat (limited to 'llvm/test')
l--------- | llvm/test/CodeGen/AMDGPU/.#llvm.amdgcn.smfmac.gfx950.ll | 1 | ||||
-rw-r--r-- | llvm/test/CodeGen/AMDGPU/sgpr-copy.ll | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/clamp-to-minmax.ll | 6 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/select-gep.ll | 32 | ||||
-rw-r--r-- | llvm/test/Transforms/InstSimplify/domcondition.ll | 207 |
5 files changed, 242 insertions, 6 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/.#llvm.amdgcn.smfmac.gfx950.ll b/llvm/test/CodeGen/AMDGPU/.#llvm.amdgcn.smfmac.gfx950.ll deleted file mode 120000 index 8747bd5..0000000 --- a/llvm/test/CodeGen/AMDGPU/.#llvm.amdgcn.smfmac.gfx950.ll +++ /dev/null @@ -1 +0,0 @@ -matt@mattbookAMD.56897
\ No newline at end of file diff --git a/llvm/test/CodeGen/AMDGPU/sgpr-copy.ll b/llvm/test/CodeGen/AMDGPU/sgpr-copy.ll index c82b341..5bc9cdb 100644 --- a/llvm/test/CodeGen/AMDGPU/sgpr-copy.ll +++ b/llvm/test/CodeGen/AMDGPU/sgpr-copy.ll @@ -256,7 +256,7 @@ endif: ; preds = %else, %if define amdgpu_kernel void @copy1(ptr addrspace(1) %out, ptr addrspace(1) %in0) { entry: %tmp = load float, ptr addrspace(1) %in0 - %tmp1 = fcmp oeq float %tmp, 0.000000e+00 + %tmp1 = fcmp one float %tmp, 0.000000e+00 br i1 %tmp1, label %if0, label %endif if0: ; preds = %entry diff --git a/llvm/test/Transforms/InstCombine/clamp-to-minmax.ll b/llvm/test/Transforms/InstCombine/clamp-to-minmax.ll index 7f32766..0ccaa9c 100644 --- a/llvm/test/Transforms/InstCombine/clamp-to-minmax.ll +++ b/llvm/test/Transforms/InstCombine/clamp-to-minmax.ll @@ -172,10 +172,8 @@ define float @clamp_negative_wrong_const(float %x) { ; Like @clamp_test_1 but both are min define float @clamp_negative_same_op(float %x) { ; CHECK-LABEL: @clamp_negative_same_op( -; CHECK-NEXT: [[INNER_CMP_INV:%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02 -; CHECK-NEXT: [[INNER_SEL:%.*]] = select nnan ninf i1 [[INNER_CMP_INV]], float 2.550000e+02, float [[X]] -; CHECK-NEXT: [[OUTER_CMP:%.*]] = fcmp fast ult float [[X]], 1.000000e+00 -; CHECK-NEXT: [[R:%.*]] = select i1 [[OUTER_CMP]], float [[INNER_SEL]], float 1.000000e+00 +; CHECK-NEXT: [[OUTER_CMP_INV:%.*]] = fcmp fast oge float [[X:%.*]], 1.000000e+00 +; CHECK-NEXT: [[R:%.*]] = select nnan ninf i1 [[OUTER_CMP_INV]], float 1.000000e+00, float [[X]] ; CHECK-NEXT: ret float [[R]] ; %inner_cmp = fcmp fast ult float %x, 255.0 diff --git a/llvm/test/Transforms/InstCombine/select-gep.ll b/llvm/test/Transforms/InstCombine/select-gep.ll index dd8dffb..7181336 100644 --- a/llvm/test/Transforms/InstCombine/select-gep.ll +++ b/llvm/test/Transforms/InstCombine/select-gep.ll @@ -286,3 +286,35 @@ define <2 x ptr> @test7(<2 x ptr> %p1, i64 %idx, <2 x i1> %cc) { %select = select <2 x i1> %cc, <2 x ptr> %p1, <2 x ptr> %gep ret <2 x ptr> %select } + +define ptr @ptr_eq_replace_freeze1(ptr %p, ptr %q) { +; CHECK-LABEL: @ptr_eq_replace_freeze1( +; CHECK-NEXT: [[Q_FR:%.*]] = freeze ptr [[Q:%.*]] +; CHECK-NEXT: [[Q_FR1:%.*]] = freeze ptr [[Q1:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr [[Q_FR]], [[Q_FR1]] +; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[CMP]], ptr [[Q_FR]], ptr [[Q_FR1]] +; CHECK-NEXT: ret ptr [[SELECT]] +; + %p.fr = freeze ptr %p + %q.fr = freeze ptr %q + %cmp = icmp eq ptr %p.fr, %q.fr + %select = select i1 %cmp, ptr %p.fr, ptr %q.fr + ret ptr %select +} + +define ptr @ptr_eq_replace_freeze2(ptr %p, ptr %q) { +; CHECK-LABEL: @ptr_eq_replace_freeze2( +; CHECK-NEXT: [[P_FR:%.*]] = freeze ptr [[P:%.*]] +; CHECK-NEXT: [[P_FR1:%.*]] = freeze ptr [[P1:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr [[P_FR1]], [[P_FR]] +; CHECK-NEXT: [[SELECT_V:%.*]] = select i1 [[CMP]], ptr [[P_FR1]], ptr [[P_FR]] +; CHECK-NEXT: [[SELECT:%.*]] = getelementptr i8, ptr [[SELECT_V]], i64 16 +; CHECK-NEXT: ret ptr [[SELECT]] +; + %gep1 = getelementptr i32, ptr %p, i64 4 + %gep2 = getelementptr i32, ptr %q, i64 4 + %cmp = icmp eq ptr %p, %q + %cmp.fr = freeze i1 %cmp + %select = select i1 %cmp.fr, ptr %gep1, ptr %gep2 + ret ptr %select +} diff --git a/llvm/test/Transforms/InstSimplify/domcondition.ll b/llvm/test/Transforms/InstSimplify/domcondition.ll index 43be5de..2893bb1 100644 --- a/llvm/test/Transforms/InstSimplify/domcondition.ll +++ b/llvm/test/Transforms/InstSimplify/domcondition.ll @@ -278,3 +278,210 @@ end: } declare void @foo(i32) + + +define i1 @simplify_fcmp_implied_by_dom_cond_range_true(float %x) { +; CHECK-LABEL: @simplify_fcmp_implied_by_dom_cond_range_true( +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], 0.000000e+00 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; CHECK: if.then: +; CHECK-NEXT: ret i1 true +; CHECK: if.else: +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp olt float %x, 0.0 + br i1 %cmp, label %if.then, label %if.else + +if.then: + %cmp2 = fcmp olt float %x, 1.0 + ret i1 %cmp2 + +if.else: + ret i1 false +} + +define i1 @simplify_fcmp_in_else_implied_by_dom_cond_range_true(float %x) { +; CHECK-LABEL: @simplify_fcmp_in_else_implied_by_dom_cond_range_true( +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], 1.000000e+00 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; CHECK: if.then: +; CHECK-NEXT: ret i1 true +; CHECK: if.else: +; CHECK-NEXT: ret i1 true +; + %cmp = fcmp olt float %x, 1.0 + br i1 %cmp, label %if.then, label %if.else + +if.then: + ret i1 true + +if.else: + %cmp2 = fcmp uge float %x, 0.5 + ret i1 %cmp2 +} + +define i1 @simplify_fcmp_implied_by_dom_cond_range_false(float %x) { +; CHECK-LABEL: @simplify_fcmp_implied_by_dom_cond_range_false( +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], 0.000000e+00 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; CHECK: if.then: +; CHECK-NEXT: ret i1 false +; CHECK: if.else: +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp olt float %x, 0.0 + br i1 %cmp, label %if.then, label %if.else + +if.then: + %cmp2 = fcmp ogt float %x, 1.0 + ret i1 %cmp2 + +if.else: + ret i1 false +} + +define i1 @simplify_fcmp_implied_by_dom_cond_pred_true(float %x, float %y) { +; CHECK-LABEL: @simplify_fcmp_implied_by_dom_cond_pred_true( +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; CHECK: if.then: +; CHECK-NEXT: ret i1 true +; CHECK: if.else: +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp olt float %x, %y + br i1 %cmp, label %if.then, label %if.else + +if.then: + %cmp2 = fcmp ole float %x, %y + ret i1 %cmp2 + +if.else: + ret i1 false +} + +define i1 @simplify_fcmp_implied_by_dom_cond_pred_false(float %x, float %y) { +; CHECK-LABEL: @simplify_fcmp_implied_by_dom_cond_pred_false( +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; CHECK: if.then: +; CHECK-NEXT: ret i1 false +; CHECK: if.else: +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp olt float %x, %y + br i1 %cmp, label %if.then, label %if.else + +if.then: + %cmp2 = fcmp ogt float %x, %y + ret i1 %cmp2 + +if.else: + ret i1 false +} + +define i1 @simplify_fcmp_implied_by_dom_cond_pred_commuted(float %x, float %y) { +; CHECK-LABEL: @simplify_fcmp_implied_by_dom_cond_pred_commuted( +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; CHECK: if.then: +; CHECK-NEXT: ret i1 true +; CHECK: if.else: +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp olt float %x, %y + br i1 %cmp, label %if.then, label %if.else + +if.then: + %cmp2 = fcmp oge float %y, %x + ret i1 %cmp2 + +if.else: + ret i1 false +} + +; Negative tests + +define i1 @simplify_fcmp_implied_by_dom_cond_wrong_range(float %x) { +; CHECK-LABEL: @simplify_fcmp_implied_by_dom_cond_wrong_range( +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], 0.000000e+00 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; CHECK: if.then: +; CHECK-NEXT: [[CMP2:%.*]] = fcmp olt float [[X]], -1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP2]] +; CHECK: if.else: +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp olt float %x, 0.0 + br i1 %cmp, label %if.then, label %if.else + +if.then: + %cmp2 = fcmp olt float %x, -1.0 + ret i1 %cmp2 + +if.else: + ret i1 false +} + +define i1 @simplify_fcmp_implied_by_dom_cond_range_mismatched_operand(float %x, float %y) { +; CHECK-LABEL: @simplify_fcmp_implied_by_dom_cond_range_mismatched_operand( +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], 0.000000e+00 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; CHECK: if.then: +; CHECK-NEXT: [[CMP2:%.*]] = fcmp olt float [[Y:%.*]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[CMP2]] +; CHECK: if.else: +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp olt float %x, 0.0 + br i1 %cmp, label %if.then, label %if.else + +if.then: + %cmp2 = fcmp olt float %y, 1.0 + ret i1 %cmp2 + +if.else: + ret i1 false +} + +define i1 @simplify_fcmp_implied_by_dom_cond_wrong_pred(float %x, float %y) { +; CHECK-LABEL: @simplify_fcmp_implied_by_dom_cond_wrong_pred( +; CHECK-NEXT: [[CMP:%.*]] = fcmp ole float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; CHECK: if.then: +; CHECK-NEXT: [[CMP2:%.*]] = fcmp olt float [[X]], [[Y]] +; CHECK-NEXT: ret i1 [[CMP2]] +; CHECK: if.else: +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp ole float %x, %y + br i1 %cmp, label %if.then, label %if.else + +if.then: + %cmp2 = fcmp olt float %x, %y + ret i1 %cmp2 + +if.else: + ret i1 false +} + +define i1 @simplify_fcmp_implied_by_dom_cond_pred_mismatched_operand(float %x, float %y, float %z) { +; CHECK-LABEL: @simplify_fcmp_implied_by_dom_cond_pred_mismatched_operand( +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; CHECK: if.then: +; CHECK-NEXT: [[CMP2:%.*]] = fcmp ole float [[X]], [[Z:%.*]] +; CHECK-NEXT: ret i1 [[CMP2]] +; CHECK: if.else: +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp olt float %x, %y + br i1 %cmp, label %if.then, label %if.else + +if.then: + %cmp2 = fcmp ole float %x, %z + ret i1 %cmp2 + +if.else: + ret i1 false +} |