gallium/u_simple_shaders: Optimize out ffloors
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 29 Jul 2023 22:49:41 +0000 (18:49 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 1 Aug 2023 14:04:08 +0000 (14:04 +0000)
commit18b2daa1362b738e0c8ad06f2de9535ab79d5d84
tree5b6b294694223a224b47414254265215cb330e37
parentff9423b69331b010d4cddfae22af52d1dbbc09a8
gallium/u_simple_shaders: Optimize out ffloors

ffloor(f2i(x)) can't be optimized to f2i(x) due to differing behaviour for
negative x, but u_blitter only uses this with nonnegative x so we can instead
use ftrunc(f2i(x)) which NIR will optimize to f2i(x) for us. This gets rid of
the silly ffloor instructions in blit shaders.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24319>
src/gallium/auxiliary/util/u_simple_shaders.c