@@ -158,31 +158,16 @@ template <class BaseT> class RISCVSnippetGenerator : public BaseT {
158158 const MCSubtargetInfo &STI = State.getSubtargetInfo ();
159159 ELEN = STI.hasFeature (RISCV::FeatureStdExtZve64x) ? 64 : 32 ;
160160
161- static_assert (RISCV::FeatureStdExtZvl64b == RISCV::FeatureStdExtZvl32b + 1 );
162- static_assert (RISCV::FeatureStdExtZvl128b ==
163- RISCV::FeatureStdExtZvl32b + 2 );
164- static_assert (RISCV::FeatureStdExtZvl256b ==
165- RISCV::FeatureStdExtZvl32b + 3 );
166- static_assert (RISCV::FeatureStdExtZvl512b ==
167- RISCV::FeatureStdExtZvl32b + 4 );
168- static_assert (RISCV::FeatureStdExtZvl1024b ==
169- RISCV::FeatureStdExtZvl32b + 5 );
170- static_assert (RISCV::FeatureStdExtZvl2048b ==
171- RISCV::FeatureStdExtZvl32b + 6 );
172- static_assert (RISCV::FeatureStdExtZvl4096b ==
173- RISCV::FeatureStdExtZvl32b + 7 );
174- static_assert (RISCV::FeatureStdExtZvl8192b ==
175- RISCV::FeatureStdExtZvl32b + 8 );
176- static_assert (RISCV::FeatureStdExtZvl16384b ==
177- RISCV::FeatureStdExtZvl32b + 9 );
178- static_assert (RISCV::FeatureStdExtZvl32768b ==
179- RISCV::FeatureStdExtZvl32b + 10 );
180- static_assert (RISCV::FeatureStdExtZvl65536b ==
181- RISCV::FeatureStdExtZvl32b + 11 );
182- for (unsigned Feature = RISCV::FeatureStdExtZvl32b, Size = 32 ;
183- Size <= 65536 ; ++Feature, Size *= 2 ) {
161+ const unsigned ZvlFeatures[] = {
162+ RISCV::FeatureStdExtZvl32b, RISCV::FeatureStdExtZvl64b,
163+ RISCV::FeatureStdExtZvl128b, RISCV::FeatureStdExtZvl256b,
164+ RISCV::FeatureStdExtZvl512b, RISCV::FeatureStdExtZvl1024b,
165+ RISCV::FeatureStdExtZvl2048b, RISCV::FeatureStdExtZvl4096b,
166+ RISCV::FeatureStdExtZvl8192b, RISCV::FeatureStdExtZvl16384b,
167+ RISCV::FeatureStdExtZvl32768b, RISCV::FeatureStdExtZvl65536b};
168+ for (auto [Idx, Feature] : enumerate(ZvlFeatures)) {
184169 if (STI.hasFeature (Feature))
185- ZvlVLen = std::max (ZvlVLen, Size );
170+ ZvlVLen = std::max (ZvlVLen, 1u << (Idx + 5 ) );
186171 }
187172 }
188173
0 commit comments