diff options
author | Matt Turner <[email protected]> | 2016-11-05 15:49:14 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2017-01-20 11:40:52 -0800 |
commit | ada891d472a32412abacc987cc1963c1438b6548 (patch) | |
tree | 3a1f5608a6bd643f702400f696337ac13cd88d50 | |
parent | fce0612fc2c91cc48f9897a6ac66634aa19ec0f4 (diff) |
i965: Validate math instruction sources.
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_eu_emit.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/test_eu_validate.cpp | 23 |
2 files changed, 23 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 67094670aa1..48833bce9d4 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -1975,8 +1975,6 @@ void gen6_math(struct brw_codegen *p, assert(dest.file == BRW_GENERAL_REGISTER_FILE || (devinfo->gen >= 7 && dest.file == BRW_MESSAGE_REGISTER_FILE)); - assert(src0.file == BRW_GENERAL_REGISTER_FILE || - (devinfo->gen >= 8 && src0.file == BRW_IMMEDIATE_VALUE)); assert(dest.hstride == BRW_HORIZONTAL_STRIDE_1); if (devinfo->gen == 6) { @@ -1994,13 +1992,6 @@ void gen6_math(struct brw_codegen *p, } else { assert(src0.type == BRW_REGISTER_TYPE_F); assert(src1.type == BRW_REGISTER_TYPE_F); - if (function == BRW_MATH_FUNCTION_POW) { - assert(src1.file == BRW_GENERAL_REGISTER_FILE || - (devinfo->gen >= 8 && src1.file == BRW_IMMEDIATE_VALUE)); - } else { - assert(src1.file == BRW_ARCHITECTURE_REGISTER_FILE && - src1.nr == BRW_ARF_NULL); - } } /* Source modifiers are ignored for extended math instructions on Gen6. */ diff --git a/src/mesa/drivers/dri/i965/test_eu_validate.cpp b/src/mesa/drivers/dri/i965/test_eu_validate.cpp index 13e9ba42f08..82761711967 100644 --- a/src/mesa/drivers/dri/i965/test_eu_validate.cpp +++ b/src/mesa/drivers/dri/i965/test_eu_validate.cpp @@ -152,6 +152,29 @@ TEST_P(validation_test, src1_null_reg) EXPECT_FALSE(validate(p)); } +TEST_P(validation_test, math_src0_null_reg) +{ + if (devinfo.gen >= 6) { + gen6_math(p, g0, BRW_MATH_FUNCTION_SIN, null, null); + } else { + gen4_math(p, g0, BRW_MATH_FUNCTION_SIN, 0, null, BRW_MATH_PRECISION_FULL); + } + + EXPECT_FALSE(validate(p)); +} + +TEST_P(validation_test, math_src1_null_reg) +{ + if (devinfo.gen >= 6) { + gen6_math(p, g0, BRW_MATH_FUNCTION_POW, g0, null); + EXPECT_FALSE(validate(p)); + } else { + /* Math instructions on Gen4/5 are actually SEND messages with payloads. + * src1 is an immediate message descriptor set by gen4_math. + */ + } +} + TEST_P(validation_test, opcode46) { /* opcode 46 is "push" on Gen 4 and 5 |