diff --git a/src/intel/compiler/brw_eu_emit.c b/src/intel/compiler/brw_eu_emit.c index 2108cf6b8d7..ad276e60e60 100644 --- a/src/intel/compiler/brw_eu_emit.c +++ b/src/intel/compiler/brw_eu_emit.c @@ -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)); diff --git a/src/intel/compiler/brw_eu_validate.c b/src/intel/compiler/brw_eu_validate.c index 0e4ab19bf5c..68d41e3e661 100644 --- a/src/intel/compiler/brw_eu_validate.c +++ b/src/intel/compiler/brw_eu_validate.c @@ -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: * diff --git a/src/intel/compiler/brw_shader.cpp b/src/intel/compiler/brw_shader.cpp index 792b0572493..e0b2b167060 100644 --- a/src/intel/compiler/brw_shader.cpp +++ b/src/intel/compiler/brw_shader.cpp @@ -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;