[mips] Define reg+imm load/store pattern templates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178407 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Akira Hatanaka 2013-03-30 02:01:48 +00:00
parent 2c2c33a167
commit 175f0fd99a
2 changed files with 18 additions and 16 deletions

View File

@ -503,32 +503,27 @@ let Predicates = [IsFP64bit, HasStdEnc] in {
def : MipsPat<(f64 (fextend FGR32:$src)), (CVT_D64_S FGR32:$src)>;
}
// Load/Store patterns.
// Patterns for loads/stores with a reg+imm operand.
let AddedComplexity = 40 in {
let Predicates = [IsN64, HasStdEnc] in {
def : MipsPat<(f32 (load addrRegImm:$a)), (LWC1_P8 addrRegImm:$a)>;
def : MipsPat<(store FGR32:$v, addrRegImm:$a),
(SWC1_P8 FGR32:$v, addrRegImm:$a)>;
def : MipsPat<(f64 (load addrRegImm:$a)), (LDC164_P8 addrRegImm:$a)>;
def : MipsPat<(store FGR64:$v, addrRegImm:$a),
(SDC164_P8 FGR64:$v, addrRegImm:$a)>;
def : LoadRegImmPat<LWC1_P8, f32, load>;
def : StoreRegImmPat<SWC1_P8, f32>;
def : LoadRegImmPat<LDC164_P8, f64, load>;
def : StoreRegImmPat<SDC164_P8, f64>;
}
let Predicates = [NotN64, HasStdEnc] in {
def : MipsPat<(f32 (load addrRegImm:$a)), (LWC1 addrRegImm:$a)>;
def : MipsPat<(store FGR32:$v, addrRegImm:$a),
(SWC1 FGR32:$v, addrRegImm:$a)>;
def : LoadRegImmPat<LWC1, f32, load>;
def : StoreRegImmPat<SWC1, f32>;
}
let Predicates = [NotN64, HasMips64, HasStdEnc] in {
def : MipsPat<(f64 (load addrRegImm:$a)), (LDC164 addrRegImm:$a)>;
def : MipsPat<(store FGR64:$v, addrRegImm:$a),
(SDC164 FGR64:$v, addrRegImm:$a)>;
def : LoadRegImmPat<LDC164, f64, load>;
def : StoreRegImmPat<SDC164, f64>;
}
let Predicates = [NotN64, NotMips64, HasStdEnc] in {
def : MipsPat<(f64 (load addrRegImm:$a)), (LDC1 addrRegImm:$a)>;
def : MipsPat<(store AFGR64:$v, addrRegImm:$a),
(SDC1 AFGR64:$v, addrRegImm:$a)>;
def : LoadRegImmPat<LDC1, f64, load>;
def : StoreRegImmPat<SDC1, f64>;
}
}

View File

@ -1102,6 +1102,13 @@ def LoadAddr32Imm : LoadAddressImm<"la", shamt,CPURegsOpnd>;
// Arbitrary patterns that map to one or more instructions
//===----------------------------------------------------------------------===//
// Load/store pattern templates.
class LoadRegImmPat<Instruction LoadInst, ValueType ValTy, PatFrag Node> :
MipsPat<(ValTy (Node addrRegImm:$a)), (LoadInst addrRegImm:$a)>;
class StoreRegImmPat<Instruction StoreInst, ValueType ValTy> :
MipsPat<(store ValTy:$v, addrRegImm:$a), (StoreInst ValTy:$v, addrRegImm:$a)>;
// Small immediates
def : MipsPat<(i32 immSExt16:$in),
(ADDiu ZERO, imm:$in)>;