summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2016-05-27 23:29:10 -0700
committerFrancisco Jerez <[email protected]>2016-05-31 15:57:41 -0700
commit06d8765bc09ecd8ff73fff424c8cfec645cb0ded (patch)
tree2f085e969bdadcfcd8bfafcbb868670b96c89d24 /src
parent303ec22ed6124f7860de3856599ab4f02808b84b (diff)
i965/fs: Fix constant combining for instructions that cannot accept source mods.
This is the case for SNB math instructions so we need to be careful and insert the literal value of the immediate into the table (rather than its absolute value) if the instruction is unable to invert the sign of the constant on the fly. Cc: "12.0" <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
index d7a1456bce0..5bd5343b8b4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
@@ -147,8 +147,6 @@ struct table {
static struct imm *
find_imm(struct table *table, float val)
{
- assert(signbit(val) == 0);
-
for (int i = 0; i < table->len; i++) {
if (table->imm[i].val == val) {
return &table->imm[i];
@@ -220,7 +218,8 @@ fs_visitor::opt_combine_constants()
inst->src[i].type != BRW_REGISTER_TYPE_F)
continue;
- float val = fabsf(inst->src[i].f);
+ float val = !inst->can_do_source_mods(devinfo) ? inst->src[i].f :
+ fabs(inst->src[i].f);
struct imm *imm = find_imm(&table, val);
if (imm) {
@@ -301,7 +300,7 @@ fs_visitor::opt_combine_constants()
reg->stride = 0;
reg->negate = signbit(reg->f) != signbit(table.imm[i].val);
assert((isnan(reg->f) && isnan(table.imm[i].val)) ||
- fabsf(reg->f) == table.imm[i].val);
+ fabsf(reg->f) == fabs(table.imm[i].val));
}
}