@@ -350,6 +350,12 @@ static std::initializer_list<LLT> AllS32Vectors = {
350350static std::initializer_list<LLT> AllS64Vectors = {V2S64, V3S64, V4S64, V5S64,
351351 V6S64, V7S64, V8S64, V16S64};
352352
353+ static std::initializer_list<LLT> AllVectors{
354+ V2S16, V4S16, V6S16, V8S16, V10S16, V12S16, V16S16, V2S128,
355+ V4S128, V2S32, V3S32, V4S32, V5S32, V6S32, V7S32, V8S32,
356+ V9S32, V10S32, V11S32, V12S32, V16S32, V32S32, V2S64, V3S64,
357+ V4S64, V5S64, V6S64, V7S64, V8S64, V16S64};
358+
353359// Checks whether a type is in the list of legal register types.
354360static bool isRegisterClassType (const GCNSubtarget &ST, LLT Ty) {
355361 if (Ty.isPointerOrPointerVector ())
@@ -2090,7 +2096,6 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
20902096 .clampMaxNumElements (0 , S16, 2 )
20912097 .scalarize (0 );
20922098 } else {
2093- // TODO: Implement
20942099 getActionDefinitionsBuilder ({G_FMINIMUM, G_FMAXIMUM}).lower ();
20952100 }
20962101
@@ -2106,6 +2111,15 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
21062111
21072112 getActionDefinitionsBuilder (G_PREFETCH).alwaysLegal ();
21082113
2114+ getActionDefinitionsBuilder (
2115+ {G_VECREDUCE_SMIN, G_VECREDUCE_SMAX, G_VECREDUCE_UMIN, G_VECREDUCE_UMAX,
2116+ G_VECREDUCE_ADD, G_VECREDUCE_MUL, G_VECREDUCE_FMUL, G_VECREDUCE_FMIN,
2117+ G_VECREDUCE_FMAX, G_VECREDUCE_FMINIMUM, G_VECREDUCE_FMAXIMUM,
2118+ G_VECREDUCE_OR, G_VECREDUCE_AND, G_VECREDUCE_XOR})
2119+ .legalFor (AllVectors)
2120+ .scalarize (1 )
2121+ .lower ();
2122+
21092123 getLegacyLegalizerInfo ().computeTables ();
21102124 verify (*ST.getInstrInfo ());
21112125}
0 commit comments