summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/R600/operand-folding.ll
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2014-11-21 22:06:37 +0000
committerTom Stellard <thomas.stellard@amd.com>2014-11-21 22:06:37 +0000
commit6596ba79339fe2c155fd5337cd9ba3dfc6013d4d (patch)
tree6a56d7ed58816e41e2c34b504df289cbee69d8a5 /llvm/test/CodeGen/R600/operand-folding.ll
parent3b8ddb665bb332f0dd484db44ec93da927caa7df (diff)
downloadbcm5719-llvm-6596ba79339fe2c155fd5337cd9ba3dfc6013d4d.tar.gz
bcm5719-llvm-6596ba79339fe2c155fd5337cd9ba3dfc6013d4d.zip
R600/SI: Add SIFoldOperands pass
This pass attempts to fold the source operands of mov and copy instructions into their uses. llvm-svn: 222581
Diffstat (limited to 'llvm/test/CodeGen/R600/operand-folding.ll')
-rw-r--r--llvm/test/CodeGen/R600/operand-folding.ll40
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/R600/operand-folding.ll b/llvm/test/CodeGen/R600/operand-folding.ll
new file mode 100644
index 00000000000..05177b475b1
--- /dev/null
+++ b/llvm/test/CodeGen/R600/operand-folding.ll
@@ -0,0 +1,40 @@
+; RUN: llc < %s -march=r600 -mcpu=SI -verify-machineinstrs | FileCheck %s
+
+; CHECK-LABEL: {{^}}fold_sgpr:
+; CHECK: v_add_i32_e32 v{{[0-9]+}}, s
+define void @fold_sgpr(i32 addrspace(1)* %out, i32 %fold) {
+entry:
+ %tmp0 = icmp ne i32 %fold, 0
+ br i1 %tmp0, label %if, label %endif
+
+if:
+ %id = call i32 @llvm.r600.read.tidig.x()
+ %offset = add i32 %fold, %id
+ %tmp1 = getelementptr i32 addrspace(1)* %out, i32 %offset
+ store i32 0, i32 addrspace(1)* %tmp1
+ br label %endif
+
+endif:
+ ret void
+}
+
+; CHECK-LABEL: {{^}}fold_imm:
+; CHECK v_or_i32_e32 v{{[0-9]+}}, 5
+define void @fold_imm(i32 addrspace(1)* %out, i32 %cmp) {
+entry:
+ %fold = add i32 3, 2
+ %tmp0 = icmp ne i32 %cmp, 0
+ br i1 %tmp0, label %if, label %endif
+
+if:
+ %id = call i32 @llvm.r600.read.tidig.x()
+ %val = or i32 %id, %fold
+ store i32 %val, i32 addrspace(1)* %out
+ br label %endif
+
+endif:
+ ret void
+}
+
+declare i32 @llvm.r600.read.tidig.x() #0
+attributes #0 = { readnone }
OpenPOWER on IntegriCloud