mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
brw: Move ADD related validation
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38877>
This commit is contained in:
parent
6ae92d3372
commit
68190499df
3 changed files with 20 additions and 22 deletions
|
|
@ -920,28 +920,7 @@ ALU3(ADD3)
|
|||
ALU1(MOV)
|
||||
ALU2(MUL)
|
||||
ALU2(AVG)
|
||||
|
||||
brw_eu_inst *
|
||||
brw_ADD(struct brw_codegen *p, struct brw_reg dest,
|
||||
struct brw_reg src0, struct brw_reg src1)
|
||||
{
|
||||
/* 6.2.2: add */
|
||||
if (src0.type == BRW_TYPE_F ||
|
||||
(src0.file == IMM &&
|
||||
src0.type == BRW_TYPE_VF)) {
|
||||
assert(src1.type != BRW_TYPE_UD);
|
||||
assert(src1.type != BRW_TYPE_D);
|
||||
}
|
||||
|
||||
if (src1.type == BRW_TYPE_F ||
|
||||
(src1.file == IMM &&
|
||||
src1.type == BRW_TYPE_VF)) {
|
||||
assert(src0.type != BRW_TYPE_UD);
|
||||
assert(src0.type != BRW_TYPE_D);
|
||||
}
|
||||
|
||||
return brw_alu2(p, BRW_OPCODE_ADD, dest, src0, src1);
|
||||
}
|
||||
ALU2(ADD)
|
||||
|
||||
brw_eu_inst *
|
||||
brw_LINE(struct brw_codegen *p, struct brw_reg dest,
|
||||
|
|
|
|||
|
|
@ -2269,6 +2269,12 @@ instruction_restrictions(const struct brw_isa_info *isa,
|
|||
brw_type_size_bytes(inst->src[1].type) > 4,
|
||||
"AVG does not support 64-bit types.");
|
||||
}
|
||||
|
||||
if (inst->opcode == BRW_OPCODE_ADD) {
|
||||
ERROR_IF(brw_type_is_int(inst->src[0].type) !=
|
||||
brw_type_is_int(inst->src[1].type),
|
||||
"ADD can't mix float and non-float sources.");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -3969,3 +3969,16 @@ TEST_P(validation_test, mul_dont_accept_int_accumulator_src)
|
|||
EXPECT_FALSE(validate(p));
|
||||
clear_instructions(p);
|
||||
}
|
||||
|
||||
TEST_P(validation_test, add_dont_mix_integer_and_float_sources)
|
||||
{
|
||||
brw_reg a = brw_ud8_grf(10, 0);
|
||||
brw_reg b = brw_ud8_grf(20, 0);
|
||||
brw_reg c = brw_ud8_grf(30, 0);
|
||||
|
||||
brw_ADD(p, retype(a, BRW_TYPE_F),
|
||||
retype(b, BRW_TYPE_F),
|
||||
retype(c, BRW_TYPE_UD));
|
||||
EXPECT_FALSE(validate(p));
|
||||
clear_instructions(p);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue