diff options
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/AMDIL.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/SIISelLowering.cpp | 3 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/SIInstructions.td | 40 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/SIIntrinsics.td | 5 |
4 files changed, 21 insertions, 30 deletions
diff --git a/src/gallium/drivers/radeon/AMDIL.h b/src/gallium/drivers/radeon/AMDIL.h index 45638f64280..8bd024a4bd8 100644 --- a/src/gallium/drivers/radeon/AMDIL.h +++ b/src/gallium/drivers/radeon/AMDIL.h @@ -129,7 +129,8 @@ enum AddressSpaces { ADDRESS_NONE = 5, // Address space for unknown memory. PARAM_D_ADDRESS = 6, // Address space for direct addressible parameter memory (CONST0) PARAM_I_ADDRESS = 7, // Address space for indirect addressible parameter memory (VTX1) - LAST_ADDRESS = 8 + USER_SGPR_ADDRESS = 8, // Address space for USER_SGPRS on SI + LAST_ADDRESS = 9 }; // This union/struct combination is an easy way to read out the diff --git a/src/gallium/drivers/radeon/SIISelLowering.cpp b/src/gallium/drivers/radeon/SIISelLowering.cpp index a79aba9358b..1cdcd36c648 100644 --- a/src/gallium/drivers/radeon/SIISelLowering.cpp +++ b/src/gallium/drivers/radeon/SIISelLowering.cpp @@ -188,6 +188,9 @@ void SITargetLowering::lowerUSE_SGPR(MachineInstr *MI, unsigned dstReg = MI->getOperand(0).getReg(); int64_t newIndex = MI->getOperand(1).getImm(); const TargetRegisterClass * dstClass = MRI.getRegClass(dstReg); + unsigned DwordWidth = dstClass->getSize() / 4; + assert(newIndex % DwordWidth == 0 && "USER_SGPR not properly aligned"); + newIndex = newIndex / DwordWidth; unsigned newReg = dstClass->getRegister(newIndex); addLiveIn(MI, MF, MRI, TII, newReg); diff --git a/src/gallium/drivers/radeon/SIInstructions.td b/src/gallium/drivers/radeon/SIInstructions.td index a77b8bd7c11..fc8ec4a3394 100644 --- a/src/gallium/drivers/radeon/SIInstructions.td +++ b/src/gallium/drivers/radeon/SIInstructions.td @@ -7,6 +7,18 @@ // //===----------------------------------------------------------------------===// +def load_user_sgpr : PatFrag<(ops node:$ptr), + (load node:$ptr), + [{ + const Value *Src = cast<LoadSDNode>(N)->getSrcValue(); + if (Src) { + PointerType * PT = dyn_cast<PointerType>(Src->getType()); + return PT && PT->getAddressSpace() == AMDILAS::USER_SGPR_ADDRESS; + } + return false; + }] +>; + def isSI : Predicate<"Subtarget.device()" "->getGeneration() == AMDILDeviceInfo::HD7XXX">; @@ -826,26 +838,19 @@ def SI_INTERP_CONST : InstSI < imm:$attr, SReg_32:$params))] >; - def USE_SGPR_32 : InstSI < (outs SReg_32:$dst), (ins i32imm:$src0), "USE_SGPR_32", - [(set SReg_32:$dst, (int_SI_use_sgpr imm:$src0))] - -> { - field bits<32> Inst = 0; -} + [(set (i32 SReg_32:$dst), (load_user_sgpr imm:$src0))] +>; def USE_SGPR_64 : InstSI < (outs SReg_64:$dst), (ins i32imm:$src0), "USE_SGPR_64", - [(set SReg_64:$dst, (int_SI_use_sgpr imm:$src0))] - -> { - field bits<32> Inst = 0; -} + [(set (i64 SReg_64:$dst), (load_user_sgpr imm:$src0))] +>; def VS_LOAD_BUFFER_INDEX : InstSI < (outs VReg_32:$dst), @@ -869,19 +874,6 @@ def : Pat< 0, 0, (i32 SREG_LIT_0)) >; -def : Pat< - (int_SI_use_sgprptrcf32 imm:$src0), - (USE_SGPR_64 imm:$src0) ->; -def : Pat< - (int_SI_use_sgprptrci128 imm:$src0), - (USE_SGPR_64 imm:$src0) ->; -def : Pat< - (int_SI_use_sgprptrci256 imm:$src0), - (USE_SGPR_64 imm:$src0) ->; - /* int_SI_export */ def : Pat < (int_SI_export imm:$en, imm:$vm, imm:$done, imm:$tgt, imm:$compr, diff --git a/src/gallium/drivers/radeon/SIIntrinsics.td b/src/gallium/drivers/radeon/SIIntrinsics.td index d8bf4fab3db..95273a2a68f 100644 --- a/src/gallium/drivers/radeon/SIIntrinsics.td +++ b/src/gallium/drivers/radeon/SIIntrinsics.td @@ -21,11 +21,6 @@ let TargetPrefix = "SI", isTarget = 1 in { def int_SI_vs_load_input : Intrinsic <[llvm_v4f32_ty], [llvm_v4i32_ty, llvm_i16_ty, llvm_i32_ty], []> ; def int_SI_sample : Intrinsic <[llvm_v4f32_ty], [llvm_i32_ty, llvm_v4f32_ty, llvm_v8i32_ty, llvm_v4i32_ty]>; - def int_SI_use_sgpr : Intrinsic <[llvm_anyint_ty], [llvm_i32_ty], [IntrNoMem]>; - class int_SI_use_sgprptr : Intrinsic <[llvm_anyptr_ty], [llvm_i32_ty], []>; - def int_SI_use_sgprptrcf32 : int_SI_use_sgprptr; - def int_SI_use_sgprptrci128 : int_SI_use_sgprptr; - def int_SI_use_sgprptrci256 : int_SI_use_sgprptr; /* Interpolation Intrinsics */ |