aco: add and use RegClass::get() helper

Eventually, we'll probably want to replace the current
RegClass(type, size) constructor with this.

This has a functional change in that get_reg_class() now creates v1/v2
instead of v4b/v8b.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4639>
This commit is contained in:
Rhys Perry
2020-04-14 20:32:39 +01:00
committed by Marge Bot
parent 69b92db131
commit b77d638e1b
2 changed files with 12 additions and 14 deletions
@@ -226,21 +226,10 @@ sanitize_cf_list(nir_function_impl *impl, bool *divergent, struct exec_list *cf_
RegClass get_reg_class(isel_context *ctx, RegType type, unsigned components, unsigned bitsize)
{
switch (bitsize) {
case 1:
if (bitsize == 1)
return RegClass(RegType::sgpr, ctx->program->lane_mask.size() * components);
case 8:
return type == RegType::sgpr ? s1 : RegClass(type, components).as_subdword();
case 16:
return type == RegType::sgpr ? RegClass(type, DIV_ROUND_UP(components, 2)) :
RegClass(type, 2 * components).as_subdword();
case 32:
return RegClass(type, components);
case 64:
return RegClass(type, components * 2);
default:
unreachable("Unsupported bit size");
}
else
return RegClass::get(type, components * bitsize / 8u);
}
void init_context(isel_context *ctx, nir_shader *shader)