nir_options->lower_int64_options = int64_options;
nir_options->lower_doubles_options = fp64_options;
- /* Starting with Gfx11, we lower away 8-bit arithmetic */
- nir_options->support_8bit_alu = devinfo->ver < 11;
-
nir_options->unify_interfaces = i < MESA_SHADER_FRAGMENT;
nir_options->force_indirect_unrolling |=
default:
for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
- assert((devinfo->ver == 8 || devinfo->ver == 9) ||
- type_sz(op[i].type) > 1);
+ assert(type_sz(op[i].type) > 1);
}
}
#endif
case nir_op_bitfield_insert:
unreachable("not reached: should have been lowered");
+ /* For all shift operations:
+ *
+ * Gen4 - Gen7: After application of source modifiers, the low 5-bits of
+ * src1 are used an unsigned value for the shift count.
+ *
+ * Gen8: As with earlier platforms, but for Q and UQ types on src0, the low
+ * 6-bit of src1 are used.
+ *
+ * Gen9+: The low bits of src1 matching the size of src0 (e.g., 4-bits for
+ * W or UW src0).
+ *
+ * The implication is that the following instruction will produce a
+ * different result on Gen9+ than on previous platforms:
+ *
+ * shr(8) g4<1>UW g12<8,8,1>UW 0x0010UW
+ *
+ * where Gen9+ will shift by zero, and earlier platforms will shift by 16.
+ *
+ * This does not seem to be the case. Experimentally, it has been
+ * determined that shifts of 16-bit values on Gen8 behave properly. Shifts
+ * of 8-bit values on both Gen8 and Gen9 do not. Gen11+ lowers 8-bit
+ * values, so those platforms were not tested. No features expose access
+ * to 8- or 16-bit types on Gen7 or earlier, so those platforms were not
+ * tested either. See
+ * https://gitlab.freedesktop.org/mesa/crucible/-/merge_requests/76.
+ *
+ * This is part of the reason 8-bit values are lowered to 16-bit on all
+ * platforms.
+ */
case nir_op_ishl:
bld.SHL(result, op[0], op[1]);
break;
assert(!"Should have been lowered by nir_opt_algebraic.");
return 0;
default:
- if (devinfo->ver >= 11) {
- if (nir_op_infos[alu->op].num_inputs >= 2 &&
- alu->dest.dest.ssa.bit_size == 8)
- return 16;
-
- if (nir_alu_instr_is_comparison(alu) &&
- alu->src[0].src.ssa->bit_size == 8)
- return 16;
- }
+ if (nir_op_infos[alu->op].num_inputs >= 2 &&
+ alu->dest.dest.ssa.bit_size == 8)
+ return 16;
+
+ if (nir_alu_instr_is_comparison(alu) &&
+ alu->src[0].src.ssa->bit_size == 8)
+ return 16;
+
return 0;
}
break;
case nir_intrinsic_quad_swap_horizontal:
case nir_intrinsic_quad_swap_vertical:
case nir_intrinsic_quad_swap_diagonal:
- if (intrin->src[0].ssa->bit_size == 8 && devinfo->ver >= 11)
+ if (intrin->src[0].ssa->bit_size == 8)
return 16;
return 0;
case nir_instr_type_phi: {
nir_phi_instr *phi = nir_instr_as_phi(instr);
- if (devinfo->ver >= 11 && phi->dest.ssa.bit_size == 8)
+ if (phi->dest.ssa.bit_size == 8)
return 16;
return 0;
}