summaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM64/cast-opt.ll
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2014-03-29 10:18:08 +0000
committerTim Northover <tnorthover@apple.com>2014-03-29 10:18:08 +0000
commit7b837d8c75f78fe55c9b348b9ec2281169a48d2a (patch)
treee8e01e73cf4d0723a13e49e4b5d8a66f896d184f /test/CodeGen/ARM64/cast-opt.ll
parent69bd9577fc423edea13479eaacf7b1844faa6c6a (diff)
downloadllvm-7b837d8c75f78fe55c9b348b9ec2281169a48d2a.tar.gz
llvm-7b837d8c75f78fe55c9b348b9ec2281169a48d2a.tar.bz2
llvm-7b837d8c75f78fe55c9b348b9ec2281169a48d2a.tar.xz
ARM64: initial backend import
This adds a second implementation of the AArch64 architecture to LLVM, accessible in parallel via the "arm64" triple. The plan over the coming weeks & months is to merge the two into a single backend, during which time thorough code review should naturally occur. Everything will be easier with the target in-tree though, hence this commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205090 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM64/cast-opt.ll')
-rw-r--r--test/CodeGen/ARM64/cast-opt.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/CodeGen/ARM64/cast-opt.ll b/test/CodeGen/ARM64/cast-opt.ll
new file mode 100644
index 0000000000..3d7f25773a
--- /dev/null
+++ b/test/CodeGen/ARM64/cast-opt.ll
@@ -0,0 +1,31 @@
+; RUN: llc -O3 -march=arm64 -mtriple arm64-apple-ios5.0.0 < %s | FileCheck %s
+; <rdar://problem/15992732>
+; Zero truncation is not necessary when the values are extended properly
+; already.
+
+@block = common global i8* null, align 8
+
+define zeroext i8 @foo(i32 %i1, i32 %i2) {
+; CHECK-LABEL: foo:
+; CHECK: csinc
+; CHECK-NOT: and
+entry:
+ %idxprom = sext i32 %i1 to i64
+ %0 = load i8** @block, align 8
+ %arrayidx = getelementptr inbounds i8* %0, i64 %idxprom
+ %1 = load i8* %arrayidx, align 1
+ %idxprom1 = sext i32 %i2 to i64
+ %arrayidx2 = getelementptr inbounds i8* %0, i64 %idxprom1
+ %2 = load i8* %arrayidx2, align 1
+ %cmp = icmp eq i8 %1, %2
+ br i1 %cmp, label %return, label %if.then
+
+if.then: ; preds = %entry
+ %cmp7 = icmp ugt i8 %1, %2
+ %conv9 = zext i1 %cmp7 to i8
+ br label %return
+
+return: ; preds = %entry, %if.then
+ %retval.0 = phi i8 [ %conv9, %if.then ], [ 1, %entry ]
+ ret i8 %retval.0
+}