{
switch (opcode) {
case nir_op_imul:
+ case nir_op_amul:
return nir_lower_imul64;
case nir_op_imul_2x32_64:
case nir_op_umul_2x32_64:
switch (alu->op) {
case nir_op_imul:
+ case nir_op_amul:
return lower_imul64(b, src[0], src[1]);
case nir_op_imul_2x32_64:
return lower_mul_2x32_64(b, src[0], src[1], true);
}
}
+typedef struct {
+ const nir_shader_compiler_options *shader_options;
+ nir_lower_int64_options options;
+} should_lower_cb_data;
+
static bool
-should_lower_int64_alu_instr(const nir_instr *instr, const void *_options)
+should_lower_int64_alu_instr(const nir_instr *instr, const void *_data)
{
- const nir_lower_int64_options options =
- *(const nir_lower_int64_options *)_options;
+ const should_lower_cb_data *cb_data = (const should_lower_cb_data *)_data;
+ const nir_lower_int64_options options = cb_data->options;
if (instr->type != nir_instr_type_alu)
return false;
if (alu->src[0].src.ssa->bit_size != 64)
return false;
break;
+ case nir_op_amul:
+ assert(alu->dest.dest.is_ssa);
+ if (cb_data->shader_options->has_imul24)
+ return false;
+ if (alu->dest.dest.ssa.bit_size != 64)
+ return false;
+ break;
default:
assert(alu->dest.dest.is_ssa);
if (alu->dest.dest.ssa.bit_size != 64)
bool
nir_lower_int64(nir_shader *shader, nir_lower_int64_options options)
{
+ should_lower_cb_data cb_data;
+ cb_data.shader_options = shader->options;
+ cb_data.options = options;
+
return nir_shader_lower_instructions(shader,
should_lower_int64_alu_instr,
lower_int64_alu_instr,
- &options);
+ &cb_data);
}