diff --git a/lib/Target/X86/X86InstrAVX512.td b/lib/Target/X86/X86InstrAVX512.td index 40292f5dac1..c7126296c30 100644 --- a/lib/Target/X86/X86InstrAVX512.td +++ b/lib/Target/X86/X86InstrAVX512.td @@ -115,6 +115,46 @@ def avx512vl_i32_info : AVX512VLVectorVTInfo; +// This multiclass generates the masking variants from the non-masking +// variant. It only provides the assembly pieces for the masking variants. +// It assumes custom ISel patterns for masking which can be provided as +// template arguments. +multiclass AVX512_masking_custom O, Format F, + dag Outs, + dag Ins, dag MaskingIns, dag ZeroMaskingIns, + string OpcodeStr, + string AttSrcAsm, string IntelSrcAsm, + list Pattern, + list MaskingPattern, + list ZeroMaskingPattern, + string MaskingConstraint = "", + InstrItinClass itin = NoItinerary, + bit IsCommutable = 0> { + let isCommutable = IsCommutable in + def NAME: AVX512; + + // Prefer over VMOV*rrk Pat<> + let AddedComplexity = 20 in + def NAME#k: AVX512, + EVEX_K { + // In case of the 3src subclass this is overridden with a let. + string Constraints = MaskingConstraint; + } + let AddedComplexity = 30 in // Prefer over VMOV*rrkz Pat<> + def NAME#kz: AVX512, + EVEX_KZ; +} + // Common base class of AVX512_masking and AVX512_masking_3src. multiclass AVX512_masking_common O, Format F, X86VectorVTInfo _, @@ -125,34 +165,16 @@ multiclass AVX512_masking_common O, Format F, X86VectorVTInfo _, dag RHS, dag MaskingRHS, string MaskingConstraint = "", InstrItinClass itin = NoItinerary, - bit IsCommutable = 0> { - let isCommutable = IsCommutable in - def NAME: AVX512; - - // Prefer over VMOV*rrk Pat<> - let AddedComplexity = 20 in - def NAME#k: AVX512, - EVEX_K { - // In case of the 3src subclass this is overridden with a let. - string Constraints = MaskingConstraint; - } - let AddedComplexity = 30 in // Prefer over VMOV*rrkz Pat<> - def NAME#kz: AVX512, - EVEX_KZ; -} + bit IsCommutable = 0> : + AVX512_masking_custom; // This multiclass generates the unconditional/non-masking, the masking and // the zero-masking variant of the instruction. In the masking case, the