{
bool is_int = midgard_is_integer_op(v.op);
bool is_full = v.reg_mode == midgard_reg_mode_32;
+ bool is_inline_constant = ins->ssa_args.inline_constant;
/* The output component is from the mask */
midgard_scalar_alu s = {
.op = v.op,
.src1 = vector_to_scalar_source(v.src1, is_int, is_full),
- .src2 = vector_to_scalar_source(v.src2, is_int, is_full),
+ .src2 = !is_inline_constant ? vector_to_scalar_source(v.src2, is_int, is_full) : 0,
.unknown = 0,
.outmod = v.outmod,
.output_full = is_full,
int op = ains->alu.op;
int units = alu_opcode_props[op].props;
- bool vectorable = units & UNITS_ANY_VECTOR;
bool scalarable = units & UNITS_SCALAR;
bool could_scalar = is_single_component_mask(ains->mask);
could_scalar &= ains->alu.reg_mode != midgard_reg_mode_64;
could_scalar &= ains->alu.dest_override == midgard_dest_override_none;
- bool vector = vectorable && !(could_scalar && scalarable);
+ if (ains->alu.reg_mode == midgard_reg_mode_16) {
+ /* If we're running in 16-bit mode, we
+ * can't have any 8-bit sources on the
+ * scalar unit (since the scalar unit
+ * doesn't understand 8-bit) */
+
+ midgard_vector_alu_src s1 =
+ vector_alu_from_unsigned(ains->alu.src1);
+
+ could_scalar &= !s1.half;
+
+ if (!ains->ssa_args.inline_constant) {
+ midgard_vector_alu_src s2 =
+ vector_alu_from_unsigned(ains->alu.src2);
+
+ could_scalar &= !s2.half;
+ }
+
+ }
+
+ bool scalar = could_scalar && scalarable;
/* TODO: Check ahead-of-time for other scalar
* hazards that otherwise get aborted out */
- if (!vector)
+ if (scalar)
assert(units & UNITS_SCALAR);
- if (vector) {
+ if (!scalar) {
if (last_unit >= UNIT_VADD) {
if (units & UNIT_VLUT)
unit = UNIT_VLUT;