nir: add nir_lower_amul pass

Lower amul to either imul or imul24, depending on whether 24b is enough
bits to calculate an offset within the thing being dereferenced.

Signed-off-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
Rob Clark
2019-09-27 10:15:02 -07:00
parent 1bdde31392
commit 5e08f070f0
7 changed files with 335 additions and 3 deletions

View File

@@ -2757,6 +2757,14 @@ typedef struct nir_shader_compiler_options {
/* Lowers when rotate instruction is not supported */
bool lower_rotate;
/**
* Backend supports imul24, and would like to use it (when possible)
* for address/offset calculation. If true, driver should call
* nir_lower_amul(). (If not set, amul will automatically be lowered
* to imul.)
*/
bool has_imul24;
/**
* Is this the Intel vec4 backend?
*
@@ -3540,6 +3548,8 @@ void nir_compact_varyings(nir_shader *producer, nir_shader *consumer,
void nir_link_xfb_varyings(nir_shader *producer, nir_shader *consumer);
bool nir_link_opt_varyings(nir_shader *producer, nir_shader *consumer);
bool nir_lower_amul(nir_shader *shader,
int (*type_size)(const struct glsl_type *, bool));
void nir_assign_io_var_locations(struct exec_list *var_list,
unsigned *size,