Issue |
138259
|
Summary |
[X86] X86LegalizerInfo - use LegalFor instead if LegalIf for simple ISA/test pairs
|
Labels |
good first issue,
backend:X86,
llvm:globalisel
|
Assignees |
|
Reporter |
RKSimon
|
We have lots of arg/result common type cases like:
```cpp
getActionDefinitionsBuilder({G_ADD, G_SUB})
.legalIf([=](const LegalityQuery &Query) -> bool {
if (typeInSet(0, {s8, s16, s32})(Query))
return true;
if (Is64Bit && typeInSet(0, {s64})(Query))
return true;
if (HasSSE2 && typeInSet(0, {v16s8, v8s16, v4s32, v2s64})(Query))
return true;
if (HasAVX2 && typeInSet(0, {v32s8, v16s16, v8s32, v4s64})(Query))
return true;
if (HasAVX512 && typeInSet(0, {v16s32, v8s64})(Query))
return true;
if (HasBWI && typeInSet(0, {v64s8, v32s16})(Query))
return true;
return false;
})
```
which should be simplified to use the legalFor({Types}) or legalFor(Pred, {Types}) helpers:
```cpp
getActionDefinitionsBuilder({G_ADD, G_SUB})
.legalFor({s8, s16, s32})
.legalFor(Is64Bit, {s64})
.legalFor(HasSSE2, {v16s8, v8s16, v4s32, v2s64})
--- etc ---
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs