forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit fe6935a
[X86] X86LegalizerInfo - use LegalFor instead if LegalIf for simple ISA/test pairs (llvm#144675)
We have lots of `legalIf to` evaluate the legality of instructions based
on predicate's truthfulness, which should be simplified to use the
`legalFor({Types})` or `legalFor(Pred, {Types})` helpers:
closes llvm#138259
for eg:
```
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;
})
```
gets transformed to:
```
getActionDefinitionsBuilder({G_ADD, G_SUB})
.legalFor({s8, s16, s32})
.legalFor(Is64Bit, {s64})
.legalFor(HasSSE2, {v16s8, v8s16, v4s32, v2s64})
--- etc ---
```
---------
Co-authored-by: Simon Pilgrim <[email protected]>1 parent 44ddaa0 commit fe6935aCopy full SHA for fe6935a
File tree
Expand file treeCollapse file tree
1 file changed
+113
-176
lines changedFilter options
- llvm/lib/Target/X86/GISel
Expand file treeCollapse file tree
1 file changed
+113
-176
lines changed
0 commit comments