[Mesa-dev] [PATCH v2 7/8] nv50/ir: optimize ADD3(d, a, b, c) to ADD(d, c, a + b)
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Jul 19 10:30:21 UTC 2016
- Previous message: [Mesa-dev] [PATCH v2 6/8] nv50/ir: optimize ADD3(d, 0x0, b, c) to ADD(d, b, c)
- Next message: [Mesa-dev] [PATCH v2 8/8] nv50/ir: optimize ADD3(d, a, b, c) to ADD(d, a, b + c)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
This is similar to what we already do for MAD/FMA.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 11 ++++++++++-
1 file changed, 10 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 57c8ea8..1175328 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -571,6 +571,14 @@ ConstantFolding::expr(Instruction *i,
return;
}
break;
+ case OP_ADD3:
+ switch (i->dType) {
+ case TYPE_S32:
+ case TYPE_U32: res.data.u32 = a->data.u32 + b->data.u32; break;
+ default:
+ return;
+ }
+ break;
case OP_POW:
switch (i->dType) {
case TYPE_F32: res.data.f32 = pow(a->data.f32, b->data.f32); break;
@@ -687,7 +695,8 @@ ConstantFolding::expr(Instruction *i,
switch (i->op) {
case OP_MAD:
- case OP_FMA: {
+ case OP_FMA:
+ case OP_ADD3: {
ImmediateValue src0, src1 = *i->getSrc(0)->asImm();
// Move the immediate into position 1, where we know it might be
--
2.9.0
- Previous message: [Mesa-dev] [PATCH v2 6/8] nv50/ir: optimize ADD3(d, 0x0, b, c) to ADD(d, b, c)
- Next message: [Mesa-dev] [PATCH v2 8/8] nv50/ir: optimize ADD3(d, a, b, c) to ADD(d, a, b + c)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the mesa-dev
mailing list