i965: Implement b2f and b2i using negation

Graphics / Mesa 3D Graphics Library / Mesa - Francisco Jerez [riseup.net] - 16 July 2015 10:29 UTC

Booleans are represented as 0/-1 on modern hardware which means we can just negate them to convert them into a numeric type. Negation has the benefit that it can be implemented using a source modifier which can easily be propagated into some other instruction. shader-db results on HSW:

total instructions in shared programs: 6349082 -> 6346693 (-0.04%) instructions in affected programs: 40948 -> 38559 (-5.83%) helped: 123 HURT: 1 GAINED: 1 LOST: 0

3ee2daf i965: Implement b2f and b2i using negation.
src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 4 +---
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 7 +------
2 files changed, 2 insertions(+), 9 deletions(-)

Upstream: cgit.freedesktop.org


  • Share