intel/compiler: INT DIV function does not support source modifiers

BSpec says that for all generations.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5281
CC: mesa-stable

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12518>
This commit is contained in:
Marcin Ślusarz
2021-08-24 10:50:42 +02:00
committed by Marge Bot
parent 346eb08a3d
commit e0533ebf16
3 changed files with 32 additions and 0 deletions

View File

@@ -2104,6 +2104,13 @@ void gfx6_math(struct brw_codegen *p,
assert(src1.type != BRW_REGISTER_TYPE_F);
assert(src1.file == BRW_GENERAL_REGISTER_FILE ||
(devinfo->ver >= 8 && src1.file == BRW_IMMEDIATE_VALUE));
/* From BSpec 6647/47428 "[Instruction] Extended Math Function":
* INT DIV function does not support source modifiers.
*/
assert(!src0.negate);
assert(!src0.abs);
assert(!src1.negate);
assert(!src1.abs);
} else {
assert(src0.type == BRW_REGISTER_TYPE_F ||
(src0.type == BRW_REGISTER_TYPE_HF && devinfo->ver >= 9));

View File

@@ -2025,6 +2025,29 @@ instruction_restrictions(const struct intel_device_info *devinfo,
}
}
if (brw_inst_opcode(devinfo, inst) == BRW_OPCODE_MATH) {
unsigned math_function = brw_inst_math_function(devinfo, inst);
switch (math_function) {
case BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER:
case BRW_MATH_FUNCTION_INT_DIV_QUOTIENT:
case BRW_MATH_FUNCTION_INT_DIV_REMAINDER: {
/* Page 442 of the Broadwell PRM Volume 2a "Extended Math Function" says:
* INT DIV function does not support source modifiers.
* Bspec 6647 extends it back to Ivy Bridge.
*/
bool src0_valid = !brw_inst_src0_negate(devinfo, inst) &&
!brw_inst_src0_abs(devinfo, inst);
bool src1_valid = !brw_inst_src1_negate(devinfo, inst) &&
!brw_inst_src1_abs(devinfo, inst);
ERROR_IF(!src0_valid || !src1_valid,
"INT DIV function does not support source modifiers.");
break;
}
default:
break;
}
}
if (brw_inst_opcode(devinfo, inst) == BRW_OPCODE_DP4A) {
/* Page 396 (page 412 of the PDF) of the DG1 PRM volume 2a says:
*

View File

@@ -974,6 +974,8 @@ backend_instruction::can_do_source_mods() const
case SHADER_OPCODE_CLUSTER_BROADCAST:
case SHADER_OPCODE_MOV_INDIRECT:
case SHADER_OPCODE_SHUFFLE:
case SHADER_OPCODE_INT_QUOTIENT:
case SHADER_OPCODE_INT_REMAINDER:
return false;
default:
return true;