glsl: Drop the div-to-mul-rcp lowering for floats.

NIR has fdiv, and all the NIR backends have to have lower_fdiv set
appropriately already since various passes (format conversions,
tgsi_to_nir, nir_fast_normalize(), etc.) might generate one.

This causes softpipe and llvmpipe to now do actual divides, since
lower_fdiv is not set there.  Note that llvmpipe's rcp implementation is a
divide of 1.0 by x, so now we're going to be just doing div(x, y) instead
of mul(x, div(1.0, y)).

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823>
This commit is contained in:
Emma Anholt
2022-05-31 13:48:17 -07:00
committed by Marge Bot
parent 594d3982f7
commit 464b32c030
9 changed files with 37 additions and 76 deletions

View File

@@ -35,7 +35,6 @@ struct gl_shader_program;
/* Operations for lower_instructions() */
#define SUB_TO_ADD_NEG 0x01
#define FDIV_TO_MUL_RCP 0x02
#define INT_DIV_TO_MUL_RCP 0x40
#define LDEXP_TO_ARITH 0x80
#define CARRY_TO_ARITH 0x100
@@ -49,8 +48,6 @@ struct gl_shader_program;
#define FIND_LSB_TO_FLOAT_CAST 0x20000
#define FIND_MSB_TO_FLOAT_CAST 0x40000
#define IMUL_HIGH_TO_MUL 0x80000
#define DDIV_TO_MUL_RCP 0x100000
#define DIV_TO_MUL_RCP (FDIV_TO_MUL_RCP | DDIV_TO_MUL_RCP)
#define SQRT_TO_ABS_SQRT 0x200000
/* Operations for lower_64bit_integer_instructions() */