intel/fs: Fix extract_u8 of an odd byte from a 64-bit integer
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 27 Feb 2019 23:53:55 +0000 (15:53 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 6 Mar 2019 16:35:45 +0000 (08:35 -0800)
commit55e6454d5e9dae6f8f29992af83f99217446da38
treec178267dc4085a3f72c33e7a24cdc0141aa05c54
parent4aaf139ea4cc7c4703e1906e0074f87f76c8e4cc
intel/fs: Fix extract_u8 of an odd byte from a 64-bit integer

In the old code, we would generate the exact same instruction for
extract_u8(some_u64, 0) and extract_u8(some_u64, 1).  The mask-a-word
trick only works for even numbered bytes.

This fixes the (new) piglit test
tests/spec/arb_gpu_shader_int64/execution/fs-ushr-and-mask.shader_test.

v2: Use a SHR instead of an AND.  This saves an instruction compared to
using two moves.  Suggested by Jason.

Fixes: 6ac2d169019 ("i965/fs: Fix extract_i8/u8 to a 64-bit destination")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/compiler/brw_fs_nir.cpp