diff options
| author | Tom Stellard <thomas.stellard@amd.com> | 2016-12-06 21:13:30 +0000 |
|---|---|---|
| committer | Tom Stellard <thomas.stellard@amd.com> | 2016-12-06 21:13:30 +0000 |
| commit | 00cfa747156c8a7bb25be3e6a85272a61b0b15ca (patch) | |
| tree | 3f9aaf7d2c08c06a3c88cf8b2bf7d81e7cb1287d /llvm/test | |
| parent | 14ceb45fb491ea54a61efb9e32c7b1dc902fa009 (diff) | |
| download | bcm5719-llvm-00cfa747156c8a7bb25be3e6a85272a61b0b15ca.tar.gz bcm5719-llvm-00cfa747156c8a7bb25be3e6a85272a61b0b15ca.zip | |
AMDGPU/SI: Don't move copies of immediates to the VALU
Summary:
If we write an immediate to a VGPR and then copy the VGPR to an
SGPR, we can replace the copy with a S_MOV_B32 sgpr, imm, rather than
moving the copy to the SALU.
Reviewers: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, llvm-commits, tony-tye
Differential Revision: https://reviews.llvm.org/D27272
llvm-svn: 288849
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/AMDGPU/salu-to-valu.ll | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/salu-to-valu.ll b/llvm/test/CodeGen/AMDGPU/salu-to-valu.ll index ff013060dce..37083fbbd3c 100644 --- a/llvm/test/CodeGen/AMDGPU/salu-to-valu.ll +++ b/llvm/test/CodeGen/AMDGPU/salu-to-valu.ll @@ -478,5 +478,30 @@ bb4: br label %bb1 } +; GCN-LABEL: {{^}}phi_imm_in_sgprs +; GCN: s_movk_i32 [[A:s[0-9]+]], 0x400 +; GCN: s_movk_i32 [[B:s[0-9]+]], 0x400 +; GCN: [[LOOP_LABEL:[0-9a-zA-Z_]+]]: +; GCN: s_xor_b32 [[B]], [[B]], [[A]] +; GCN: s_cbranch_scc{{[01]}} [[LOOP_LABEL]] +define void @phi_imm_in_sgprs(i32 addrspace(3)* %out, i32 %cond) { +entry: + br label %loop + +loop: + %i = phi i32 [0, %entry], [%i.add, %loop] + %offset = phi i32 [1024, %entry], [%offset.xor, %loop] + %offset.xor = xor i32 %offset, 1024 + %offset.i = add i32 %offset.xor, %i + %ptr = getelementptr i32, i32 addrspace(3)* %out, i32 %offset.i + store i32 0, i32 addrspace(3)* %ptr + %i.add = add i32 %i, 1 + %cmp = icmp ult i32 %i.add, %cond + br i1 %cmp, label %loop, label %exit + +exit: + ret void +} + attributes #0 = { nounwind readnone } attributes #1 = { nounwind } |

