This patch updates TargetLoweringBase::computeRegisterProperties and
TargetLoweringBase::getTypeConversion to support scalable vectors,
and make the right calls on how to legalise them. These changes are required
to legalise both MVTs and EVTs.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| llvm/include/llvm/CodeGen/TargetLowering.h | ||
|---|---|---|
| 189 | getTypeAction() and getTypeToTransformTo() are public; the unittest can use those APIs. | |
| llvm/lib/CodeGen/TargetLoweringBase.cpp | ||
| 942 | report_fatal_error, and please move this up to just after the NumElts.isOne() check. (The EltVT.isInteger() code also assumes the element count can be divided by two.) | |
| 1350 | We probably want a new LegalizeTypeAction kind to represent this. I guess just leaving it TypeLegal isn't too terrible for now, though. | |
| llvm/include/llvm/Support/TypeSize.h | ||
|---|---|---|
| 54 | Alternatively here we could have a more powerful isEqual() where we pass an unsigned integer of the same type in ElementCount, then you can simply do: if (EC.isEqual(1)) { ... } The function would look like bool isEqual(const unsigned RHS) const {
return Min == RHS && !Scalable;
}If you don't want to do that in this patch that's fine, but it might be more generic? | |
| llvm/lib/CodeGen/TargetLoweringBase.cpp | ||
| 826 | Instead of calling EVT::getVectorVT, could we just call SVT.getHalfNumVectorElementsVT() instead? It does the same thing. | |
- Use public interfaces in tests (getTypeAction and getTypeToTransformTo)
- Changed llvm_unreachable -> report_fatal_error
- Added operator==(unsigned RHS) to ElementCount in favour of isOne()
| llvm/lib/CodeGen/TargetLoweringBase.cpp | ||
|---|---|---|
| 1350 | Something like TypeCannotBeLegalized? | |
| llvm/lib/CodeGen/TargetLoweringBase.cpp | ||
|---|---|---|
| 1350 | I was thinking something more like "TypeScalarizeVScaleVector". It's theoretically possible to legalize... although it's complicated by the fact that we can't easily emit loops in SelectionDAG. | |
@sdesmalen this is causing test failures in my DEBUG build:
Failing Tests (4): LLVM :: CodeGen/AMDGPU/fmax_legacy.f16.ll LLVM :: CodeGen/AMDGPU/fmin_legacy.f16.ll LLVM :: CodeGen/AMDGPU/select-vectors.ll LLVM :: CodeGen/AMDGPU/select.f16.ll
Yes sorry for that. I had already reverted the patch and am looking into it. Cheers for pointing out!
getTypeAction() and getTypeToTransformTo() are public; the unittest can use those APIs.