summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/MSP430
diff options
context:
space:
mode:
authorjoanlluch <joan.lluch@icloud.com>2019-11-13 09:23:08 +0100
committerjoanlluch <joan.lluch@icloud.com>2019-11-13 09:23:08 +0100
commitd384ad6b636d4a8c55ef53d5316d008a05161b1f (patch)
tree56c7d9eca68d41eb736e9e8342f6dc8042c8fce5 /llvm/lib/Target/MSP430
parenta4b7613a49741e7faa284641b0a9830275371a24 (diff)
downloadbcm5719-llvm-d384ad6b636d4a8c55ef53d5316d008a05161b1f.tar.gz
bcm5719-llvm-d384ad6b636d4a8c55ef53d5316d008a05161b1f.zip
[TargetLowering][DAGCombine][MSP430] Shift Amount Threshold in DAGCombine (4)
Summary: Replaces ``` unsigned getShiftAmountThreshold(EVT VT) ``` by ``` bool shouldAvoidTransformToShift(EVT VT, unsigned amount) ``` thus giving more flexibility for targets to decide whether particular shift amounts must be considered expensive or not. Updates the MSP430 target with a custom implementation. This continues D69116, D69120, D69326 and updates them, so all of them must be committed before this. Existing tests apply, a few more have been added. Reviewers: asl, spatel Reviewed By: spatel Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70042
Diffstat (limited to 'llvm/lib/Target/MSP430')
-rw-r--r--llvm/lib/Target/MSP430/MSP430ISelLowering.cpp7
-rw-r--r--llvm/lib/Target/MSP430/MSP430ISelLowering.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp b/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
index b6a658f30a8..37e6ea24d08 100644
--- a/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
+++ b/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
@@ -358,9 +358,10 @@ SDValue MSP430TargetLowering::LowerOperation(SDValue Op,
}
}
-// Set transforms into shift amounts above 2 as not profitable
-unsigned MSP430TargetLowering::getShiftAmountThreshold(EVT VT) const {
- return 2;
+// Define non profitable transforms into shifts
+bool MSP430TargetLowering::shouldAvoidTransformToShift(EVT VT,
+ unsigned Amount) const {
+ return !(Amount == 8 || Amount == 9 || Amount<=2);
}
// Implemented to verify test case assertions in
diff --git a/llvm/lib/Target/MSP430/MSP430ISelLowering.h b/llvm/lib/Target/MSP430/MSP430ISelLowering.h
index 64ddbbdf6c8..650f9a70406 100644
--- a/llvm/lib/Target/MSP430/MSP430ISelLowering.h
+++ b/llvm/lib/Target/MSP430/MSP430ISelLowering.h
@@ -125,7 +125,7 @@ namespace llvm {
bool isZExtFree(SDValue Val, EVT VT2) const override;
bool isLegalICmpImmediate(int64_t) const override;
- unsigned getShiftAmountThreshold(EVT VT) const override;
+ bool shouldAvoidTransformToShift(EVT VT, unsigned Amount) const override;
MachineBasicBlock *
EmitInstrWithCustomInserter(MachineInstr &MI,
OpenPOWER on IntegriCloud