nvc0/ir: Handle reverse subop for OP_EXTBF when folding constant expressions
authorTobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Tue, 3 Jun 2014 22:35:48 +0000 (00:35 +0200)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 6 Jun 2014 04:00:26 +0000 (00:00 -0400)
Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

index 58092f4658c1eb312cf54132013830fad2d88f1a..5254617d2382ae61768cd4160eb879abae8a79c9 100644 (file)
@@ -528,9 +528,13 @@ ConstantFolding::expr(Instruction *i,
          rshift = 32 - width;
          lshift = 32 - width - offset;
       }
+      if (i->subOp == NV50_IR_SUBOP_EXTBF_REV)
+         res.data.u32 = util_bitreverse(a->data.u32);
+      else
+         res.data.u32 = a->data.u32;
       switch (i->dType) {
-      case TYPE_S32: res.data.s32 = (a->data.s32 << lshift) >> rshift; break;
-      case TYPE_U32: res.data.u32 = (a->data.u32 << lshift) >> rshift; break;
+      case TYPE_S32: res.data.s32 = (res.data.s32 << lshift) >> rshift; break;
+      case TYPE_U32: res.data.u32 = (res.data.u32 << lshift) >> rshift; break;
       default:
          return;
       }