summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2013-10-10 18:04:16 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2013-10-10 18:04:16 +0000
commit204cfa6e43465e5bf291b79f47c9dfa4ec4558df (patch)
treef8a214022311a7b5a0db6ef43471673fa8ac258f
parentd219231de5e85debee4ecf429a73bf562657e03d (diff)
downloadbcm5719-llvm-204cfa6e43465e5bf291b79f47c9dfa4ec4558df.tar.gz
bcm5719-llvm-204cfa6e43465e5bf291b79f47c9dfa4ec4558df.zip
R600: Fix trunc i64 to i32 on SI
llvm-svn: 192375
-rw-r--r--llvm/lib/Target/R600/SIInstructions.td5
-rw-r--r--llvm/test/CodeGen/R600/trunc.ll12
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/R600/SIInstructions.td b/llvm/lib/Target/R600/SIInstructions.td
index d9cf1e5c571..c0db7f9c2b0 100644
--- a/llvm/lib/Target/R600/SIInstructions.td
+++ b/llvm/lib/Target/R600/SIInstructions.td
@@ -851,6 +851,11 @@ def : Pat <
(V_CNDMASK_B32_e64 $src0, $src1, $src2)
>;
+def : Pat <
+ (i32 (trunc i64:$val)),
+ (EXTRACT_SUBREG $val, sub0)
+>;
+
//use two V_CNDMASK_B32_e64 instructions for f64
def : Pat <
(f64 (select i1:$src2, f64:$src1, f64:$src0)),
diff --git a/llvm/test/CodeGen/R600/trunc.ll b/llvm/test/CodeGen/R600/trunc.ll
index 1fbe7205fbb..be7a430885f 100644
--- a/llvm/test/CodeGen/R600/trunc.ll
+++ b/llvm/test/CodeGen/R600/trunc.ll
@@ -17,3 +17,15 @@ define void @trunc_i64_to_i32_store(i32 addrspace(1)* %out, i64 %in) {
ret void
}
+; SI-LABEL: @trunc_shl_i64:
+; SI: S_LOAD_DWORDX2
+; SI: S_LOAD_DWORDX2 [[SREG:SGPR[0-9]+_SGPR[0-9]+]]
+; SI: V_LSHL_B64 [[LO_VREG:VGPR[0-9]+]]_VGPR{{[0-9]+}}, [[SREG]], 2
+; SI-NOT: [[LO_VREG]]
+; SI: BUFFER_STORE_DWORD [[LO_VREG]],
+define void @trunc_shl_i64(i32 addrspace(1)* %out, i64 %a) {
+ %b = shl i64 %a, 2
+ %result = trunc i64 %b to i32
+ store i32 %result, i32 addrspace(1)* %out, align 4
+ ret void
+}
OpenPOWER on IntegriCloud