aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/PTX
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@gmail.com>2011-01-01 11:58:58 +0000
committerChe-Liang Chiou <clchiou@gmail.com>2011-01-01 11:58:58 +0000
commitc88e91b875fc85ecc3e0d0f51b4a71dca9f29012 (patch)
tree8f610ac9c0344af98445f79aeebd619c2ff7867b /lib/Target/PTX
parentad83c1d3837d2a7786627c08df1208d1cf15a562 (diff)
downloadexternal_llvm-c88e91b875fc85ecc3e0d0f51b4a71dca9f29012.zip
external_llvm-c88e91b875fc85ecc3e0d0f51b4a71dca9f29012.tar.gz
external_llvm-c88e91b875fc85ecc3e0d0f51b4a71dca9f29012.tar.bz2
ptx: remove reg-reg addressing mode and st.const
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122653 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PTX')
-rw-r--r--lib/Target/PTX/PTXISelDAGToDAG.cpp21
-rw-r--r--lib/Target/PTX/PTXInstrInfo.td19
2 files changed, 11 insertions, 29 deletions
diff --git a/lib/Target/PTX/PTXISelDAGToDAG.cpp b/lib/Target/PTX/PTXISelDAGToDAG.cpp
index e09182d..294b62f 100644
--- a/lib/Target/PTX/PTXISelDAGToDAG.cpp
+++ b/lib/Target/PTX/PTXISelDAGToDAG.cpp
@@ -67,8 +67,8 @@ bool PTXDAGToDAGISel::SelectADDRrr(SDValue &Addr, SDValue &R1, SDValue &R2) {
isImm(Addr.getOperand(0)) || isImm(Addr.getOperand(1)))
return false;
- R1 = Addr.getOperand(0);
- R2 = Addr.getOperand(1);
+ R1 = Addr;
+ R2 = CurDAG->getTargetConstant(0, MVT::i32);
return true;
}
@@ -76,17 +76,20 @@ bool PTXDAGToDAGISel::SelectADDRrr(SDValue &Addr, SDValue &R1, SDValue &R2) {
bool PTXDAGToDAGISel::SelectADDRri(SDValue &Addr, SDValue &Base,
SDValue &Offset) {
if (Addr.getOpcode() != ISD::ADD) {
+ // let SelectADDRii handle the [imm] case
if (isImm(Addr))
return false;
- // is [reg] but not [imm]
+ // it is [reg]
Base = Addr;
Offset = CurDAG->getTargetConstant(0, MVT::i32);
return true;
}
+ if (Addr.getNumOperands() < 2)
+ return false;
+
// let SelectADDRii handle the [imm+imm] case
- if (Addr.getNumOperands() >= 2 &&
- isImm(Addr.getOperand(0)) && isImm(Addr.getOperand(1)))
+ if (isImm(Addr.getOperand(0)) && isImm(Addr.getOperand(1)))
return false;
// try [reg+imm] and [imm+reg]
@@ -96,13 +99,7 @@ bool PTXDAGToDAGISel::SelectADDRri(SDValue &Addr, SDValue &Base,
return true;
}
- // either [reg+imm] and [imm+reg]
- for (int i = 0; i < 2; i ++)
- if (SelectImm(Addr.getOperand(1-i), Offset)) {
- Base = Addr.getOperand(i);
- return true;
- }
-
+ // neither [reg+imm] nor [imm+reg]
return false;
}
diff --git a/lib/Target/PTX/PTXInstrInfo.td b/lib/Target/PTX/PTXInstrInfo.td
index 13b1d77..8e4b720 100644
--- a/lib/Target/PTX/PTXInstrInfo.td
+++ b/lib/Target/PTX/PTXInstrInfo.td
@@ -76,16 +76,6 @@ def store_global
return false;
}]>;
-def store_constant
- : PatFrag<(ops node:$d, node:$ptr), (store node:$d, node:$ptr), [{
- const Value *Src;
- const PointerType *PT;
- if ((Src = cast<StoreSDNode>(N)->getSrcValue()) &&
- (PT = dyn_cast<PointerType>(Src->getType())))
- return PT->getAddressSpace() == PTX::CONSTANT;
- return false;
-}]>;
-
def store_local
: PatFrag<(ops node:$d, node:$ptr), (store node:$d, node:$ptr), [{
const Value *Src;
@@ -122,10 +112,6 @@ def ADDRri : ComplexPattern<i32, 2, "SelectADDRri", [], []>;
def ADDRii : ComplexPattern<i32, 2, "SelectADDRii", [], []>;
// Address operands
-def MEMrr : Operand<i32> {
- let PrintMethod = "printMemOperand";
- let MIOperandInfo = (ops RRegs32, RRegs32);
-}
def MEMri : Operand<i32> {
let PrintMethod = "printMemOperand";
let MIOperandInfo = (ops RRegs32, i32imm);
@@ -182,7 +168,7 @@ multiclass INT3ntnc<string opcstr, SDNode opnode> {
multiclass PTX_LD<string opstr, RegisterClass RC, PatFrag pat_load> {
def rr : InstPTX<(outs RC:$d),
- (ins MEMrr:$a),
+ (ins MEMri:$a),
!strconcat(opstr, ".%type\t$d, [$a]"),
[(set RC:$d, (pat_load ADDRrr:$a))]>;
def ri : InstPTX<(outs RC:$d),
@@ -197,7 +183,7 @@ multiclass PTX_LD<string opstr, RegisterClass RC, PatFrag pat_load> {
multiclass PTX_ST<string opstr, RegisterClass RC, PatFrag pat_store> {
def rr : InstPTX<(outs),
- (ins RC:$d, MEMrr:$a),
+ (ins RC:$d, MEMri:$a),
!strconcat(opstr, ".%type\t[$a], $d"),
[(pat_store RC:$d, ADDRrr:$a)]>;
def ri : InstPTX<(outs),
@@ -251,7 +237,6 @@ defm LDp : PTX_LD<"ld.param", RRegs32, load_parameter>;
defm LDs : PTX_LD<"ld.shared", RRegs32, load_shared>;
defm STg : PTX_ST<"st.global", RRegs32, store_global>;
-defm STc : PTX_ST<"st.const", RRegs32, store_constant>;
defm STl : PTX_ST<"st.local", RRegs32, store_local>;
defm STp : PTX_ST<"st.param", RRegs32, store_parameter>;
defm STs : PTX_ST<"st.shared", RRegs32, store_shared>;