From: Connor Abbott Date: Tue, 4 Aug 2015 21:04:34 +0000 (-0700) Subject: nir: fix constant folding of bfi X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7820b2c071ec974d824c9b6dc3a0dd0ad1b77444;p=mesa.git nir: fix constant folding of bfi Reviewed-by: Edward O'Callaghan --- diff --git a/src/glsl/nir/nir_opcodes.py b/src/glsl/nir/nir_opcodes.py index 3c0f1da94af..729f695cf9c 100644 --- a/src/glsl/nir/nir_opcodes.py +++ b/src/glsl/nir/nir_opcodes.py @@ -563,7 +563,7 @@ opcode("bcsel", 0, tunsigned, [0, 0, 0], [tbool, tunsigned, tunsigned], "", "src0 ? src1 : src2") triop("bfi", tunsigned, """ -unsigned mask = src0, insert = src1 & mask, base = src2; +unsigned mask = src0, insert = src1, base = src2; if (mask == 0) { dst = base; } else { @@ -572,7 +572,7 @@ if (mask == 0) { tmp >>= 1; insert <<= 1; } - dst = (base & ~mask) | insert; + dst = (base & ~mask) | (insert & mask); } """)