i965/compute: Fix undefined code with right_mask for SIMD32
authorJordan Justen <jordan.l.justen@intel.com>
Tue, 16 Jun 2015 21:27:15 +0000 (14:27 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 18 Jun 2015 18:24:39 +0000 (11:24 -0700)
Although we don't support SIMD32, krh pointed out that the left shift
by 32 is undefined by C/C++ for 32-bit integers.

Suggested-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_compute.c

index b3d6de51adcc41e7ba0f42d0128a829ee9855cfb..5693ab507d474c788bec3da04850f9477ec503db 100644 (file)
@@ -45,7 +45,7 @@ brw_emit_gpgpu_walker(struct brw_context *brw, const GLuint *num_groups)
    unsigned thread_width_max =
       (group_size + simd_size - 1) / simd_size;
 
-   uint32_t right_mask = (1u << simd_size) - 1;
+   uint32_t right_mask = 0xffffffffu >> (32 - simd_size);
    const unsigned right_non_aligned = group_size & (simd_size - 1);
    if (right_non_aligned != 0)
       right_mask >>= (simd_size - right_non_aligned);