Skip to content

Commit 3681a8c

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

File tree

3 files changed

+67
-7
lines changed

3 files changed

+67
-7
lines changed

llvm/lib/Target/AMDGPU/SIInstructions.td

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3802,6 +3802,26 @@ def : FPMinCanonMaxPat<V_MINIMUMMAXIMUM_F16_fake16_e64, f16, DivergentBinFrag<fm
38023802
def : FPMinCanonMaxPat<V_MAXIMUMMINIMUM_F16_fake16_e64, f16, DivergentBinFrag<fminimum>, fmaximum_oneuse>;
38033803
}
38043804

3805+
let True16Predicate = UseFakeTrue16Insts in
3806+
def : GCNPat <
3807+
(i32 (int_amdgcn_alignbyte (i32 (VOP3OpSelMods i32:$src0, i32:$src0_modifiers)),
3808+
(i32 (VOP3OpSelMods i32:$src1, i32:$src1_modifiers)),
3809+
(i32 (VOP3OpSelMods i32:$src2, i32:$src2_modifiers)))),
3810+
(V_ALIGNBYTE_B32_fake16_e64 i32:$src0_modifiers, VSrc_b32:$src0,
3811+
i32:$src1_modifiers, VSrc_b32:$src1,
3812+
i32:$src2_modifiers, VGPR_32:$src2)
3813+
>;
3814+
3815+
let True16Predicate = UseRealTrue16Insts in
3816+
def : GCNPat <
3817+
(i32 (int_amdgcn_alignbyte (i32 (VOP3OpSelMods i32:$src0, i32:$src0_modifiers)),
3818+
(i32 (VOP3OpSelMods i32:$src1, i32:$src1_modifiers)),
3819+
(i32 (VOP3OpSelMods i32:$src2, i32:$src2_modifiers)))),
3820+
(V_ALIGNBYTE_B32_t16_e64 i32:$src0_modifiers, VSrc_b32:$src0,
3821+
i32:$src1_modifiers, VSrc_b32:$src1,
3822+
i32:$src2_modifiers, (i16 (EXTRACT_SUBREG VGPR_32:$src2, lo16)))
3823+
>;
3824+
38053825
// Convert a floating-point power of 2 to the integer exponent.
38063826
def FPPow2ToExponentXForm : SDNodeXForm<fpimm, [{
38073827
const auto &APF = N->getValueAPF();

llvm/lib/Target/AMDGPU/VOP3Instructions.td

Lines changed: 7 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 {

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)