r600/shader: only emit add instruction if param has a value.
authorDave Airlie <airlied@redhat.com>
Wed, 10 Jan 2018 02:56:15 +0000 (02:56 +0000)
committerDave Airlie <airlied@redhat.com>
Thu, 18 Jan 2018 03:34:43 +0000 (03:34 +0000)
Just saves a pointless a = a + 0;

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/r600_shader.c

index 623e6f7f70473a6ce0e83926b55ea8159a6e07c1..cfc3400f925c7811a5c03a8049a6770ea5b5ccfa 100644 (file)
@@ -2864,12 +2864,14 @@ static int r600_tess_factor_read(struct r600_shader_ctx *ctx,
        if (r)
                return r;
 
-       r = single_alu_op2(ctx, ALU_OP2_ADD_INT,
-                          temp_reg, 0,
-                          temp_reg, 0,
-                          V_SQ_ALU_SRC_LITERAL, param * 16);
-       if (r)
-               return r;
+       if (param) {
+               r = single_alu_op2(ctx, ALU_OP2_ADD_INT,
+                                  temp_reg, 0,
+                                  temp_reg, 0,
+                                  V_SQ_ALU_SRC_LITERAL, param * 16);
+               if (r)
+                       return r;
+       }
 
        do_lds_fetch_values(ctx, temp_reg, dreg, ((1u << nc) - 1));
        return 0;