Skip to content

Commit bc6faf9

Browse files
dipeshs809RKSimon
andauthored
[X86] X86LegalizerInfo - use LegalFor instead if LegalIf for simple ISA/test pairs (#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 #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 be00098 commit bc6faf9

File tree

1 file changed

+113
-176
lines changed

1 file changed

+113
-176
lines changed

0 commit comments

Comments
 (0)