Skip to content

Commit f33b00d

Browse files
committed
revert intrinsic change, update pattern
1 parent 051d98e commit f33b00d

File tree

2 files changed

+66
-7
lines changed

2 files changed

+66
-7
lines changed

llvm/lib/Target/AMDGPU/VOP3Instructions.td

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,13 @@ defm V_BFE_U32 : VOP3Inst <"v_bfe_u32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGP
212212
defm V_BFE_I32 : VOP3Inst <"v_bfe_i32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUbfe_i32>;
213213
defm V_BFI_B32 : VOP3Inst <"v_bfi_b32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUbfi>;
214214
defm V_ALIGNBIT_B32 : VOP3Inst <"v_alignbit_b32", VOP3_Profile<VOP_I32_I32_I32_I32>, fshr>;
215-
defm V_ALIGNBYTE_B32 : VOP3Inst_t16_with_profiles <"v_alignbyte_b32",
216-
VOP3_Profile<VOP_I32_I32_I32_I32>,
217-
VOP3_Profile_True16<VOP_I32_I32_I32_I16, VOP3_OPSEL>,
218-
VOP3_Profile_Fake16<VOP_I32_I32_I32_I16, VOP3_OPSEL>,
219-
int_amdgcn_alignbyte>;
215+
216+
let True16Predicate = NotHasTrue16BitInsts in
217+
defm V_ALIGNBYTE_B32 : VOP3Inst <"v_alignbyte_b32", VOP3_Profile<VOP_I32_I32_I32_I32>, int_amdgcn_alignbyte>;
218+
let True16Predicate = UseRealTrue16Insts in
219+
defm V_ALIGNBYTE_B32_t16 : VOP3Inst <"v_alignbyte_b32_t16", VOP3_Profile_True16<VOP_I32_I32_I32_I16, VOP3_OPSEL>>;
220+
let True16Predicate = UseFakeTrue16Insts in
221+
defm V_ALIGNBYTE_B32_fake16 : VOP3Inst <"v_alignbyte_b32_fake16", VOP3_Profile_Fake16<VOP_I32_I32_I32_I16, VOP3_OPSEL>>;
220222

221223
// XXX - No FPException seems suspect but manual doesn't say it does
222224
let mayRaiseFPException = 0 in {
@@ -254,6 +256,25 @@ let SchedRW = [WriteDoubleAdd], FPDPRounding = 1 in {
254256
} // End SchedRW = [WriteDoubleAdd], FPDPRounding = 1
255257
} // End isReMaterializable = 1
256258

259+
let True16Predicate = UseFakeTrue16Insts in
260+
def : GCNPat <
261+
(i32 (int_amdgcn_alignbyte (i32 (VOP3OpSelMods i32:$src0, i32:$src0_modifiers)),
262+
(i32 (VOP3OpSelMods i32:$src1, i32:$src1_modifiers)),
263+
(i32 (VOP3OpSelMods i32:$src2, i32:$src2_modifiers)))),
264+
(V_ALIGNBYTE_B32_fake16_e64 i32:$src0_modifiers, VSrc_b32:$src0,
265+
i32:$src1_modifiers, VSrc_b32:$src1,
266+
i32:$src2_modifiers, VGPR_32:$src2)
267+
>;
268+
269+
let True16Predicate = UseRealTrue16Insts in
270+
def : GCNPat <
271+
(i32 (int_amdgcn_alignbyte (i32 (VOP3OpSelMods i32:$src0, i32:$src0_modifiers)),
272+
(i32 (VOP3OpSelMods i32:$src1, i32:$src1_modifiers)),
273+
(i32 (VOP3OpSelMods i32:$src2, i32:$src2_modifiers)))),
274+
(V_ALIGNBYTE_B32_t16_e64 i32:$src0_modifiers, VSrc_b32:$src0,
275+
i32:$src1_modifiers, VSrc_b32:$src1,
276+
i32:$src2_modifiers, (i16 (EXTRACT_SUBREG VGPR_32:$src2, lo16)))
277+
>;
257278

258279
let mayRaiseFPException = 0 in { // Seems suspicious but manual doesn't say it does.
259280
let SchedRW = [WriteFloatFMA, WriteSALU] in

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.alignbyte.ll

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,48 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
12
; RUN: llc -mtriple=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3+
; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=+real-true16 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11-TRUE16 %s
4+
; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=-real-true16 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11-FAKE16 %s
25

36
declare i32 @llvm.amdgcn.alignbyte(i32, i32, i32) #0
47

5-
; GCN-LABEL: {{^}}v_alignbyte_b32:
6-
; GCN: v_alignbyte_b32 {{[vs][0-9]+}}, {{[vs][0-9]+}}, {{[vs][0-9]+}}
78
define amdgpu_kernel void @v_alignbyte_b32(ptr addrspace(1) %out, i32 %src1, i32 %src2, i32 %src3) #1 {
9+
; GCN-LABEL: v_alignbyte_b32:
10+
; GCN: ; %bb.0:
11+
; GCN-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0xb
12+
; GCN-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x9
13+
; GCN-NEXT: s_mov_b32 s7, 0xf000
14+
; GCN-NEXT: s_mov_b32 s6, -1
15+
; GCN-NEXT: s_waitcnt lgkmcnt(0)
16+
; GCN-NEXT: v_mov_b32_e32 v0, s1
17+
; GCN-NEXT: v_mov_b32_e32 v1, s2
18+
; GCN-NEXT: v_alignbyte_b32 v0, s0, v0, v1
19+
; GCN-NEXT: buffer_store_dword v0, off, s[4:7], 0
20+
; GCN-NEXT: s_endpgm
21+
;
22+
; GFX11-TRUE16-LABEL: v_alignbyte_b32:
23+
; GFX11-TRUE16: ; %bb.0:
24+
; GFX11-TRUE16-NEXT: s_clause 0x1
25+
; GFX11-TRUE16-NEXT: s_load_b128 s[0:3], s[4:5], 0x2c
26+
; GFX11-TRUE16-NEXT: s_load_b64 s[4:5], s[4:5], 0x24
27+
; GFX11-TRUE16-NEXT: v_mov_b32_e32 v1, 0
28+
; GFX11-TRUE16-NEXT: s_waitcnt lgkmcnt(0)
29+
; GFX11-TRUE16-NEXT: v_mov_b16_e32 v0.l, s2
30+
; GFX11-TRUE16-NEXT: s_delay_alu instid0(VALU_DEP_1)
31+
; GFX11-TRUE16-NEXT: v_alignbyte_b32 v0, s0, s1, v0.l
32+
; GFX11-TRUE16-NEXT: global_store_b32 v1, v0, s[4:5]
33+
; GFX11-TRUE16-NEXT: s_endpgm
34+
;
35+
; GFX11-FAKE16-LABEL: v_alignbyte_b32:
36+
; GFX11-FAKE16: ; %bb.0:
37+
; GFX11-FAKE16-NEXT: s_clause 0x1
38+
; GFX11-FAKE16-NEXT: s_load_b128 s[0:3], s[4:5], 0x2c
39+
; GFX11-FAKE16-NEXT: s_load_b64 s[4:5], s[4:5], 0x24
40+
; GFX11-FAKE16-NEXT: s_waitcnt lgkmcnt(0)
41+
; GFX11-FAKE16-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v0, s2
42+
; GFX11-FAKE16-NEXT: s_delay_alu instid0(VALU_DEP_1)
43+
; GFX11-FAKE16-NEXT: v_alignbyte_b32 v0, s0, s1, v0
44+
; GFX11-FAKE16-NEXT: global_store_b32 v1, v0, s[4:5]
45+
; GFX11-FAKE16-NEXT: s_endpgm
846
%val = call i32 @llvm.amdgcn.alignbyte(i32 %src1, i32 %src2, i32 %src3) #0
947
store i32 %val, ptr addrspace(1) %out
1048
ret void

0 commit comments

Comments
 (0)