[Mesa-dev] [PATCH] i965/fs: Don't emit unnecessary SEL instruction from emit_image_atomic().

Francisco Jerez currojerez at riseup.net
Sun Feb 7 02:57:28 UTC 2016


The SEL instruction with predication mode NONE emitted when the atomic
operation doesn't need to be predicated is a no-op and might rely on
undocumented hardware behaviour.  Noticed by chance while looking at
the assembly output.
---
 src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
index 534d849..164e0d7 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
@@ -1121,7 +1121,7 @@ namespace brw {
                                               dims, rsize, op, pred);
 
          /* An unbound surface access should give zero as result. */
-         if (rsize)
+         if (rsize && pred)
             set_predicate(pred, bld.SEL(tmp, tmp, fs_reg(0)));
 
          return tmp;
-- 
2.7.0



More information about the mesa-dev mailing list