diff options
| author | Akira Hatanaka <ahatanaka@mips.com> | 2011-12-19 20:21:18 +0000 |
|---|---|---|
| committer | Akira Hatanaka <ahatanaka@mips.com> | 2011-12-19 20:21:18 +0000 |
| commit | db47e0c49d420f666e4dbad777f8be6472abd600 (patch) | |
| tree | 0e8283b4d4871f841cfa4204044946ec2c453899 /llvm/lib/Target | |
| parent | 4efffd9ae5aa7bd00edb8f19f4cc895bd5213f5b (diff) | |
| download | bcm5719-llvm-db47e0c49d420f666e4dbad777f8be6472abd600.tar.gz bcm5719-llvm-db47e0c49d420f666e4dbad777f8be6472abd600.zip | |
Add patterns for matching immediates whose lower 16-bit is cleared. These
patterns emit a single LUi instruction instead of a pair of LUi and ORi.
llvm-svn: 146900
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/Mips/Mips64InstrInfo.td | 2 | ||||
| -rw-r--r-- | llvm/lib/Target/Mips/MipsInstrInfo.td | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/Mips64InstrInfo.td b/llvm/lib/Target/Mips/Mips64InstrInfo.td index b3fbbae8605..2eea4cfb11b 100644 --- a/llvm/lib/Target/Mips/Mips64InstrInfo.td +++ b/llvm/lib/Target/Mips/Mips64InstrInfo.td @@ -225,6 +225,8 @@ def : Pat<(i64 immSExt16:$in), (DADDiu ZERO_64, imm:$in)>; def : Pat<(i64 immZExt16:$in), (ORi64 ZERO_64, imm:$in)>; +def : Pat<(i64 immLUiOpnd:$in), + (LUi64 (HI16 imm:$in))>; // 32-bit immediates def : Pat<(i64 immSExt32:$imm), diff --git a/llvm/lib/Target/Mips/MipsInstrInfo.td b/llvm/lib/Target/Mips/MipsInstrInfo.td index bcaa8c30b87..52609433e83 100644 --- a/llvm/lib/Target/Mips/MipsInstrInfo.td +++ b/llvm/lib/Target/Mips/MipsInstrInfo.td @@ -219,6 +219,12 @@ def immZExt16 : PatLeaf<(imm), [{ return (uint64_t)N->getZExtValue() == (unsigned short)N->getZExtValue(); }], LO16>; +// Immediate can be loaded with LUi (32-bit int with lower 16-bit cleared). +def immLUiOpnd : PatLeaf<(imm), [{ + int64_t Val = N->getSExtValue(); + return isInt<32>(Val) && !(Val & 0xffff); +}]>; + // shamt field must fit in 5 bits. def immZExt5 : ImmLeaf<i32, [{return Imm == (Imm & 0x1f);}]>; @@ -933,6 +939,8 @@ def : Pat<(i32 immSExt16:$in), (ADDiu ZERO, imm:$in)>; def : Pat<(i32 immZExt16:$in), (ORi ZERO, imm:$in)>; +def : Pat<(i32 immLUiOpnd:$in), + (LUi (HI16 imm:$in))>; // Arbitrary immediates def : Pat<(i32 imm:$imm), |

