aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/PTX/PTXInstrInfo.td
diff options
context:
space:
mode:
authorJustin Holewinski <justin.holewinski@gmail.com>2011-03-18 19:24:28 +0000
committerJustin Holewinski <justin.holewinski@gmail.com>2011-03-18 19:24:28 +0000
commit8af78c9cf879487303538cd203b8cf5781b772ec (patch)
tree0f70816ff6ccd2bc1f38387971a7b5be4e10261b /lib/Target/PTX/PTXInstrInfo.td
parent35fdeb7b373e416ff00c54abef12e786963af725 (diff)
downloadexternal_llvm-8af78c9cf879487303538cd203b8cf5781b772ec.zip
external_llvm-8af78c9cf879487303538cd203b8cf5781b772ec.tar.gz
external_llvm-8af78c9cf879487303538cd203b8cf5781b772ec.tar.bz2
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) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127895 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PTX/PTXInstrInfo.td')
-rw-r--r--lib/Target/PTX/PTXInstrInfo.td11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Target/PTX/PTXInstrInfo.td b/lib/Target/PTX/PTXInstrInfo.td
index 42671b6..95768ac 100644
--- a/lib/Target/PTX/PTXInstrInfo.td
+++ b/lib/Target/PTX/PTXInstrInfo.td
@@ -175,6 +175,8 @@ def PTXexit
: 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 @@ def FDIVri64SM10 : InstPTX<(outs RRegf64:$d),
// 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 @@ let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
[(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>;