diff options
| author | Alex Bradbury <asb@lowrisc.org> | 2018-04-26 13:00:37 +0000 |
|---|---|---|
| committer | Alex Bradbury <asb@lowrisc.org> | 2018-04-26 13:00:37 +0000 |
| commit | 5c41ecedf8cc249f80c1550860bf5b561200c6aa (patch) | |
| tree | a6f04d97d15c4817a3f17c0d4badffc3b788561c /llvm/lib/Target/RISCV | |
| parent | c2f78f80dac8af43b7c96e31ae184bace299dd29 (diff) | |
| download | bcm5719-llvm-5c41ecedf8cc249f80c1550860bf5b561200c6aa.tar.gz bcm5719-llvm-5c41ecedf8cc249f80c1550860bf5b561200c6aa.zip | |
[RISCV] Implement isLegalAddImmediate
This causes a trivial improvement in the recently added lsr-legaladdimm.ll
test case.
llvm-svn: 330937
Diffstat (limited to 'llvm/lib/Target/RISCV')
| -rw-r--r-- | llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Target/RISCV/RISCVISelLowering.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index b00f6605bdc..7c1d01845b4 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -183,6 +183,10 @@ bool RISCVTargetLowering::isLegalAddressingMode(const DataLayout &DL, return true; } +bool RISCVTargetLowering::isLegalAddImmediate(int64_t Imm) const { + return isInt<12>(Imm); +} + // Changes the condition code and swaps operands if necessary, so the SetCC // operation matches one of the comparisons supported directly in the RISC-V // ISA. diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.h b/llvm/lib/Target/RISCV/RISCVISelLowering.h index c411784e9d8..7e4a1347127 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.h +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.h @@ -42,6 +42,7 @@ public: bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I = nullptr) const override; + bool isLegalAddImmediate(int64_t Imm) const override; // Provide custom lowering hooks for some operations. SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; |

