Index: lib/Target/AMDGPU/CaymanInstructions.td =================================================================== --- lib/Target/AMDGPU/CaymanInstructions.td +++ lib/Target/AMDGPU/CaymanInstructions.td @@ -85,14 +85,15 @@ 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; +// this is set by tablegen magic +// 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 +106,9 @@ 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 +117,9 @@ 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 +128,9 @@ } -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 +148,9 @@ 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 +159,9 @@ 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 +178,44 @@ //===----------------------------------------------------------------------===// // 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 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 : 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_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 Index: lib/Target/AMDGPU/EvergreenInstructions.td =================================================================== --- lib/Target/AMDGPU/EvergreenInstructions.td +++ lib/Target/AMDGPU/EvergreenInstructions.td @@ -134,14 +134,15 @@ } // 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; +// this is set by tablegen magic +// 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. @@ -150,9 +151,9 @@ 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; @@ -162,9 +163,9 @@ 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 @@ -174,9 +175,9 @@ } -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; @@ -195,9 +196,9 @@ 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; @@ -207,9 +208,9 @@ 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; @@ -227,80 +228,44 @@ //===----------------------------------------------------------------------===// // 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] Index: lib/Target/AMDGPU/R600Instructions.td =================================================================== --- lib/Target/AMDGPU/R600Instructions.td +++ lib/Target/AMDGPU/R600Instructions.td @@ -283,8 +283,8 @@ } -class VTX_READ buffer_id, dag outs, list pattern> - : InstR600ISA , +class VTX_READ pattern> + : InstR600ISA , VTX_WORD1_GPR { // Static fields @@ -333,9 +333,9 @@ (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), [{ Index: test/CodeGen/AMDGPU/vertex-fetch-encoding.ll =================================================================== --- test/CodeGen/AMDGPU/vertex-fetch-encoding.ll +++ 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 }