summaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2014-04-29 23:12:48 +0000
committerTom Stellard <thomas.stellard@amd.com>2014-04-29 23:12:48 +0000
commit2a90e446c0e4110ba741166254c88e346799bc81 (patch)
tree6fb2e2896a3605c9a13a9f668f1aa233ad6347e8 /test/CodeGen
parent19a970b2dafdfaca4263557db69a70e072e0a130 (diff)
downloadllvm-2a90e446c0e4110ba741166254c88e346799bc81.tar.gz
llvm-2a90e446c0e4110ba741166254c88e346799bc81.tar.bz2
llvm-2a90e446c0e4110ba741166254c88e346799bc81.tar.xz
R600/SI: Only select SALU instructions in the entry or exit block
SALU instructions ignore control flow, so it is not always safe to use them within branches. This is a partial solution to this problem until we can come up with something better. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207590 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/R600/sgpr-control-flow.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGen/R600/sgpr-control-flow.ll b/test/CodeGen/R600/sgpr-control-flow.ll
new file mode 100644
index 0000000000..06ad24d959
--- /dev/null
+++ b/test/CodeGen/R600/sgpr-control-flow.ll
@@ -0,0 +1,27 @@
+; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI %s
+;
+;
+; Most SALU instructions ignore control flow, so we need to make sure
+; they don't overwrite values from other blocks.
+
+; SI-NOT: S_ADD
+
+define void @sgpr_if_else(i32 addrspace(1)* %out, i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) {
+entry:
+ %0 = icmp eq i32 %a, 0
+ br i1 %0, label %if, label %else
+
+if:
+ %1 = add i32 %b, %c
+ br label %endif
+
+else:
+ %2 = add i32 %d, %e
+ br label %endif
+
+endif:
+ %3 = phi i32 [%1, %if], [%2, %else]
+ %4 = add i32 %3, %a
+ store i32 %4, i32 addrspace(1)* %out
+ ret void
+}