From: Rhys Perry Date: Tue, 18 Oct 2022 18:52:15 +0000 (+0100) Subject: ac/nir: micro-optimize boolean expression X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=21a319851aa92dfdd012807d8fedc05bb63684f5;p=platform%2Fupstream%2Fmesa.git ac/nir: micro-optimize boolean expression Ignoring SCC spilling, the old version is probably faster because this mixes uniform and divergent booleans. fossil-db (navi21): Totals from 61167 (45.10% of 135636) affected shaders: Instrs: 29961899 -> 29932551 (-0.10%) CodeSize: 157407028 -> 157289636 (-0.07%) Latency: 139671953 -> 139625186 (-0.03%); split: -0.03%, +0.00% InvThroughput: 21221097 -> 21220756 (-0.00%) SClause: 750438 -> 750439 (+0.00%) Copies: 2672846 -> 2582332 (-3.39%) Signed-off-by: Rhys Perry Reviewed-by: Samuel Pitoiset Part-of: --- diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c index 030295c..523a951 100644 --- a/src/amd/common/ac_nir_lower_ngg.c +++ b/src/amd/common/ac_nir_lower_ngg.c @@ -993,7 +993,8 @@ compact_vertices_after_culling(nir_builder *b, nir_pop_if(b, if_gs_accepted); nir_store_var(b, es_accepted_var, es_survived, 0x1u); - nir_store_var(b, gs_accepted_var, nir_bcsel(b, fully_culled, nir_imm_false(b), nir_has_input_primitive_amd(b)), 0x1u); + nir_store_var(b, gs_accepted_var, + nir_iand(b, nir_inot(b, fully_culled), nir_has_input_primitive_amd(b)), 0x1u); } static void