[llvm] r330938 - [RISCV] Implement isLegalICmpImmediate

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 26 06:15:17 PDT 2018


Author: asb
Date: Thu Apr 26 06:15:17 2018
New Revision: 330938

URL: http://llvm.org/viewvc/llvm-project?rev=330938&view=rev
Log:
[RISCV] Implement isLegalICmpImmediate

I'm unable to construct a representative test case that demonstrates the 
advantage, but it seems sensible to report accurate target-specific 
information regardless.

Modified:
    llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
    llvm/trunk/lib/Target/RISCV/RISCVISelLowering.h

Modified: llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp?rev=330938&r1=330937&r2=330938&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp Thu Apr 26 06:15:17 2018
@@ -183,6 +183,10 @@ bool RISCVTargetLowering::isLegalAddress
   return true;
 }
 
+bool RISCVTargetLowering::isLegalICmpImmediate(int64_t Imm) const {
+  return isInt<12>(Imm);
+}
+
 bool RISCVTargetLowering::isLegalAddImmediate(int64_t Imm) const {
   return isInt<12>(Imm);
 }

Modified: llvm/trunk/lib/Target/RISCV/RISCVISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/RISCVISelLowering.h?rev=330938&r1=330937&r2=330938&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVISelLowering.h (original)
+++ llvm/trunk/lib/Target/RISCV/RISCVISelLowering.h Thu Apr 26 06:15:17 2018
@@ -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.




More information about the llvm-commits mailing list