diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-05-21 12:31:40 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-21 17:49:14 +0000 |
commit | 72c1e3a66a7ead84e0b895a7bb11d5501238a013 (patch) | |
tree | 53feaae3ca7b573150c6092d94f43370291f5012 /src | |
parent | 3cfe2fc1b19120ada25e4b4cd1134418162f3d9f (diff) |
pan/mdg: Promote imov to fmov on a NIR level
Avoids dedicated MIR promote_fmov pass which is unnecessary.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5151>
Diffstat (limited to 'src')
-rw-r--r-- | src/panfrost/midgard/midgard_compile.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 1d6d4a04fca..ed9452c20c2 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -961,6 +961,14 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr) return; } + /* Promote imov to fmov if it might help inline a constant */ + if (op == midgard_alu_op_imov && nir_src_is_const(instr->src[0].src) + && nir_src_bit_size(instr->src[0].src) == 32 + && nir_is_same_comp_swizzle(instr->src[0].swizzle, + nir_src_num_components(instr->src[0].src))) { + op = midgard_alu_op_fmov; + } + /* Midgard can perform certain modifiers on output of an ALU op */ unsigned outmod = 0; @@ -2632,7 +2640,6 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b mir_foreach_block(ctx, _block) { midgard_block *block = (midgard_block *) _block; inline_alu_constants(ctx, block); - midgard_opt_promote_fmov(ctx, block); embedded_to_inline_constant(ctx, block); } /* MIR-level optimizations */ |