i965/fs: Consider type mismatches in saturate propagation.
authorMatt Turner <mattst88@gmail.com>
Wed, 14 Oct 2015 09:23:25 +0000 (02:23 -0700)
committerMatt Turner <mattst88@gmail.com>
Mon, 19 Oct 2015 17:19:32 +0000 (10:19 -0700)
commit35a2d259f27f5b41f29a1112ca48093dac09c364
treec73a4009a7abb6cdea670f26a996fdb31cb22352
parent9e17c36b8ba79e688011a5fd293ad5f42da21b66
i965/fs: Consider type mismatches in saturate propagation.

NIR considers bcsel to produce and consume unsigned types, leading to
SEL instructions operating on unsigned types when the data is really
floating-point. Previous to this patch, saturate propagation would
happily transform

   (+f0) sel      g20:UD, g30:UD, g40:UD
         mov.sat  g50:F,  g20:F

into

   (+f0) sel.sat  g20:UD, g30:UD, g40:UD
         mov      g50:F,  g20:F

But since the meaning of .sat is dependent on the type of the
destination register, this is not valid.

Instead, allow saturate propagation to change the types of dest/source
on instructions that are simply copying data in order to propagate the
saturate modifier.

Fixes bad code gen in 158 programs.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp