@@ -350,6 +350,12 @@ static std::initializer_list<LLT> AllS32Vectors = {
350
350
static std::initializer_list<LLT> AllS64Vectors = {V2S64, V3S64, V4S64, V5S64,
351
351
V6S64, V7S64, V8S64, V16S64};
352
352
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
+
353
359
// Checks whether a type is in the list of legal register types.
354
360
static bool isRegisterClassType (const GCNSubtarget &ST, LLT Ty) {
355
361
if (Ty.isPointerOrPointerVector ())
@@ -2090,7 +2096,6 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
2090
2096
.clampMaxNumElements (0 , S16, 2 )
2091
2097
.scalarize (0 );
2092
2098
} else {
2093
- // TODO: Implement
2094
2099
getActionDefinitionsBuilder ({G_FMINIMUM, G_FMAXIMUM}).lower ();
2095
2100
}
2096
2101
@@ -2106,6 +2111,15 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
2106
2111
2107
2112
getActionDefinitionsBuilder (G_PREFETCH).alwaysLegal ();
2108
2113
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
+
2109
2123
getLegacyLegalizerInfo ().computeTables ();
2110
2124
verify (*ST.getInstrInfo ());
2111
2125
}
0 commit comments