summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorKristof Beyls <kristof.beyls@arm.com>2017-06-30 08:26:20 +0000
committerKristof Beyls <kristof.beyls@arm.com>2017-06-30 08:26:20 +0000
commitb539ea5393215100720a2269b4cd5523593cd90a (patch)
tree34443783986fb4580399d3fb56d9a0647a3dbe0e /llvm/lib/CodeGen
parentcb75f61c1df33836942731bc2006d5fcfe366f4e (diff)
downloadbcm5719-llvm-b539ea5393215100720a2269b4cd5523593cd90a.tar.gz
bcm5719-llvm-b539ea5393215100720a2269b4cd5523593cd90a.zip
[GlobalISel] Make multi-step legalization work.
In r301116, a custom lowering needed to be introduced to be able to legalize 8 and 16-bit divisions on ARM targets without a division instruction, since 2-step legalization (WidenScalar from 8 bit to 32 bit, then Libcall the 32-bit division) doesn't work. This fixes this and makes this kind of multi-step legalization, where first the size of the type needs to be changed and then some action is needed that doesn't require changing the size of the type, straighforward to specify. Differential Revision: https://reviews.llvm.org/D32529 llvm-svn: 306806
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
index b8b820341a2..7e957590ede 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
@@ -178,19 +178,23 @@ Optional<LLT> LegalizerInfo::findLegalType(const InstrAspect &Aspect,
case Libcall:
case Custom:
return Aspect.Type;
- case NarrowScalar:
- return findLegalType(Aspect,
- [](LLT Ty) -> LLT { return Ty.halfScalarSize(); });
- case WidenScalar:
- return findLegalType(Aspect, [](LLT Ty) -> LLT {
+ case NarrowScalar: {
+ return findLegalizableSize(
+ Aspect, [&](LLT Ty) -> LLT { return Ty.halfScalarSize(); });
+ }
+ case WidenScalar: {
+ return findLegalizableSize(Aspect, [&](LLT Ty) -> LLT {
return Ty.getSizeInBits() < 8 ? LLT::scalar(8) : Ty.doubleScalarSize();
});
- case FewerElements:
- return findLegalType(Aspect,
- [](LLT Ty) -> LLT { return Ty.halfElements(); });
- case MoreElements:
- return findLegalType(Aspect,
- [](LLT Ty) -> LLT { return Ty.doubleElements(); });
+ }
+ case FewerElements: {
+ return findLegalizableSize(
+ Aspect, [&](LLT Ty) -> LLT { return Ty.halfElements(); });
+ }
+ case MoreElements: {
+ return findLegalizableSize(
+ Aspect, [&](LLT Ty) -> LLT { return Ty.doubleElements(); });
+ }
}
}
OpenPOWER on IntegriCloud