Skip to content

Commit 36ef561

Browse files
committed
[AMDGPU] gfx1250 SADDR tests update. NFC
1 parent c6c48b4 commit 36ef561

File tree

2 files changed

+149
-97
lines changed

2 files changed

+149
-97
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -mtriple=amdgcn -mcpu=gfx1250 < %s | FileCheck -check-prefixes=GCN %s
3+
4+
; The first load produces address in a VGPR which is used in address calculation
5+
; of the second load (one inside the loop). The value is uniform and the inner
6+
; load correctly selected to use SADDR form, however the address is promoted to
7+
; vector registers because it all starts with a VGPR produced by the entry block
8+
; load.
9+
;
10+
; Check that we are changing SADDR form of a load to VADDR and do not have to use
11+
; readfirstlane instructions to move address from VGPRs into SGPRs.
12+
13+
define amdgpu_kernel void @test_move_load_address_to_vgpr(ptr addrspace(1) nocapture %arg1, ptr nocapture %arg2) {
14+
; GCN-LABEL: test_move_load_address_to_vgpr:
15+
; GCN: ; %bb.0: ; %bb
16+
; GCN-NEXT: s_load_b128 s[0:3], s[4:5], 0x24
17+
; GCN-NEXT: v_mov_b32_e32 v3, 0
18+
; GCN-NEXT: s_wait_kmcnt 0x0
19+
; GCN-NEXT: global_load_b32 v2, v3, s[0:1] scope:SCOPE_SYS
20+
; GCN-NEXT: s_wait_loadcnt 0x0
21+
; GCN-NEXT: v_lshlrev_b64_e32 v[0:1], 2, v[2:3]
22+
; GCN-NEXT: v_add_nc_u32_e32 v2, 0xffffff00, v2
23+
; GCN-NEXT: s_delay_alu instid0(VALU_DEP_2)
24+
; GCN-NEXT: v_add_nc_u64_e32 v[0:1], s[2:3], v[0:1]
25+
; GCN-NEXT: .LBB0_1: ; %bb3
26+
; GCN-NEXT: ; =>This Inner Loop Header: Depth=1
27+
; GCN-NEXT: s_wait_dscnt 0x0
28+
; GCN-NEXT: flat_load_b32 v3, v[0:1] scope:SCOPE_SYS
29+
; GCN-NEXT: s_wait_loadcnt 0x0
30+
; GCN-NEXT: s_wait_xcnt 0x0
31+
; GCN-NEXT: v_add_nc_u64_e32 v[0:1], 4, v[0:1]
32+
; GCN-NEXT: v_add_co_u32 v2, s0, v2, 1
33+
; GCN-NEXT: s_and_b32 vcc_lo, exec_lo, s0
34+
; GCN-NEXT: s_cbranch_vccz .LBB0_1
35+
; GCN-NEXT: ; %bb.2: ; %bb2
36+
; GCN-NEXT: s_endpgm
37+
bb:
38+
%i2 = load volatile i32, ptr addrspace(1) %arg1, align 4
39+
br label %bb3
40+
41+
bb2: ; preds = %bb3
42+
ret void
43+
44+
bb3: ; preds = %bb3, %bb
45+
%i = phi i32 [ %i2, %bb ], [ %i8, %bb3 ]
46+
%i4 = zext i32 %i to i64
47+
%i5 = getelementptr inbounds i32, ptr %arg2, i64 %i4
48+
%i6 = load volatile i32, ptr %i5, align 4
49+
%i8 = add nuw nsw i32 %i, 1
50+
%i9 = icmp eq i32 %i8, 256
51+
br i1 %i9, label %bb2, label %bb3
52+
}

0 commit comments

Comments
 (0)