Mesa (master): nir/opcodes: Fix constant-folding of bitfield_insert
Alex Smith
aejsmith at kemper.freedesktop.org
Thu Dec 7 09:03:07 UTC 2017
Module: Mesa
Branch: master
Commit: 947470d10ba5ab11a75f0e19e124b189ff3fd8b2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=947470d10ba5ab11a75f0e19e124b189ff3fd8b2
Author: James Legg <jlegg at feralinteractive.com>
Date: Wed Dec 6 11:55:14 2017 +0000
nir/opcodes: Fix constant-folding of bitfield_insert
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104119
CC: <mesa-stable at lists.freedesktop.org>
CC: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
---
src/compiler/nir/nir_opcodes.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index ac7333fe78..278562b2bd 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -724,12 +724,12 @@ opcode("bitfield_insert", 0, tuint32, [0, 0, 0, 0],
unsigned base = src0, insert = src1;
int offset = src2, bits = src3;
if (bits == 0) {
- dst = 0;
+ dst = base;
} else if (offset < 0 || bits < 0 || bits + offset > 32) {
dst = 0;
} else {
unsigned mask = ((1ull << bits) - 1) << offset;
- dst = (base & ~mask) | ((insert << bits) & mask);
+ dst = (base & ~mask) | ((insert << offset) & mask);
}
""")
More information about the mesa-commit
mailing list