summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2020-06-07 09:52:00 +1000
committerMarge Bot <eric+marge@anholt.net>2020-06-10 22:52:41 +0000
commit7dbb7572e2b5b96a9cc7767c7cbf550180ec78cd (patch)
treeb3c0bbc297f3eef545643bc8da542311e5fa4ca1 /src/gallium/drivers/nouveau
parenta831967c72c57abca347396403fa59d232845282 (diff)
nvir: add constant folding for OP_PERMT
Important for SM70 INSBF/EXTBF lowering, as these can can often be eliminated completely. v2: - skip CF when subOp is set Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5377>
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 669bfbcf548..2d32067729d 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -801,6 +801,15 @@ ConstantFolding::expr(Instruction *i,
res.data.u32 |= !!(i->subOp & (1 << lut)) << n;
}
break;
+ case OP_PERMT:
+ if (!i->subOp) {
+ uint64_t input = (uint64_t)c->data.u32 << 32 | a->data.u32;
+ uint16_t permt = b->data.u32;
+ for (int n = 0 ; n < 4; n++, permt >>= 4)
+ res.data.u32 |= ((input >> ((permt & 0xf) * 8)) & 0xff) << n * 8;
+ } else
+ return;
+ break;
case OP_INSBF: {
int offset = b->data.u32 & 0xff;
int width = (b->data.u32 >> 8) & 0xff;