diff --git a/lib/Target/AMDGPU/CaymanInstructions.td b/lib/Target/AMDGPU/CaymanInstructions.td index 98bc6e856ea..a38a3bba6ed 100644 --- a/lib/Target/AMDGPU/CaymanInstructions.td +++ b/lib/Target/AMDGPU/CaymanInstructions.td @@ -85,14 +85,13 @@ def RAT_STORE_TYPED_cm: CF_MEM_RAT_STORE_TYPED<0> { let eop = 0; // This bit is not used on Cayman. } -class VTX_READ_cm buffer_id, dag outs, list pattern> - : VTX_WORD0_cm, VTX_READ { +class VTX_READ_cm + : VTX_WORD0_cm, VTX_READ { // Static fields let VC_INST = 0; let FETCH_TYPE = 2; let FETCH_WHOLE_QUAD = 0; - let BUFFER_ID = buffer_id; let SRC_REL = 0; // XXX: We can infer this field based on the SRC_GPR. This would allow us // to store vertex addresses in any channel, not just X. @@ -105,9 +104,9 @@ class VTX_READ_cm buffer_id, dag outs, list pattern> let Inst{31-0} = Word0; } -class VTX_READ_8_cm buffer_id, list pattern> - : VTX_READ_cm <"VTX_READ_8 $dst_gpr, $src_gpr", buffer_id, - (outs R600_TReg32_X:$dst_gpr), pattern> { +def VTX_READ_8_cm + : VTX_READ_cm <"VTX_READ_8 $dst_gpr, $src_gpr", + (outs R600_TReg32_X:$dst_gpr)> { let DST_SEL_X = 0; let DST_SEL_Y = 7; // Masked @@ -116,9 +115,9 @@ class VTX_READ_8_cm buffer_id, list pattern> let DATA_FORMAT = 1; // FMT_8 } -class VTX_READ_16_cm buffer_id, list pattern> - : VTX_READ_cm <"VTX_READ_16 $dst_gpr, $src_gpr", buffer_id, - (outs R600_TReg32_X:$dst_gpr), pattern> { +def VTX_READ_16_cm + : VTX_READ_cm <"VTX_READ_16 $dst_gpr, $src_gpr", + (outs R600_TReg32_X:$dst_gpr)> { let DST_SEL_X = 0; let DST_SEL_Y = 7; // Masked let DST_SEL_Z = 7; // Masked @@ -127,9 +126,9 @@ class VTX_READ_16_cm buffer_id, list pattern> } -class VTX_READ_32_cm buffer_id, list pattern> - : VTX_READ_cm <"VTX_READ_32 $dst_gpr, $src_gpr", buffer_id, - (outs R600_TReg32_X:$dst_gpr), pattern> { +def VTX_READ_32_cm + : VTX_READ_cm <"VTX_READ_32 $dst_gpr, $src_gpr", + (outs R600_TReg32_X:$dst_gpr)> { let DST_SEL_X = 0; let DST_SEL_Y = 7; // Masked @@ -147,9 +146,9 @@ class VTX_READ_32_cm buffer_id, list pattern> let Constraints = "$src_gpr.ptr = $dst_gpr"; } -class VTX_READ_64_cm buffer_id, list pattern> - : VTX_READ_cm <"VTX_READ_64 $dst_gpr, $src_gpr", buffer_id, - (outs R600_Reg64:$dst_gpr), pattern> { +def VTX_READ_64_cm + : VTX_READ_cm <"VTX_READ_64 $dst_gpr.XY, $src_gpr", + (outs R600_Reg64:$dst_gpr)> { let DST_SEL_X = 0; let DST_SEL_Y = 1; @@ -158,9 +157,9 @@ class VTX_READ_64_cm buffer_id, list pattern> let DATA_FORMAT = 0x1D; // COLOR_32_32 } -class VTX_READ_128_cm buffer_id, list pattern> - : VTX_READ_cm <"VTX_READ_128 $dst_gpr.XYZW, $src_gpr", buffer_id, - (outs R600_Reg128:$dst_gpr), pattern> { +def VTX_READ_128_cm + : VTX_READ_cm <"VTX_READ_128 $dst_gpr.XYZW, $src_gpr", + (outs R600_Reg128:$dst_gpr)> { let DST_SEL_X = 0; let DST_SEL_Y = 1; @@ -177,79 +176,44 @@ class VTX_READ_128_cm buffer_id, list pattern> //===----------------------------------------------------------------------===// // VTX Read from parameter memory space //===----------------------------------------------------------------------===// -def VTX_READ_PARAM_8_cm : VTX_READ_8_cm <0, - [(set i32:$dst_gpr, (load_param_exti8 ADDRVTX_READ:$src_gpr))] ->; +def : Pat<(i32:$dst_gpr (vtx_id3_az_extloadi8 ADDRVTX_READ:$src_gpr)), + (VTX_READ_8_cm MEMxi:$src_gpr, 3)>; +def : Pat<(i32:$dst_gpr (vtx_id3_az_extloadi16 ADDRVTX_READ:$src_gpr)), + (VTX_READ_16_cm MEMxi:$src_gpr, 3)>; +def : Pat<(i32:$dst_gpr (vtx_id3_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_32_cm MEMxi:$src_gpr, 3)>; +def : Pat<(v2i32:$dst_gpr (vtx_id3_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_64_cm MEMxi:$src_gpr, 3)>; +def : Pat<(v4i32:$dst_gpr (vtx_id3_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_128_cm MEMxi:$src_gpr, 3)>; -def VTX_READ_PARAM_16_cm : VTX_READ_16_cm <0, - [(set i32:$dst_gpr, (load_param_exti16 ADDRVTX_READ:$src_gpr))] ->; - -def VTX_READ_PARAM_32_cm : VTX_READ_32_cm <0, - [(set i32:$dst_gpr, (load_param ADDRVTX_READ:$src_gpr))] ->; - -def VTX_READ_PARAM_64_cm : VTX_READ_64_cm <0, - [(set v2i32:$dst_gpr, (load_param ADDRVTX_READ:$src_gpr))] ->; - -def VTX_READ_PARAM_128_cm : VTX_READ_128_cm <0, - [(set v4i32:$dst_gpr, (load_param ADDRVTX_READ:$src_gpr))] ->; +//===----------------------------------------------------------------------===// +// VTX Read from constant memory space +//===----------------------------------------------------------------------===// +def : Pat<(i32:$dst_gpr (vtx_id2_az_extloadi8 ADDRVTX_READ:$src_gpr)), + (VTX_READ_8_cm MEMxi:$src_gpr, 2)>; +def : Pat<(i32:$dst_gpr (vtx_id2_az_extloadi16 ADDRVTX_READ:$src_gpr)), + (VTX_READ_16_cm MEMxi:$src_gpr, 2)>; +def : Pat<(i32:$dst_gpr (vtx_id2_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_32_cm MEMxi:$src_gpr, 2)>; +def : Pat<(v2i32:$dst_gpr (vtx_id2_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_64_cm MEMxi:$src_gpr, 2)>; +def : Pat<(v4i32:$dst_gpr (vtx_id2_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_128_cm MEMxi:$src_gpr, 2)>; //===----------------------------------------------------------------------===// // VTX Read from global memory space //===----------------------------------------------------------------------===// - -// 8-bit reads -def VTX_READ_ID1_8_cm : VTX_READ_8_cm <1, - [(set i32:$dst_gpr, (vtx_id1_az_extloadi8 ADDRVTX_READ:$src_gpr))] ->; - -// 16-bit reads -def VTX_READ_ID1_16_cm : VTX_READ_16_cm <1, - [(set i32:$dst_gpr, (vtx_id1_az_extloadi16 ADDRVTX_READ:$src_gpr))] ->; - -// 32-bit reads -def VTX_READ_ID1_32_cm : VTX_READ_32_cm <1, - [(set i32:$dst_gpr, (vtx_id1_load ADDRVTX_READ:$src_gpr))] ->; - -// 64-bit reads -def VTX_READ_ID1_64_cm : VTX_READ_64_cm <1, - [(set v2i32:$dst_gpr, (vtx_id1_load ADDRVTX_READ:$src_gpr))] ->; - -// 128-bit reads -def VTX_READ_ID1_128_cm : VTX_READ_128_cm <1, - [(set v4i32:$dst_gpr, (vtx_id1_load ADDRVTX_READ:$src_gpr))] ->; - -// 8-bit reads -def VTX_READ_ID2_8_cm : VTX_READ_8_cm <2, - [(set i32:$dst_gpr, (vtx_id2_az_extloadi8 ADDRVTX_READ:$src_gpr))] ->; - -// 16-bit reads -def VTX_READ_ID2_16_cm : VTX_READ_16_cm <2, - [(set i32:$dst_gpr, (vtx_id2_az_extloadi16 ADDRVTX_READ:$src_gpr))] ->; - -// 32-bit reads -def VTX_READ_ID2_32_cm : VTX_READ_32_cm <2, - [(set i32:$dst_gpr, (vtx_id2_load ADDRVTX_READ:$src_gpr))] ->; - -// 64-bit reads -def VTX_READ_ID2_64_cm : VTX_READ_64_cm <2, - [(set v2i32:$dst_gpr, (vtx_id2_load ADDRVTX_READ:$src_gpr))] ->; - -// 128-bit reads -def VTX_READ_ID2_128_cm : VTX_READ_128_cm <2, - [(set v4i32:$dst_gpr, (vtx_id2_load ADDRVTX_READ:$src_gpr))] ->; +def : Pat<(i32:$dst_gpr (vtx_id1_az_extloadi8 ADDRVTX_READ:$src_gpr)), + (VTX_READ_8_cm MEMxi:$src_gpr, 1)>; +def : Pat<(i32:$dst_gpr (vtx_id1_az_extloadi16 ADDRVTX_READ:$src_gpr)), + (VTX_READ_16_cm MEMxi:$src_gpr, 1)>; +def : Pat<(i32:$dst_gpr (vtx_id1_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_32_cm MEMxi:$src_gpr, 1)>; +def : Pat<(v2i32:$dst_gpr (vtx_id1_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_64_cm MEMxi:$src_gpr, 1)>; +def : Pat<(v4i32:$dst_gpr (vtx_id1_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_128_cm MEMxi:$src_gpr, 1)>; } // End isCayman diff --git a/lib/Target/AMDGPU/EvergreenInstructions.td b/lib/Target/AMDGPU/EvergreenInstructions.td index 94f05cc41af..62de72ad70a 100644 --- a/lib/Target/AMDGPU/EvergreenInstructions.td +++ b/lib/Target/AMDGPU/EvergreenInstructions.td @@ -116,14 +116,13 @@ def RAT_STORE_TYPED_eg: CF_MEM_RAT_STORE_TYPED<1>; } // End usesCustomInserter = 1 -class VTX_READ_eg buffer_id, dag outs, list pattern> - : VTX_WORD0_eg, VTX_READ { +class VTX_READ_eg + : VTX_WORD0_eg, VTX_READ { // Static fields let VC_INST = 0; let FETCH_TYPE = 2; let FETCH_WHOLE_QUAD = 0; - let BUFFER_ID = buffer_id; let SRC_REL = 0; // XXX: We can infer this field based on the SRC_GPR. This would allow us // to store vertex addresses in any channel, not just X. @@ -132,9 +131,9 @@ class VTX_READ_eg buffer_id, dag outs, list pattern> let Inst{31-0} = Word0; } -class VTX_READ_8_eg buffer_id, list pattern> - : VTX_READ_eg <"VTX_READ_8 $dst_gpr, $src_gpr", buffer_id, - (outs R600_TReg32_X:$dst_gpr), pattern> { +def VTX_READ_8_eg + : VTX_READ_eg <"VTX_READ_8 $dst_gpr, $src_gpr", + (outs R600_TReg32_X:$dst_gpr)> { let MEGA_FETCH_COUNT = 1; let DST_SEL_X = 0; @@ -144,9 +143,9 @@ class VTX_READ_8_eg buffer_id, list pattern> let DATA_FORMAT = 1; // FMT_8 } -class VTX_READ_16_eg buffer_id, list pattern> - : VTX_READ_eg <"VTX_READ_16 $dst_gpr, $src_gpr", buffer_id, - (outs R600_TReg32_X:$dst_gpr), pattern> { +def VTX_READ_16_eg + : VTX_READ_eg <"VTX_READ_16 $dst_gpr, $src_gpr", + (outs R600_TReg32_X:$dst_gpr)> { let MEGA_FETCH_COUNT = 2; let DST_SEL_X = 0; let DST_SEL_Y = 7; // Masked @@ -156,9 +155,9 @@ class VTX_READ_16_eg buffer_id, list pattern> } -class VTX_READ_32_eg buffer_id, list pattern> - : VTX_READ_eg <"VTX_READ_32 $dst_gpr, $src_gpr", buffer_id, - (outs R600_TReg32_X:$dst_gpr), pattern> { +def VTX_READ_32_eg + : VTX_READ_eg <"VTX_READ_32 $dst_gpr, $src_gpr", + (outs R600_TReg32_X:$dst_gpr)> { let MEGA_FETCH_COUNT = 4; let DST_SEL_X = 0; @@ -177,9 +176,9 @@ class VTX_READ_32_eg buffer_id, list pattern> let Constraints = "$src_gpr.ptr = $dst_gpr"; } -class VTX_READ_64_eg buffer_id, list pattern> - : VTX_READ_eg <"VTX_READ_64 $dst_gpr.XY, $src_gpr", buffer_id, - (outs R600_Reg64:$dst_gpr), pattern> { +def VTX_READ_64_eg + : VTX_READ_eg <"VTX_READ_64 $dst_gpr.XY, $src_gpr", + (outs R600_Reg64:$dst_gpr)> { let MEGA_FETCH_COUNT = 8; let DST_SEL_X = 0; @@ -189,9 +188,9 @@ class VTX_READ_64_eg buffer_id, list pattern> let DATA_FORMAT = 0x1D; // COLOR_32_32 } -class VTX_READ_128_eg buffer_id, list pattern> - : VTX_READ_eg <"VTX_READ_128 $dst_gpr.XYZW, $src_gpr", buffer_id, - (outs R600_Reg128:$dst_gpr), pattern> { +def VTX_READ_128_eg + : VTX_READ_eg <"VTX_READ_128 $dst_gpr.XYZW, $src_gpr", + (outs R600_Reg128:$dst_gpr)> { let MEGA_FETCH_COUNT = 16; let DST_SEL_X = 0; @@ -209,80 +208,44 @@ class VTX_READ_128_eg buffer_id, list pattern> //===----------------------------------------------------------------------===// // VTX Read from parameter memory space //===----------------------------------------------------------------------===// +def : Pat<(i32:$dst_gpr (vtx_id3_az_extloadi8 ADDRVTX_READ:$src_gpr)), + (VTX_READ_8_eg MEMxi:$src_gpr, 3)>; +def : Pat<(i32:$dst_gpr (vtx_id3_az_extloadi16 ADDRVTX_READ:$src_gpr)), + (VTX_READ_16_eg MEMxi:$src_gpr, 3)>; +def : Pat<(i32:$dst_gpr (vtx_id3_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_32_eg MEMxi:$src_gpr, 3)>; +def : Pat<(v2i32:$dst_gpr (vtx_id3_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_64_eg MEMxi:$src_gpr, 3)>; +def : Pat<(v4i32:$dst_gpr (vtx_id3_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_128_eg MEMxi:$src_gpr, 3)>; -def VTX_READ_PARAM_8_eg : VTX_READ_8_eg <3, - [(set i32:$dst_gpr, (load_param_exti8 ADDRVTX_READ:$src_gpr))] ->; - -def VTX_READ_PARAM_16_eg : VTX_READ_16_eg <3, - [(set i32:$dst_gpr, (load_param_exti16 ADDRVTX_READ:$src_gpr))] ->; - -def VTX_READ_PARAM_32_eg : VTX_READ_32_eg <3, - [(set i32:$dst_gpr, (load_param ADDRVTX_READ:$src_gpr))] ->; - -def VTX_READ_PARAM_64_eg : VTX_READ_64_eg <3, - [(set v2i32:$dst_gpr, (load_param ADDRVTX_READ:$src_gpr))] ->; - -def VTX_READ_PARAM_128_eg : VTX_READ_128_eg <3, - [(set v4i32:$dst_gpr, (load_param ADDRVTX_READ:$src_gpr))] ->; +//===----------------------------------------------------------------------===// +// VTX Read from constant memory space +//===----------------------------------------------------------------------===// +def : Pat<(i32:$dst_gpr (vtx_id2_az_extloadi8 ADDRVTX_READ:$src_gpr)), + (VTX_READ_8_eg MEMxi:$src_gpr, 2)>; +def : Pat<(i32:$dst_gpr (vtx_id2_az_extloadi16 ADDRVTX_READ:$src_gpr)), + (VTX_READ_16_eg MEMxi:$src_gpr, 2)>; +def : Pat<(i32:$dst_gpr (vtx_id2_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_32_eg MEMxi:$src_gpr, 2)>; +def : Pat<(v2i32:$dst_gpr (vtx_id2_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_64_eg MEMxi:$src_gpr, 2)>; +def : Pat<(v4i32:$dst_gpr (vtx_id2_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_128_eg MEMxi:$src_gpr, 2)>; //===----------------------------------------------------------------------===// // VTX Read from global memory space //===----------------------------------------------------------------------===// - -// 8-bit reads -def VTX_READ_ID1_8_eg : VTX_READ_8_eg <1, - [(set i32:$dst_gpr, (vtx_id1_az_extloadi8 ADDRVTX_READ:$src_gpr))] ->; - -// 16-bit reads -def VTX_READ_ID1_16_eg : VTX_READ_16_eg <1, - [(set i32:$dst_gpr, (vtx_id1_az_extloadi16 ADDRVTX_READ:$src_gpr))] ->; - -// 32-bit reads -def VTX_READ_ID1_32_eg : VTX_READ_32_eg <1, - [(set i32:$dst_gpr, (vtx_id1_load ADDRVTX_READ:$src_gpr))] ->; - -// 64-bit reads -def VTX_READ_ID1_64_eg : VTX_READ_64_eg <1, - [(set v2i32:$dst_gpr, (vtx_id1_load ADDRVTX_READ:$src_gpr))] ->; - -// 128-bit reads -def VTX_READ_ID1_128_eg : VTX_READ_128_eg <1, - [(set v4i32:$dst_gpr, (vtx_id1_load ADDRVTX_READ:$src_gpr))] ->; - -// 8-bit reads -def VTX_READ_ID2_8_eg : VTX_READ_8_eg <2, - [(set i32:$dst_gpr, (vtx_id2_az_extloadi8 ADDRVTX_READ:$src_gpr))] ->; - -// 16-bit reads -def VTX_READ_ID2_16_eg : VTX_READ_16_eg <2, - [(set i32:$dst_gpr, (vtx_id2_az_extloadi16 ADDRVTX_READ:$src_gpr))] ->; - -// 32-bit reads -def VTX_READ_ID2_32_eg : VTX_READ_32_eg <2, - [(set i32:$dst_gpr, (vtx_id2_load ADDRVTX_READ:$src_gpr))] ->; - -// 64-bit reads -def VTX_READ_ID2_64_eg : VTX_READ_64_eg <2, - [(set v2i32:$dst_gpr, (vtx_id2_load ADDRVTX_READ:$src_gpr))] ->; - -// 128-bit reads -def VTX_READ_ID2_128_eg : VTX_READ_128_eg <2, - [(set v4i32:$dst_gpr, (vtx_id2_load ADDRVTX_READ:$src_gpr))] ->; +def : Pat<(i32:$dst_gpr (vtx_id1_az_extloadi8 ADDRVTX_READ:$src_gpr)), + (VTX_READ_8_eg MEMxi:$src_gpr, 1)>; +def : Pat<(i32:$dst_gpr (vtx_id1_az_extloadi16 ADDRVTX_READ:$src_gpr)), + (VTX_READ_16_eg MEMxi:$src_gpr, 1)>; +def : Pat<(i32:$dst_gpr (vtx_id1_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_32_eg MEMxi:$src_gpr, 1)>; +def : Pat<(v2i32:$dst_gpr (vtx_id1_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_64_eg MEMxi:$src_gpr, 1)>; +def : Pat<(v4i32:$dst_gpr (vtx_id1_load ADDRVTX_READ:$src_gpr)), + (VTX_READ_128_eg MEMxi:$src_gpr, 1)>; } // End Predicates = [isEG] diff --git a/lib/Target/AMDGPU/R600InstrFormats.td b/lib/Target/AMDGPU/R600InstrFormats.td index 0ffd485476e..68fcc545916 100644 --- a/lib/Target/AMDGPU/R600InstrFormats.td +++ b/lib/Target/AMDGPU/R600InstrFormats.td @@ -210,14 +210,14 @@ class VTX_WORD0 { bits<5> VC_INST; bits<2> FETCH_TYPE; bits<1> FETCH_WHOLE_QUAD; - bits<8> BUFFER_ID; + bits<8> buffer_id; bits<1> SRC_REL; bits<2> SRC_SEL_X; let Word0{4-0} = VC_INST; let Word0{6-5} = FETCH_TYPE; let Word0{7} = FETCH_WHOLE_QUAD; - let Word0{15-8} = BUFFER_ID; + let Word0{15-8} = buffer_id; let Word0{22-16} = src_gpr; let Word0{23} = SRC_REL; let Word0{25-24} = SRC_SEL_X; diff --git a/lib/Target/AMDGPU/R600Instructions.td b/lib/Target/AMDGPU/R600Instructions.td index b6b576d9527..40424ca7eda 100644 --- a/lib/Target/AMDGPU/R600Instructions.td +++ b/lib/Target/AMDGPU/R600Instructions.td @@ -283,8 +283,8 @@ class EG_CF_RAT cfinst, bits <6> ratinst, bits<4> ratid, bits<4> mask, } -class VTX_READ buffer_id, dag outs, list pattern> - : InstR600ISA , +class VTX_READ pattern> + : InstR600ISA , VTX_WORD1_GPR { // Static fields @@ -333,9 +333,9 @@ class LoadParamFrag : PatFrag < (cast(N)->getAddressSpace() == AMDGPUAS::PARAM_I_ADDRESS); }] >; -def load_param : LoadParamFrag; -def load_param_exti8 : LoadParamFrag; -def load_param_exti16 : LoadParamFrag; +def vtx_id3_az_extloadi8 : LoadParamFrag; +def vtx_id3_az_extloadi16 : LoadParamFrag; +def vtx_id3_load : LoadParamFrag; class LoadVtxId1 : PatFrag < (ops node:$ptr), (load node:$ptr), [{ @@ -1366,8 +1366,8 @@ def CONST_COPY : Instruction { } // end usesCustomInserter = 1, isCodeGenOnly = 1, isPseudo = 1, Namespace = "AMDGPU" def TEX_VTX_CONSTBUF : - InstR600ISA <(outs R600_Reg128:$dst), (ins MEMxi:$ptr, i32imm:$BUFFER_ID), "VTX_READ_eg $dst, $ptr", - [(set v4i32:$dst, (CONST_ADDRESS ADDRGA_VAR_OFFSET:$ptr, (i32 imm:$BUFFER_ID)))]>, + InstR600ISA <(outs R600_Reg128:$dst), (ins MEMxi:$ptr, i32imm:$buffer_id), "VTX_READ_eg $dst, $ptr", + [(set v4i32:$dst, (CONST_ADDRESS ADDRGA_VAR_OFFSET:$ptr, (i32 imm:$buffer_id)))]>, VTX_WORD1_GPR, VTX_WORD0_eg { let VC_INST = 0; @@ -1420,7 +1420,7 @@ def TEX_VTX_CONSTBUF : } def TEX_VTX_TEXBUF: - InstR600ISA <(outs R600_Reg128:$dst), (ins MEMxi:$ptr, i32imm:$BUFFER_ID), "TEX_VTX_EXPLICIT_READ $dst, $ptr">, + InstR600ISA <(outs R600_Reg128:$dst), (ins MEMxi:$ptr, i32imm:$buffer_id), "TEX_VTX_EXPLICIT_READ $dst, $ptr">, VTX_WORD1_GPR, VTX_WORD0_eg { let VC_INST = 0; diff --git a/test/CodeGen/AMDGPU/vertex-fetch-encoding.ll b/test/CodeGen/AMDGPU/vertex-fetch-encoding.ll index fb6a17e6714..3d71062f1fb 100644 --- a/test/CodeGen/AMDGPU/vertex-fetch-encoding.ll +++ b/test/CodeGen/AMDGPU/vertex-fetch-encoding.ll @@ -1,25 +1,46 @@ -; RUN: llc < %s -march=r600 -show-mc-encoding -mcpu=barts | FileCheck --check-prefix=NI %s -; RUN: llc < %s -march=r600 -show-mc-encoding -mcpu=cayman | FileCheck --check-prefix=CM %s +; RUN: llc < %s -march=r600 -show-mc-encoding -mcpu=cypress | FileCheck --check-prefix=EG --check-prefix=FUNC %s +; RUN: llc < %s -march=r600 -show-mc-encoding -mcpu=barts | FileCheck --check-prefix=EG --check-prefix=FUNC %s +; RUN: llc < %s -march=r600 -show-mc-encoding -mcpu=cayman | FileCheck --check-prefix=CM --check-prefix=FUNC %s -; NI: {{^}}vtx_fetch32: -; NI: VTX_READ_32 T[[GPR:[0-9]]].X, T[[GPR]].X, 0 ; encoding: [0x40,0x01,0x0[[GPR]],0x10,0x0[[GPR]],0xf0,0x5f,0x13,0x00,0x00,0x08,0x00 -; CM: {{^}}vtx_fetch32: -; CM: VTX_READ_32 T[[GPR:[0-9]]].X, T[[GPR]].X, 0 ; encoding: [0x40,0x01,0x0[[GPR]],0x00,0x0[[GPR]],0xf0,0x5f,0x13,0x00,0x00,0x00,0x00 +; FUNC-LABEL: {{^}}vtx_fetch32: +; EG: VTX_READ_32 T[[GPR:[0-9]]].X, T[[GPR]].X, 0, #1 ; encoding: [0x40,0x01,0x0[[GPR]],0x10,0x0[[GPR]],0xf0,0x5f,0x13,0x00,0x00,0x08,0x00 +; CM: VTX_READ_32 T[[GPR:[0-9]]].X, T[[GPR]].X, 0, #1 ; encoding: [0x40,0x01,0x0[[GPR]],0x00,0x0[[GPR]],0xf0,0x5f,0x13,0x00,0x00,0x00,0x00 define void @vtx_fetch32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) { -entry: - %0 = load i32, i32 addrspace(1)* %in - store i32 %0, i32 addrspace(1)* %out + %v = load i32, i32 addrspace(1)* %in + store i32 %v, i32 addrspace(1)* %out ret void } -; NI: {{^}}vtx_fetch128: -; NI: VTX_READ_128 T[[DST:[0-9]]].XYZW, T[[SRC:[0-9]]].X, 0 ; encoding: [0x40,0x01,0x0[[SRC]],0x40,0x0[[DST]],0x10,0x8d,0x18,0x00,0x00,0x08,0x00 -; XXX: Add a case for Cayman when v4i32 stores are supported. +; FUNC-LABEL: {{^}}vtx_fetch128: +; EG: VTX_READ_128 T[[DST:[0-9]]].XYZW, T[[SRC:[0-9]]].X, 0, #1 ; encoding: [0x40,0x01,0x0[[SRC]],0x40,0x0[[DST]],0x10,0x8d,0x18,0x00,0x00,0x08,0x00 +; CM: VTX_READ_128 T[[DST:[0-9]]].XYZW, T[[SRC:[0-9]]].X, 0, #1 ; encoding: [0x40,0x01,0x0[[SRC]],0x00,0x0[[DST]],0x10,0x8d,0x18,0x00,0x00,0x00,0x00 define void @vtx_fetch128(<4 x i32> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) { -entry: - %0 = load <4 x i32>, <4 x i32> addrspace(1)* %in - store <4 x i32> %0, <4 x i32> addrspace(1)* %out + %v = load <4 x i32>, <4 x i32> addrspace(1)* %in + store <4 x i32> %v, <4 x i32> addrspace(1)* %out + ret void +} + +; FUNC-LABEL: {{^}}vtx_fetch32_id3: +; EG: VTX_READ_32 T[[GPR:[0-9]]].X, T[[GPR]].X, 0, #3 ; encoding: [0x40,0x03,0x0[[GPR]],0x10,0x0[[GPR]],0xf0,0x5f,0x13,0x00,0x00,0x08,0x00 +; CM: VTX_READ_32 T[[GPR:[0-9]]].X, T[[GPR]].X, 0, #3 ; encoding: [0x40,0x03,0x0[[GPR]],0x00,0x0[[GPR]],0xf0,0x5f,0x13,0x00,0x00,0x00,0x00 + +define void @vtx_fetch32_id3(i32 addrspace(1)* %out, i32 addrspace(7)* %in) { + %v = load i32, i32 addrspace(7)* %in + store i32 %v, i32 addrspace(1)* %out + ret void +} + +; FUNC-LABEL: {{^}}vtx_fetch32_id2: +; EG: VTX_READ_32 T[[GPR:[0-9]]].X, T[[GPR]].X, 0, #2 ; encoding: [0x40,0x02,0x0[[GPR]],0x10,0x0[[GPR]],0xf0,0x5f,0x13,0x00,0x00,0x08,0x00 +; CM: VTX_READ_32 T[[GPR:[0-9]]].X, T[[GPR]].X, 0, #2 ; encoding: [0x40,0x02,0x0[[GPR]],0x00,0x0[[GPR]],0xf0,0x5f,0x13,0x00,0x00,0x00,0x00 + +@t = internal addrspace(2) constant [4 x i32] [i32 0, i32 1, i32 2, i32 3] + +define void @vtx_fetch32_id2(i32 addrspace(1)* %out, i32 %in) { + %a = getelementptr inbounds [4 x i32], [4 x i32] addrspace(2)* @t, i32 0, i32 %in + %v = load i32, i32 addrspace(2)* %a + store i32 %v, i32 addrspace(1)* %out ret void }