[llvm-commits] [llvm] r127895 - in /llvm/trunk: lib/Target/PTX/PTXAsmPrinter.cpp lib/Target/PTX/PTXISelLowering.cpp lib/Target/PTX/PTXISelLowering.h lib/Target/PTX/PTXInstrInfo.td test/CodeGen/PTX/ld.ll test/CodeGen/PTX/mad.ll test/CodeGen/PTX/st.ll
Justin Holewinski
justin.holewinski at gmail.com
Fri Mar 18 12:24:29 PDT 2011
Author: jholewinski
Date: Fri Mar 18 14:24:28 2011
New Revision: 127895
URL: http://llvm.org/viewvc/llvm-project?rev=127895&view=rev
Log:
PTX: Fix various codegen issues
- Emit mad instead of mad.rn for shader model 1.0
- Emit explicit mov.u32 instructions for reading global variables
- (most PTX instructions cannot take global variable immediates)
Modified:
llvm/trunk/lib/Target/PTX/PTXAsmPrinter.cpp
llvm/trunk/lib/Target/PTX/PTXISelLowering.cpp
llvm/trunk/lib/Target/PTX/PTXISelLowering.h
llvm/trunk/lib/Target/PTX/PTXInstrInfo.td
llvm/trunk/test/CodeGen/PTX/ld.ll
llvm/trunk/test/CodeGen/PTX/mad.ll
llvm/trunk/test/CodeGen/PTX/st.ll
Modified: llvm/trunk/lib/Target/PTX/PTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXAsmPrinter.cpp?rev=127895&r1=127894&r2=127895&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PTX/PTXAsmPrinter.cpp Fri Mar 18 14:24:28 2011
@@ -313,13 +313,23 @@
const ArrayType* arrayTy = dyn_cast<const ArrayType>(elementTy);
elementTy = arrayTy->getElementType();
+ unsigned numElements = arrayTy->getNumElements();
+
+ while (elementTy->isArrayTy()) {
+
+ arrayTy = dyn_cast<const ArrayType>(elementTy);
+ elementTy = arrayTy->getElementType();
+
+ numElements *= arrayTy->getNumElements();
+ }
+
// FIXME: isPrimitiveType() == false for i16?
assert(elementTy->isSingleValueType() &&
"Non-primitive types are not handled");
// Compute the size of the array, in bytes.
uint64_t arraySize = (elementTy->getPrimitiveSizeInBits() >> 3)
- * arrayTy->getNumElements();
+ * numElements;
decl += ".b8 ";
decl += gvsym->getName();
Modified: llvm/trunk/lib/Target/PTX/PTXISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXISelLowering.cpp?rev=127895&r1=127894&r2=127895&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PTX/PTXISelLowering.cpp Fri Mar 18 14:24:28 2011
@@ -64,6 +64,8 @@
switch (Opcode) {
default:
llvm_unreachable("Unknown opcode");
+ case PTXISD::COPY_ADDRESS:
+ return "PTXISD::COPY_ADDRESS";
case PTXISD::READ_PARAM:
return "PTXISD::READ_PARAM";
case PTXISD::EXIT:
@@ -82,7 +84,14 @@
EVT PtrVT = getPointerTy();
DebugLoc dl = Op.getDebugLoc();
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
- return DAG.getTargetGlobalAddress(GV, dl, PtrVT);
+
+ SDValue targetGlobal = DAG.getTargetGlobalAddress(GV, dl, PtrVT);
+ SDValue movInstr = DAG.getNode(PTXISD::COPY_ADDRESS,
+ dl,
+ MVT::i32,
+ targetGlobal);
+
+ return movInstr;
}
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/PTX/PTXISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXISelLowering.h?rev=127895&r1=127894&r2=127895&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXISelLowering.h (original)
+++ llvm/trunk/lib/Target/PTX/PTXISelLowering.h Fri Mar 18 14:24:28 2011
@@ -26,7 +26,8 @@
FIRST_NUMBER = ISD::BUILTIN_OP_END,
READ_PARAM,
EXIT,
- RET
+ RET,
+ COPY_ADDRESS
};
} // namespace PTXISD
Modified: llvm/trunk/lib/Target/PTX/PTXInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXInstrInfo.td?rev=127895&r1=127894&r2=127895&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXInstrInfo.td (original)
+++ llvm/trunk/lib/Target/PTX/PTXInstrInfo.td Fri Mar 18 14:24:28 2011
@@ -175,6 +175,8 @@
: SDNode<"PTXISD::EXIT", SDTNone, [SDNPHasChain]>;
def PTXret
: SDNode<"PTXISD::RET", SDTNone, [SDNPHasChain]>;
+def PTXcopyaddress
+ : SDNode<"PTXISD::COPY_ADDRESS", SDTypeProfile<1, 1, []>, []>;
//===----------------------------------------------------------------------===//
// Instruction Class Templates
@@ -441,7 +443,8 @@
// In the short term, mad is supported on all PTX versions and we use a
// default rounding mode no matter what shader model or PTX version.
// TODO: Allow the rounding mode to be selectable through llc.
-defm FMAD : PTX_FLOAT_4OP<"mad.rn", fmul, fadd>;
+defm FMADSM13 : PTX_FLOAT_4OP<"mad.rn", fmul, fadd>, Requires<[SupportsSM13]>;
+defm FMAD : PTX_FLOAT_4OP<"mad", fmul, fadd>, Requires<[DoesNotSupportSM13]>;
///===- Floating-Point Intrinsic Instructions -----------------------------===//
@@ -533,6 +536,12 @@
[(set RRegf64:$d, fpimm:$a)]>;
}
+let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
+ def MOVaddr
+ : InstPTX<(outs RRegu32:$d), (ins i32imm:$a), "mov.u32\t$d, $a",
+ [(set RRegu32:$d, (PTXcopyaddress tglobaladdr:$a))]>;
+}
+
// Loads
defm LDg : PTX_LD_ALL<"ld.global", load_global>;
defm LDc : PTX_LD_ALL<"ld.const", load_constant>;
Modified: llvm/trunk/test/CodeGen/PTX/ld.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PTX/ld.ll?rev=127895&r1=127894&r2=127895&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PTX/ld.ll (original)
+++ llvm/trunk/test/CodeGen/PTX/ld.ll Fri Mar 18 14:24:28 2011
@@ -198,7 +198,8 @@
define ptx_device i16 @t4_global_u16() {
entry:
-;CHECK: ld.global.u16 rh0, [array_i16];
+;CHECK: mov.u32 r0, array_i16;
+;CHECK-NEXT: ld.global.u16 rh0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i16]* @array_i16, i32 0, i32 0
%x = load i16* %i
@@ -207,7 +208,8 @@
define ptx_device i32 @t4_global_u32() {
entry:
-;CHECK: ld.global.u32 r0, [array_i32];
+;CHECK: mov.u32 r0, array_i32;
+;CHECK-NEXT: ld.global.u32 r0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i32]* @array_i32, i32 0, i32 0
%x = load i32* %i
@@ -216,7 +218,8 @@
define ptx_device i64 @t4_global_u64() {
entry:
-;CHECK: ld.global.u64 rd0, [array_i64];
+;CHECK: mov.u32 r0, array_i64;
+;CHECK-NEXT: ld.global.u64 rd0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i64]* @array_i64, i32 0, i32 0
%x = load i64* %i
@@ -225,7 +228,8 @@
define ptx_device float @t4_global_f32() {
entry:
-;CHECK: ld.global.f32 f0, [array_float];
+;CHECK: mov.u32 r0, array_float;
+;CHECK-NEXT: ld.global.f32 f0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x float]* @array_float, i32 0, i32 0
%x = load float* %i
@@ -234,7 +238,8 @@
define ptx_device double @t4_global_f64() {
entry:
-;CHECK: ld.global.f64 fd0, [array_double];
+;CHECK: mov.u32 r0, array_double;
+;CHECK-NEXT: ld.global.f64 fd0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x double]* @array_double, i32 0, i32 0
%x = load double* %i
@@ -243,7 +248,8 @@
define ptx_device i16 @t4_const_u16() {
entry:
-;CHECK: ld.const.u16 rh0, [array_constant_i16];
+;CHECK: mov.u32 r0, array_constant_i16;
+;CHECK-NEXT: ld.const.u16 rh0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i16] addrspace(1)* @array_constant_i16, i32 0, i32 0
%x = load i16 addrspace(1)* %i
@@ -252,7 +258,8 @@
define ptx_device i32 @t4_const_u32() {
entry:
-;CHECK: ld.const.u32 r0, [array_constant_i32];
+;CHECK: mov.u32 r0, array_constant_i32;
+;CHECK-NEXT: ld.const.u32 r0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i32] addrspace(1)* @array_constant_i32, i32 0, i32 0
%x = load i32 addrspace(1)* %i
@@ -261,7 +268,8 @@
define ptx_device i64 @t4_const_u64() {
entry:
-;CHECK: ld.const.u64 rd0, [array_constant_i64];
+;CHECK: mov.u32 r0, array_constant_i64;
+;CHECK-NEXT: ld.const.u64 rd0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i64] addrspace(1)* @array_constant_i64, i32 0, i32 0
%x = load i64 addrspace(1)* %i
@@ -270,7 +278,8 @@
define ptx_device float @t4_const_f32() {
entry:
-;CHECK: ld.const.f32 f0, [array_constant_float];
+;CHECK: mov.u32 r0, array_constant_float;
+;CHECK-NEXT: ld.const.f32 f0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x float] addrspace(1)* @array_constant_float, i32 0, i32 0
%x = load float addrspace(1)* %i
@@ -279,7 +288,8 @@
define ptx_device double @t4_const_f64() {
entry:
-;CHECK: ld.const.f64 fd0, [array_constant_double];
+;CHECK: mov.u32 r0, array_constant_double;
+;CHECK-NEXT: ld.const.f64 fd0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x double] addrspace(1)* @array_constant_double, i32 0, i32 0
%x = load double addrspace(1)* %i
@@ -288,7 +298,8 @@
define ptx_device i16 @t4_local_u16() {
entry:
-;CHECK: ld.local.u16 rh0, [array_local_i16];
+;CHECK: mov.u32 r0, array_local_i16;
+;CHECK-NEXT: ld.local.u16 rh0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i16] addrspace(2)* @array_local_i16, i32 0, i32 0
%x = load i16 addrspace(2)* %i
@@ -297,7 +308,8 @@
define ptx_device i32 @t4_local_u32() {
entry:
-;CHECK: ld.local.u32 r0, [array_local_i32];
+;CHECK: mov.u32 r0, array_local_i32;
+;CHECK-NEXT: ld.local.u32 r0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i32] addrspace(2)* @array_local_i32, i32 0, i32 0
%x = load i32 addrspace(2)* %i
@@ -306,7 +318,8 @@
define ptx_device i64 @t4_local_u64() {
entry:
-;CHECK: ld.local.u64 rd0, [array_local_i64];
+;CHECK: mov.u32 r0, array_local_i64;
+;CHECK-NEXT: ld.local.u64 rd0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i64] addrspace(2)* @array_local_i64, i32 0, i32 0
%x = load i64 addrspace(2)* %i
@@ -315,7 +328,8 @@
define ptx_device float @t4_local_f32() {
entry:
-;CHECK: ld.local.f32 f0, [array_local_float];
+;CHECK: mov.u32 r0, array_local_float;
+;CHECK-NEXT: ld.local.f32 f0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x float] addrspace(2)* @array_local_float, i32 0, i32 0
%x = load float addrspace(2)* %i
@@ -324,7 +338,8 @@
define ptx_device double @t4_local_f64() {
entry:
-;CHECK: ld.local.f64 fd0, [array_local_double];
+;CHECK: mov.u32 r0, array_local_double;
+;CHECK-NEXT: ld.local.f64 fd0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x double] addrspace(2)* @array_local_double, i32 0, i32 0
%x = load double addrspace(2)* %i
@@ -333,7 +348,8 @@
define ptx_device i16 @t4_shared_u16() {
entry:
-;CHECK: ld.shared.u16 rh0, [array_shared_i16];
+;CHECK: mov.u32 r0, array_shared_i16;
+;CHECK-NEXT: ld.shared.u16 rh0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i16] addrspace(4)* @array_shared_i16, i32 0, i32 0
%x = load i16 addrspace(4)* %i
@@ -342,7 +358,8 @@
define ptx_device i32 @t4_shared_u32() {
entry:
-;CHECK: ld.shared.u32 r0, [array_shared_i32];
+;CHECK: mov.u32 r0, array_shared_i32;
+;CHECK-NEXT: ld.shared.u32 r0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i32] addrspace(4)* @array_shared_i32, i32 0, i32 0
%x = load i32 addrspace(4)* %i
@@ -351,7 +368,8 @@
define ptx_device i64 @t4_shared_u64() {
entry:
-;CHECK: ld.shared.u64 rd0, [array_shared_i64];
+;CHECK: mov.u32 r0, array_shared_i64;
+;CHECK-NEXT: ld.shared.u64 rd0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i64] addrspace(4)* @array_shared_i64, i32 0, i32 0
%x = load i64 addrspace(4)* %i
@@ -360,7 +378,8 @@
define ptx_device float @t4_shared_f32() {
entry:
-;CHECK: ld.shared.f32 f0, [array_shared_float];
+;CHECK: mov.u32 r0, array_shared_float;
+;CHECK-NEXT: ld.shared.f32 f0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x float] addrspace(4)* @array_shared_float, i32 0, i32 0
%x = load float addrspace(4)* %i
@@ -369,7 +388,8 @@
define ptx_device double @t4_shared_f64() {
entry:
-;CHECK: ld.shared.f64 fd0, [array_shared_double];
+;CHECK: mov.u32 r0, array_shared_double;
+;CHECK-NEXT: ld.shared.f64 fd0, [r0];
;CHECK-NEXT: ret;
%i = getelementptr [10 x double] addrspace(4)* @array_shared_double, i32 0, i32 0
%x = load double addrspace(4)* %i
@@ -378,7 +398,8 @@
define ptx_device i16 @t5_u16() {
entry:
-;CHECK: ld.global.u16 rh0, [array_i16+2];
+;CHECK: mov.u32 r0, array_i16;
+;CHECK-NEXT: ld.global.u16 rh0, [r0+2];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i16]* @array_i16, i32 0, i32 1
%x = load i16* %i
@@ -387,7 +408,8 @@
define ptx_device i32 @t5_u32() {
entry:
-;CHECK: ld.global.u32 r0, [array_i32+4];
+;CHECK: mov.u32 r0, array_i32;
+;CHECK-NEXT: ld.global.u32 r0, [r0+4];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i32]* @array_i32, i32 0, i32 1
%x = load i32* %i
@@ -396,7 +418,8 @@
define ptx_device i64 @t5_u64() {
entry:
-;CHECK: ld.global.u64 rd0, [array_i64+8];
+;CHECK: mov.u32 r0, array_i64;
+;CHECK-NEXT: ld.global.u64 rd0, [r0+8];
;CHECK-NEXT: ret;
%i = getelementptr [10 x i64]* @array_i64, i32 0, i32 1
%x = load i64* %i
@@ -405,7 +428,8 @@
define ptx_device float @t5_f32() {
entry:
-;CHECK: ld.global.f32 f0, [array_float+4];
+;CHECK: mov.u32 r0, array_float;
+;CHECK-NEXT: ld.global.f32 f0, [r0+4];
;CHECK-NEXT: ret;
%i = getelementptr [10 x float]* @array_float, i32 0, i32 1
%x = load float* %i
@@ -414,7 +438,8 @@
define ptx_device double @t5_f64() {
entry:
-;CHECK: ld.global.f64 fd0, [array_double+8];
+;CHECK: mov.u32 r0, array_double;
+;CHECK-NEXT: ld.global.f64 fd0, [r0+8];
;CHECK-NEXT: ret;
%i = getelementptr [10 x double]* @array_double, i32 0, i32 1
%x = load double* %i
Modified: llvm/trunk/test/CodeGen/PTX/mad.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PTX/mad.ll?rev=127895&r1=127894&r2=127895&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PTX/mad.ll (original)
+++ llvm/trunk/test/CodeGen/PTX/mad.ll Fri Mar 18 14:24:28 2011
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=ptx | FileCheck %s
+; RUN: llc < %s -march=ptx -mattr=+sm13 | FileCheck %s
define ptx_device float @t1_f32(float %x, float %y, float %z) {
; CHECK: mad.rn.f32 f0, f1, f2, f3;
Modified: llvm/trunk/test/CodeGen/PTX/st.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PTX/st.ll?rev=127895&r1=127894&r2=127895&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PTX/st.ll (original)
+++ llvm/trunk/test/CodeGen/PTX/st.ll Fri Mar 18 14:24:28 2011
@@ -203,7 +203,8 @@
define ptx_device void @t4_global_u16(i16 %x) {
entry:
-;CHECK: st.global.u16 [array_i16], rh1;
+;CHECK: mov.u32 r0, array_i16;
+;CHECK-NEXT: st.global.u16 [r0], rh1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i16]* @array_i16, i16 0, i16 0
store i16 %x, i16* %i
@@ -212,7 +213,8 @@
define ptx_device void @t4_global_u32(i32 %x) {
entry:
-;CHECK: st.global.u32 [array_i32], r1;
+;CHECK: mov.u32 r0, array_i32;
+;CHECK-NEXT: st.global.u32 [r0], r1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i32]* @array_i32, i32 0, i32 0
store i32 %x, i32* %i
@@ -221,7 +223,8 @@
define ptx_device void @t4_global_u64(i64 %x) {
entry:
-;CHECK: st.global.u64 [array_i64], rd1;
+;CHECK: mov.u32 r0, array_i64;
+;CHECK-NEXT: st.global.u64 [r0], rd1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i64]* @array_i64, i32 0, i32 0
store i64 %x, i64* %i
@@ -230,7 +233,8 @@
define ptx_device void @t4_global_f32(float %x) {
entry:
-;CHECK: st.global.f32 [array_float], f1;
+;CHECK: mov.u32 r0, array_float;
+;CHECK-NEXT: st.global.f32 [r0], f1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x float]* @array_float, i32 0, i32 0
store float %x, float* %i
@@ -239,7 +243,8 @@
define ptx_device void @t4_global_f64(double %x) {
entry:
-;CHECK: st.global.f64 [array_double], fd1;
+;CHECK: mov.u32 r0, array_double;
+;CHECK-NEXT: st.global.f64 [r0], fd1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x double]* @array_double, i32 0, i32 0
store double %x, double* %i
@@ -248,7 +253,8 @@
define ptx_device void @t4_local_u16(i16 %x) {
entry:
-;CHECK: st.local.u16 [array_local_i16], rh1;
+;CHECK: mov.u32 r0, array_local_i16;
+;CHECK-NEXT: st.local.u16 [r0], rh1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i16] addrspace(2)* @array_local_i16, i32 0, i32 0
store i16 %x, i16 addrspace(2)* %i
@@ -257,7 +263,8 @@
define ptx_device void @t4_local_u32(i32 %x) {
entry:
-;CHECK: st.local.u32 [array_local_i32], r1;
+;CHECK: mov.u32 r0, array_local_i32;
+;CHECK-NEXT: st.local.u32 [r0], r1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i32] addrspace(2)* @array_local_i32, i32 0, i32 0
store i32 %x, i32 addrspace(2)* %i
@@ -266,7 +273,8 @@
define ptx_device void @t4_local_u64(i64 %x) {
entry:
-;CHECK: st.local.u64 [array_local_i64], rd1;
+;CHECK: mov.u32 r0, array_local_i64;
+;CHECK-NEXT: st.local.u64 [r0], rd1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i64] addrspace(2)* @array_local_i64, i32 0, i32 0
store i64 %x, i64 addrspace(2)* %i
@@ -275,7 +283,8 @@
define ptx_device void @t4_local_f32(float %x) {
entry:
-;CHECK: st.local.f32 [array_local_float], f1;
+;CHECK: mov.u32 r0, array_local_float;
+;CHECK-NEXT: st.local.f32 [r0], f1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x float] addrspace(2)* @array_local_float, i32 0, i32 0
store float %x, float addrspace(2)* %i
@@ -284,7 +293,8 @@
define ptx_device void @t4_local_f64(double %x) {
entry:
-;CHECK: st.local.f64 [array_local_double], fd1;
+;CHECK: mov.u32 r0, array_local_double;
+;CHECK-NEXT: st.local.f64 [r0], fd1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x double] addrspace(2)* @array_local_double, i32 0, i32 0
store double %x, double addrspace(2)* %i
@@ -293,7 +303,8 @@
define ptx_device void @t4_shared_u16(i16 %x) {
entry:
-;CHECK: st.shared.u16 [array_shared_i16], rh1;
+;CHECK: mov.u32 r0, array_shared_i16;
+;CHECK-NEXT: st.shared.u16 [r0], rh1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i16] addrspace(4)* @array_shared_i16, i32 0, i32 0
store i16 %x, i16 addrspace(4)* %i
@@ -302,7 +313,8 @@
define ptx_device void @t4_shared_u32(i32 %x) {
entry:
-;CHECK: st.shared.u32 [array_shared_i32], r1;
+;CHECK: mov.u32 r0, array_shared_i32;
+;CHECK-NEXT: st.shared.u32 [r0], r1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i32] addrspace(4)* @array_shared_i32, i32 0, i32 0
store i32 %x, i32 addrspace(4)* %i
@@ -311,7 +323,8 @@
define ptx_device void @t4_shared_u64(i64 %x) {
entry:
-;CHECK: st.shared.u64 [array_shared_i64], rd1;
+;CHECK: mov.u32 r0, array_shared_i64;
+;CHECK-NEXT: st.shared.u64 [r0], rd1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i64] addrspace(4)* @array_shared_i64, i32 0, i32 0
store i64 %x, i64 addrspace(4)* %i
@@ -320,7 +333,8 @@
define ptx_device void @t4_shared_f32(float %x) {
entry:
-;CHECK: st.shared.f32 [array_shared_float], f1;
+;CHECK: mov.u32 r0, array_shared_float;
+;CHECK-NEXT: st.shared.f32 [r0], f1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x float] addrspace(4)* @array_shared_float, i32 0, i32 0
store float %x, float addrspace(4)* %i
@@ -329,7 +343,8 @@
define ptx_device void @t4_shared_f64(double %x) {
entry:
-;CHECK: st.shared.f64 [array_shared_double], fd1;
+;CHECK: mov.u32 r0, array_shared_double;
+;CHECK-NEXT: st.shared.f64 [r0], fd1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x double] addrspace(4)* @array_shared_double, i32 0, i32 0
store double %x, double addrspace(4)* %i
@@ -338,7 +353,8 @@
define ptx_device void @t5_u16(i16 %x) {
entry:
-;CHECK: st.global.u16 [array_i16+2], rh1;
+;CHECK: mov.u32 r0, array_i16;
+;CHECK-NEXT: st.global.u16 [r0+2], rh1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i16]* @array_i16, i32 0, i32 1
store i16 %x, i16* %i
@@ -347,7 +363,8 @@
define ptx_device void @t5_u32(i32 %x) {
entry:
-;CHECK: st.global.u32 [array_i32+4], r1;
+;CHECK: mov.u32 r0, array_i32;
+;CHECK-NEXT: st.global.u32 [r0+4], r1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i32]* @array_i32, i32 0, i32 1
store i32 %x, i32* %i
@@ -356,7 +373,8 @@
define ptx_device void @t5_u64(i64 %x) {
entry:
-;CHECK: st.global.u64 [array_i64+8], rd1;
+;CHECK: mov.u32 r0, array_i64;
+;CHECK-NEXT: st.global.u64 [r0+8], rd1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x i64]* @array_i64, i32 0, i32 1
store i64 %x, i64* %i
@@ -365,7 +383,8 @@
define ptx_device void @t5_f32(float %x) {
entry:
-;CHECK: st.global.f32 [array_float+4], f1;
+;CHECK: mov.u32 r0, array_float;
+;CHECK-NEXT: st.global.f32 [r0+4], f1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x float]* @array_float, i32 0, i32 1
store float %x, float* %i
@@ -374,7 +393,8 @@
define ptx_device void @t5_f64(double %x) {
entry:
-;CHECK: st.global.f64 [array_double+8], fd1;
+;CHECK: mov.u32 r0, array_double;
+;CHECK-NEXT: st.global.f64 [r0+8], fd1;
;CHECK-NEXT: ret;
%i = getelementptr [10 x double]* @array_double, i32 0, i32 1
store double %x, double* %i
More information about the llvm-commits
mailing list