diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-12-05 19:42:07 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-12-05 19:42:07 +0000 |
commit | b7cbf75ecd793d089910775035fc226c7b1a20da (patch) | |
tree | e7f97ec199df80cf821690891f80a96b99677fa5 /test/CodeGen/SystemZ | |
parent | 952471eaa55401f25188e0c158fb59bbdd1586ce (diff) |
[SystemZ] Validate shifted compare value in adjustForTestUnderMask
When folding a shift into a test-under-mask comparison, make sure that
there is no loss of precision when creating the shifted comparison
value. This usually never happens, except for certain always-true
comparisons in unoptimized code.
Fixes PR35529.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SystemZ')
-rw-r--r-- | test/CodeGen/SystemZ/int-cmp-47.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/int-cmp-47.ll b/test/CodeGen/SystemZ/int-cmp-47.ll index dc87284ff5f..3a07ed339bb 100644 --- a/test/CodeGen/SystemZ/int-cmp-47.ll +++ b/test/CodeGen/SystemZ/int-cmp-47.ll @@ -342,3 +342,25 @@ store: exit: ret void } + +; Check that we don't fold a shift if the comparison value +; would need to be shifted out of range +define void @f19(i64 %a) { +; CHECK-LABEL: f19: +; CHECK-NOT: tmhh +; CHECK: srlg [[REG:%r[0-5]]], %r2, 63 +; CHECK: cgibl [[REG]], 3, 0(%r14) +; CHECK: br %r14 +entry: + %shr = lshr i64 %a, 63 + %cmp = icmp ult i64 %shr, 3 + br i1 %cmp, label %exit, label %store + +store: + store i32 1, i32 *@g + br label %exit + +exit: + ret void +} + |