summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AArch64/fast-isel-branch-cond-mask.ll
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2015-08-06 22:44:15 +0000
committerJuergen Ributzka <juergen@apple.com>2015-08-06 22:44:15 +0000
commitf09c7a3d0f958c82ecc0c27fc42b1c80cc4d70bb (patch)
tree99de08fb3fdce60aa8dcc5e2cd5e9fe0ed4d0eac /llvm/test/CodeGen/AArch64/fast-isel-branch-cond-mask.ll
parent96ad05ec5e7555ab9ecf4adf9dcd055feb7b3425 (diff)
downloadbcm5719-llvm-f09c7a3d0f958c82ecc0c27fc42b1c80cc4d70bb.tar.gz
bcm5719-llvm-f09c7a3d0f958c82ecc0c27fc42b1c80cc4d70bb.zip
[AArch64][FastISel] Always use AND before checking the branch flag.
When we are not emitting the condition for the branch, because the condition is in another BB or SDAG did the selection for us, then we have to mask the flag in the register with AND. This is required when the condition comes from a truncate, because SDAG only truncates down to a legal size of i32. This fixes rdar://problem/22161062. llvm-svn: 244291
Diffstat (limited to 'llvm/test/CodeGen/AArch64/fast-isel-branch-cond-mask.ll')
-rw-r--r--llvm/test/CodeGen/AArch64/fast-isel-branch-cond-mask.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/fast-isel-branch-cond-mask.ll b/llvm/test/CodeGen/AArch64/fast-isel-branch-cond-mask.ll
new file mode 100644
index 00000000000..c018b2778b0
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/fast-isel-branch-cond-mask.ll
@@ -0,0 +1,20 @@
+; RUN: llc -mtriple=aarch64-apple-darwin -O0 -fast-isel -fast-isel-abort=0 -verify-machineinstrs < %s | FileCheck %s
+
+define void @test(i64 %a, i64 %b, i2* %c) {
+; CHECK-LABEL: test
+; CHECK: and [[REG1:w[0-9]+]], w8, #0x3
+; CHECK-NEXT: strb [[REG1]], {{\[}}x2{{\]}}
+; CHECK: and [[REG2:w[0-9]+]], w8, #0x1
+; CHECK-NEXT: cmp [[REG2]], #0
+ %1 = trunc i64 %a to i2
+ %2 = trunc i64 %b to i1
+; Force fast-isel to fall back to SDAG.
+ store i2 %1, i2* %c, align 8
+ br i1 %2, label %bb1, label %bb2
+
+bb1:
+ ret void
+
+bb2:
+ ret void
+}
OpenPOWER on IntegriCloud