summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SystemZ
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-12-20 11:56:02 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-12-20 11:56:02 +0000
commit83a0b6abd0f43ee3ed6755fa9c8a2e3ee13e04e7 (patch)
tree5e84d3c7053a7480eec29e06ad41cff7da1af209 /llvm/test/CodeGen/SystemZ
parentd4f66c7d5fca129b3af4c8455fc26451591393ce (diff)
downloadbcm5719-llvm-83a0b6abd0f43ee3ed6755fa9c8a2e3ee13e04e7.tar.gz
bcm5719-llvm-83a0b6abd0f43ee3ed6755fa9c8a2e3ee13e04e7.zip
[SystemZ] Optimize comparisons with truncated extended loads
If the extension of a loaded value is compared against zero and used in other arithmetic, InstCombine will change the comparison to use the unextended load. It's also possible that the comparison could be against the unextended load from the outset. In DAG form this becomes a truncation of an extending load. We want to strip the truncation if possible so that we can use load-and-test instructions. llvm-svn: 197804
Diffstat (limited to 'llvm/test/CodeGen/SystemZ')
-rw-r--r--llvm/test/CodeGen/SystemZ/int-cmp-44.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/int-cmp-44.ll b/llvm/test/CodeGen/SystemZ/int-cmp-44.ll
index 8ab67f70e62..822dcac3059 100644
--- a/llvm/test/CodeGen/SystemZ/int-cmp-44.ll
+++ b/llvm/test/CodeGen/SystemZ/int-cmp-44.ll
@@ -865,3 +865,25 @@ store:
exit:
ret i32 %res
}
+
+; A version of f32 that tests the unextended value.
+define i64 @f42(i64 %base, i64 %index, i64 *%dest) {
+; CHECK-LABEL: f42:
+; CHECK: ltgf %r2, 0({{%r2,%r3|%r3,%r2}})
+; CHECK-NEXT: jh .L{{.*}}
+; CHECK: br %r14
+entry:
+ %add = add i64 %base, %index
+ %ptr = inttoptr i64 %add to i32 *
+ %val = load i32 *%ptr
+ %res = sext i32 %val to i64
+ %cmp = icmp sgt i32 %val, 0
+ br i1 %cmp, label %exit, label %store
+
+store:
+ store i64 %res, i64 *%dest
+ br label %exit
+
+exit:
+ ret i64 %res
+}
OpenPOWER on IntegriCloud