mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
R600/SI: Use a multiclass for MUBUF_Load_Helper
This will simplify the instructions and also the pattern definitions. Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182288 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
307a84425c
commit
5ad6d082fc
@ -300,17 +300,29 @@ class MTBUF_Store_Helper <bits<3> op, string asm, RegisterClass regClass> : MTBU
|
|||||||
let mayLoad = 0;
|
let mayLoad = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MUBUF_Load_Helper <bits<7> op, string asm, RegisterClass regClass> : MUBUF <
|
multiclass MUBUF_Load_Helper <bits<7> op, string asm, RegisterClass regClass> {
|
||||||
op,
|
|
||||||
(outs regClass:$vdata),
|
let glc = 0, lds = 0, slc = 0, tfe = 0, soffset = 128 /* ZERO */,
|
||||||
(ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64,
|
mayLoad = 1 in {
|
||||||
i1imm:$lds, VReg_32:$vaddr, SReg_128:$srsrc, i1imm:$slc,
|
|
||||||
i1imm:$tfe, SSrc_32:$soffset),
|
let offen = 1, idxen = 0, addr64 = 0, offset = 0 in {
|
||||||
asm#" $vdata, $offset, $offen, $idxen, $glc, $addr64, "
|
def _OFFEN : MUBUF <op, (outs regClass:$vdata),
|
||||||
#"$lds, $vaddr, $srsrc, $slc, $tfe, $soffset",
|
(ins SReg_128:$srsrc, VReg_32:$vaddr),
|
||||||
[]> {
|
asm#" $vdata, $srsrc + $vaddr", []>;
|
||||||
let mayLoad = 1;
|
}
|
||||||
let mayStore = 0;
|
|
||||||
|
let offen = 0, idxen = 1, addr64 = 0 in {
|
||||||
|
def _IDXEN : MUBUF <op, (outs regClass:$vdata),
|
||||||
|
(ins SReg_128:$srsrc, VReg_32:$vaddr, i16imm:$offset),
|
||||||
|
asm#" $vdata, $srsrc[$vaddr] + $offset", []>;
|
||||||
|
}
|
||||||
|
|
||||||
|
let offen = 0, idxen = 0, addr64 = 1 in {
|
||||||
|
def _ADDR64 : MUBUF <op, (outs regClass:$vdata),
|
||||||
|
(ins SReg_128:$srsrc, VReg_64:$vaddr, i16imm:$offset),
|
||||||
|
asm#" $vdata, $srsrc + $vaddr + $offset", []>;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MUBUF_Store_Helper <bits<7> op, string name, RegisterClass vdataClass,
|
class MUBUF_Store_Helper <bits<7> op, string name, RegisterClass vdataClass,
|
||||||
|
@ -394,7 +394,7 @@ defm V_CMPX_CLASS_F64 : VOPC_64 <0x000000b8, "V_CMPX_CLASS_F64">;
|
|||||||
//def BUFFER_LOAD_FORMAT_X : MUBUF_ <0x00000000, "BUFFER_LOAD_FORMAT_X", []>;
|
//def BUFFER_LOAD_FORMAT_X : MUBUF_ <0x00000000, "BUFFER_LOAD_FORMAT_X", []>;
|
||||||
//def BUFFER_LOAD_FORMAT_XY : MUBUF_ <0x00000001, "BUFFER_LOAD_FORMAT_XY", []>;
|
//def BUFFER_LOAD_FORMAT_XY : MUBUF_ <0x00000001, "BUFFER_LOAD_FORMAT_XY", []>;
|
||||||
//def BUFFER_LOAD_FORMAT_XYZ : MUBUF_ <0x00000002, "BUFFER_LOAD_FORMAT_XYZ", []>;
|
//def BUFFER_LOAD_FORMAT_XYZ : MUBUF_ <0x00000002, "BUFFER_LOAD_FORMAT_XYZ", []>;
|
||||||
def BUFFER_LOAD_FORMAT_XYZW : MUBUF_Load_Helper <0x00000003, "BUFFER_LOAD_FORMAT_XYZW", VReg_128>;
|
defm BUFFER_LOAD_FORMAT_XYZW : MUBUF_Load_Helper <0x00000003, "BUFFER_LOAD_FORMAT_XYZW", VReg_128>;
|
||||||
//def BUFFER_STORE_FORMAT_X : MUBUF_ <0x00000004, "BUFFER_STORE_FORMAT_X", []>;
|
//def BUFFER_STORE_FORMAT_X : MUBUF_ <0x00000004, "BUFFER_STORE_FORMAT_X", []>;
|
||||||
//def BUFFER_STORE_FORMAT_XY : MUBUF_ <0x00000005, "BUFFER_STORE_FORMAT_XY", []>;
|
//def BUFFER_STORE_FORMAT_XY : MUBUF_ <0x00000005, "BUFFER_STORE_FORMAT_XY", []>;
|
||||||
//def BUFFER_STORE_FORMAT_XYZ : MUBUF_ <0x00000006, "BUFFER_STORE_FORMAT_XYZ", []>;
|
//def BUFFER_STORE_FORMAT_XYZ : MUBUF_ <0x00000006, "BUFFER_STORE_FORMAT_XYZ", []>;
|
||||||
@ -403,9 +403,9 @@ def BUFFER_LOAD_FORMAT_XYZW : MUBUF_Load_Helper <0x00000003, "BUFFER_LOAD_FORMAT
|
|||||||
//def BUFFER_LOAD_SBYTE : MUBUF_ <0x00000009, "BUFFER_LOAD_SBYTE", []>;
|
//def BUFFER_LOAD_SBYTE : MUBUF_ <0x00000009, "BUFFER_LOAD_SBYTE", []>;
|
||||||
//def BUFFER_LOAD_USHORT : MUBUF_ <0x0000000a, "BUFFER_LOAD_USHORT", []>;
|
//def BUFFER_LOAD_USHORT : MUBUF_ <0x0000000a, "BUFFER_LOAD_USHORT", []>;
|
||||||
//def BUFFER_LOAD_SSHORT : MUBUF_ <0x0000000b, "BUFFER_LOAD_SSHORT", []>;
|
//def BUFFER_LOAD_SSHORT : MUBUF_ <0x0000000b, "BUFFER_LOAD_SSHORT", []>;
|
||||||
def BUFFER_LOAD_DWORD : MUBUF_Load_Helper <0x0000000c, "BUFFER_LOAD_DWORD", VReg_32>;
|
defm BUFFER_LOAD_DWORD : MUBUF_Load_Helper <0x0000000c, "BUFFER_LOAD_DWORD", VReg_32>;
|
||||||
def BUFFER_LOAD_DWORDX2 : MUBUF_Load_Helper <0x0000000d, "BUFFER_LOAD_DWORDX2", VReg_64>;
|
defm BUFFER_LOAD_DWORDX2 : MUBUF_Load_Helper <0x0000000d, "BUFFER_LOAD_DWORDX2", VReg_64>;
|
||||||
def BUFFER_LOAD_DWORDX4 : MUBUF_Load_Helper <0x0000000e, "BUFFER_LOAD_DWORDX4", VReg_128>;
|
defm BUFFER_LOAD_DWORDX4 : MUBUF_Load_Helper <0x0000000e, "BUFFER_LOAD_DWORDX4", VReg_128>;
|
||||||
//def BUFFER_STORE_BYTE : MUBUF_ <0x00000018, "BUFFER_STORE_BYTE", []>;
|
//def BUFFER_STORE_BYTE : MUBUF_ <0x00000018, "BUFFER_STORE_BYTE", []>;
|
||||||
//def BUFFER_STORE_SHORT : MUBUF_ <0x0000001a, "BUFFER_STORE_SHORT", []>;
|
//def BUFFER_STORE_SHORT : MUBUF_ <0x0000001a, "BUFFER_STORE_SHORT", []>;
|
||||||
|
|
||||||
@ -1214,10 +1214,8 @@ def : Pat <
|
|||||||
|
|
||||||
/* int_SI_vs_load_input */
|
/* int_SI_vs_load_input */
|
||||||
def : Pat<
|
def : Pat<
|
||||||
(int_SI_vs_load_input v16i8:$tlst, IMM12bit:$attr_offset,
|
(int_SI_vs_load_input v16i8:$tlst, IMM12bit:$attr_offset, i32:$buf_idx_vgpr),
|
||||||
i32:$buf_idx_vgpr),
|
(BUFFER_LOAD_FORMAT_XYZW_IDXEN $tlst, $buf_idx_vgpr, imm:$attr_offset)
|
||||||
(BUFFER_LOAD_FORMAT_XYZW imm:$attr_offset, 0, 1, 0, 0, 0,
|
|
||||||
$buf_idx_vgpr, $tlst, 0, 0, 0)
|
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/* int_SI_export */
|
/* int_SI_export */
|
||||||
@ -1542,7 +1540,7 @@ def : Pat <
|
|||||||
// 3. Offset in an 32Bit VGPR
|
// 3. Offset in an 32Bit VGPR
|
||||||
def : Pat <
|
def : Pat <
|
||||||
(int_SI_load_const v16i8:$sbase, i32:$voff),
|
(int_SI_load_const v16i8:$sbase, i32:$voff),
|
||||||
(BUFFER_LOAD_DWORD 0, 1, 0, 0, 0, 0, $voff, $sbase, 0, 0, 0)
|
(BUFFER_LOAD_DWORD_OFFEN $sbase, $voff)
|
||||||
>;
|
>;
|
||||||
|
|
||||||
// The multiplication scales from [0,1] to the unsigned integer range
|
// The multiplication scales from [0,1] to the unsigned integer range
|
||||||
|
Loading…
x
Reference in New Issue
Block a user