mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
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" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 06d8765bc0)
This commit is contained in:
parent
f651a4bb2e
commit
c1269825cf
1 changed files with 3 additions and 4 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue