@@ -48,5 +48,81 @@ define amdgpu_kernel void @v_alignbyte_b32(ptr addrspace(1) %out, i32 %src1, i32
4848 ret void
4949}
5050
51+ define amdgpu_kernel void @v_alignbyte_b32_2 (ptr addrspace (1 ) %out , ptr addrspace (1 ) %src1 , ptr addrspace (1 ) %src2 , i32 %src3 ) #1 {
52+ ; GCN-LABEL: v_alignbyte_b32_2:
53+ ; GCN: ; %bb.0:
54+ ; GCN-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x9
55+ ; GCN-NEXT: s_load_dwordx2 s[8:9], s[4:5], 0xd
56+ ; GCN-NEXT: s_load_dword s16, s[4:5], 0xf
57+ ; GCN-NEXT: s_mov_b32 s7, 0xf000
58+ ; GCN-NEXT: s_mov_b32 s14, 0
59+ ; GCN-NEXT: v_lshlrev_b32_e32 v0, 2, v0
60+ ; GCN-NEXT: v_mov_b32_e32 v1, 0
61+ ; GCN-NEXT: s_mov_b32 s15, s7
62+ ; GCN-NEXT: s_mov_b64 s[10:11], s[14:15]
63+ ; GCN-NEXT: s_waitcnt lgkmcnt(0)
64+ ; GCN-NEXT: s_mov_b64 s[12:13], s[2:3]
65+ ; GCN-NEXT: buffer_load_dword v2, v[0:1], s[12:15], 0 addr64 glc
66+ ; GCN-NEXT: s_waitcnt vmcnt(0)
67+ ; GCN-NEXT: buffer_load_dword v0, v[0:1], s[8:11], 0 addr64 glc
68+ ; GCN-NEXT: s_waitcnt vmcnt(0)
69+ ; GCN-NEXT: s_mov_b32 s6, -1
70+ ; GCN-NEXT: s_mov_b32 s4, s0
71+ ; GCN-NEXT: s_mov_b32 s5, s1
72+ ; GCN-NEXT: v_alignbyte_b32 v0, v2, v0, s16
73+ ; GCN-NEXT: buffer_store_dword v0, off, s[4:7], 0
74+ ; GCN-NEXT: s_endpgm
75+ ;
76+ ; GFX11-TRUE16-LABEL: v_alignbyte_b32_2:
77+ ; GFX11-TRUE16: ; %bb.0:
78+ ; GFX11-TRUE16-NEXT: s_clause 0x1
79+ ; GFX11-TRUE16-NEXT: s_load_b128 s[0:3], s[4:5], 0x24
80+ ; GFX11-TRUE16-NEXT: s_load_b64 s[6:7], s[4:5], 0x34
81+ ; GFX11-TRUE16-NEXT: v_dual_mov_b32 v3, 0 :: v_dual_and_b32 v0, 0x3ff, v0
82+ ; GFX11-TRUE16-NEXT: s_delay_alu instid0(VALU_DEP_1)
83+ ; GFX11-TRUE16-NEXT: v_lshlrev_b32_e32 v0, 2, v0
84+ ; GFX11-TRUE16-NEXT: s_waitcnt lgkmcnt(0)
85+ ; GFX11-TRUE16-NEXT: global_load_b32 v1, v0, s[2:3] glc dlc
86+ ; GFX11-TRUE16-NEXT: s_waitcnt vmcnt(0)
87+ ; GFX11-TRUE16-NEXT: global_load_b32 v2, v0, s[6:7] glc dlc
88+ ; GFX11-TRUE16-NEXT: s_waitcnt vmcnt(0)
89+ ; GFX11-TRUE16-NEXT: s_load_b32 s2, s[4:5], 0x3c
90+ ; GFX11-TRUE16-NEXT: s_waitcnt lgkmcnt(0)
91+ ; GFX11-TRUE16-NEXT: v_mov_b16_e32 v0.l, s2
92+ ; GFX11-TRUE16-NEXT: s_delay_alu instid0(VALU_DEP_1)
93+ ; GFX11-TRUE16-NEXT: v_alignbyte_b32 v0, v1, v2, v0.l
94+ ; GFX11-TRUE16-NEXT: global_store_b32 v3, v0, s[0:1]
95+ ; GFX11-TRUE16-NEXT: s_endpgm
96+ ;
97+ ; GFX11-FAKE16-LABEL: v_alignbyte_b32_2:
98+ ; GFX11-FAKE16: ; %bb.0:
99+ ; GFX11-FAKE16-NEXT: s_clause 0x1
100+ ; GFX11-FAKE16-NEXT: s_load_b128 s[0:3], s[4:5], 0x24
101+ ; GFX11-FAKE16-NEXT: s_load_b64 s[6:7], s[4:5], 0x34
102+ ; GFX11-FAKE16-NEXT: v_and_b32_e32 v0, 0x3ff, v0
103+ ; GFX11-FAKE16-NEXT: v_mov_b32_e32 v2, 0
104+ ; GFX11-FAKE16-NEXT: s_delay_alu instid0(VALU_DEP_2)
105+ ; GFX11-FAKE16-NEXT: v_lshlrev_b32_e32 v0, 2, v0
106+ ; GFX11-FAKE16-NEXT: s_waitcnt lgkmcnt(0)
107+ ; GFX11-FAKE16-NEXT: global_load_b32 v1, v0, s[2:3] glc dlc
108+ ; GFX11-FAKE16-NEXT: s_waitcnt vmcnt(0)
109+ ; GFX11-FAKE16-NEXT: global_load_b32 v0, v0, s[6:7] glc dlc
110+ ; GFX11-FAKE16-NEXT: s_waitcnt vmcnt(0)
111+ ; GFX11-FAKE16-NEXT: s_load_b32 s2, s[4:5], 0x3c
112+ ; GFX11-FAKE16-NEXT: s_waitcnt lgkmcnt(0)
113+ ; GFX11-FAKE16-NEXT: v_alignbyte_b32 v0, v1, v0, s2
114+ ; GFX11-FAKE16-NEXT: global_store_b32 v2, v0, s[0:1]
115+ ; GFX11-FAKE16-NEXT: s_endpgm
116+ %tid = call i32 @llvm.amdgcn.workitem.id.x ()
117+ %a.gep = getelementptr inbounds i32 , ptr addrspace (1 ) %src1 , i32 %tid
118+ %b.gep = getelementptr inbounds i32 , ptr addrspace (1 ) %src2 , i32 %tid
119+ %a.val = load volatile i32 , ptr addrspace (1 ) %a.gep
120+ %b.val = load volatile i32 , ptr addrspace (1 ) %b.gep
121+
122+ %val = call i32 @llvm.amdgcn.alignbyte (i32 %a.val , i32 %b.val , i32 %src3 ) #0
123+ store i32 %val , ptr addrspace (1 ) %out
124+ ret void
125+ }
126+
51127attributes #0 = { nounwind readnone }
52128attributes #1 = { nounwind }
0 commit comments