[RISCV] Implement isLegalICmpImmediate
authorAlex Bradbury <asb@lowrisc.org>
Thu, 26 Apr 2018 13:15:17 +0000 (13:15 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Thu, 26 Apr 2018 13:15:17 +0000 (13:15 +0000)
I'm unable to construct a representative test case that demonstrates the
advantage, but it seems sensible to report accurate target-specific
information regardless.

llvm-svn: 330938

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h

index 7c1d018..16b4bdd 100644 (file)
@@ -183,6 +183,10 @@ bool RISCVTargetLowering::isLegalAddressingMode(const DataLayout &DL,
   return true;
 }
 
+bool RISCVTargetLowering::isLegalICmpImmediate(int64_t Imm) const {
+  return isInt<12>(Imm);
+}
+
 bool RISCVTargetLowering::isLegalAddImmediate(int64_t Imm) const {
   return isInt<12>(Imm);
 }
index 7e4a134..dccd031 100644 (file)
@@ -42,6 +42,7 @@ public:
   bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,
                              unsigned AS,
                              Instruction *I = nullptr) const override;
+  bool isLegalICmpImmediate(int64_t Imm) const override;
   bool isLegalAddImmediate(int64_t Imm) const override;
 
   // Provide custom lowering hooks for some operations.