From 63cf273f5597f9e6cc9c3604acab5a00298a794b Mon Sep 17 00:00:00 2001 From: Yonghong Song Date: Fri, 23 Feb 2018 23:49:26 +0000 Subject: bpf: Support i32 in getScalarShiftAmountTy method getScalarShiftAmount method should be implemented for eBPF backend to make sure shift amount could still get correct type once 32-bit subregisters support are enabled. Signed-off-by: Jiong Wang Reviewed-by: Yonghong Song llvm-svn: 325986 --- llvm/lib/Target/BPF/BPFISelLowering.cpp | 5 +++++ llvm/lib/Target/BPF/BPFISelLowering.h | 2 ++ 2 files changed, 7 insertions(+) (limited to 'llvm') diff --git a/llvm/lib/Target/BPF/BPFISelLowering.cpp b/llvm/lib/Target/BPF/BPFISelLowering.cpp index 194996989e5..0d604e099c3 100644 --- a/llvm/lib/Target/BPF/BPFISelLowering.cpp +++ b/llvm/lib/Target/BPF/BPFISelLowering.cpp @@ -713,3 +713,8 @@ EVT BPFTargetLowering::getSetCCResultType(const DataLayout &, LLVMContext &, EVT VT) const { return getHasAlu32() ? MVT::i32 : MVT::i64; } + +MVT BPFTargetLowering::getScalarShiftAmountTy(const DataLayout &DL, + EVT VT) const { + return (getHasAlu32() && VT == MVT::i32) ? MVT::i32 : MVT::i64; +} diff --git a/llvm/lib/Target/BPF/BPFISelLowering.h b/llvm/lib/Target/BPF/BPFISelLowering.h index badc0b82c16..3eb099cf369 100644 --- a/llvm/lib/Target/BPF/BPFISelLowering.h +++ b/llvm/lib/Target/BPF/BPFISelLowering.h @@ -60,6 +60,8 @@ public: EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override; + MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override; + private: // Control Instruction Selection Features bool HasAlu32; -- cgit v1.2.3