nir: fix constant folding of bfi
authorConnor Abbott <connor.w.abbott@intel.com>
Tue, 4 Aug 2015 21:04:34 +0000 (14:04 -0700)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 19 Nov 2015 08:16:18 +0000 (09:16 +0100)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
src/glsl/nir/nir_opcodes.py

index 3c0f1da94af057fc331bc88685b58afe191ddfb9..729f695cf9c5e844a42753bc114cc1cc64b67ed1 100644 (file)
@@ -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);
 }
 """)