From: Daniel Schürmann Date: Mon, 13 Apr 2020 12:16:00 +0000 (+0100) Subject: aco: move attempt to find strided register into get_reg_simple() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=97a870cf88a551cca9a1fd0773d183cddc4b2561;p=mesa.git aco: move attempt to find strided register into get_reg_simple() This simplifies code and helps some shaders Totals from affected shaders: Code Size: 51227172 -> 51202216 (-0.05 %) bytes Max Waves: 19955 -> 19948 (-0.04 %) Reviewed-by: Rhys Perry Part-of: --- diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 4eaf9b1742a..0857084a486 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -395,6 +395,14 @@ std::pair get_reg_simple(ra_ctx& ctx, /* best fit algorithm: find the smallest gap to fit in the variable */ if (stride == 1) { + + if (rc.type() == RegType::vgpr && (size == 4 || size == 8)) { + info.stride = 4; + std::pair res = get_reg_simple(ctx, reg_file, info); + if (res.second) + return res; + } + unsigned best_pos = 0xFFFF; unsigned gap_size = 0xFFFF; unsigned next_pos = 0xFFFF; @@ -935,14 +943,7 @@ PhysReg get_reg(ra_ctx& ctx, DefInfo info(ctx, instr, temp.regClass()); /* try to find space without live-range splits */ - std::pair res; - if (info.rc.type() == RegType::vgpr && (info.size == 4 || info.size == 8)) { - DefInfo info_strided = {info.lb, info.ub, info.size, 4, info.rc}; - std::pair res = get_reg_simple(ctx, reg_file, info_strided); - } - if (!res.second) - res = get_reg_simple(ctx, reg_file, info); - + std::pair res = get_reg_simple(ctx, reg_file, info); if (res.second) return res.first;