[Mesa-dev] [PATCH 6/8] nv50/ir: optimize ADD3(d, 0x0, b, c) to ADD(d, b, c)
Samuel Pitoiset
samuel.pitoiset at gmail.com
Thu Jun 30 22:54:08 UTC 2016
- Previous message: [Mesa-dev] [PATCH 6/8] nv50/ir: optimize ADD3(d, 0x0, b, c) to ADD(d, b, c)
- Next message: [Mesa-dev] [PATCH 7/8] nv50/ir: optimize ADD3(d, a, b, c) to ADD(d, c, a + b)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
On 07/01/2016 12:44 AM, Ilia Mirkin wrote:
> If moveSources doesn't move modifiers, we have a serious problem.
> However it looks like it does:
>
> void
> Instruction::setSrc(int s, const ValueRef& ref)
> {
> setSrc(s, ref.get());
> srcs[s].mod = ref.mod;
> }
>
> which is what moveSources calls.
I was not sure about moveSources() because we have two variants and the
other one doesn't move the modifiers.
>
>
> On Thu, Jun 30, 2016 at 6:26 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> And ADD3(d, a, 0x0, c) to ADD(d, a, c) as well.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>> src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 12 +++++++++++-
>> 1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> index 1cf1fa3..517f779 100644
>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
>> @@ -1032,7 +1032,17 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
>> i->src(0).mod = Modifier(0);
>> }
>> break;
>> -
>> + case OP_ADD3:
>> + if (i->usesFlags())
>> + break;
>
> Why? ADD can produce/consume a flag just fine.
Well, this is loosely based on OP_ADD which does exactly the same check.
>
>> + if (imm0.isInteger(0)) {
>> + i->op = OP_ADD;
>> + for (int k = s; k < 2; k++) {
>> + i->setSrc(k, i->getSrc(k + 1));
>> + i->src(k).mod = i->src(k + 1).mod;
>> + }
>
> aka
>
> i->moveSources(s + 1, -1) ?
Yes.
>
>> + }
>> + break;
>> case OP_DIV:
>> if (s != 1 || (i->dType != TYPE_S32 && i->dType != TYPE_U32))
>> break;
>> --
>> 2.8.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
- Previous message: [Mesa-dev] [PATCH 6/8] nv50/ir: optimize ADD3(d, 0x0, b, c) to ADD(d, b, c)
- Next message: [Mesa-dev] [PATCH 7/8] nv50/ir: optimize ADD3(d, a, b, c) to ADD(d, c, a + b)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the mesa-dev
mailing list