On Tue, Jun 3, 2014 at 4:58 PM, Tobias Klausmann <tobias.johannes.klausm...@mni.thm.de> wrote: > V2: Handle the instruction right (shift after reverse) > > Signed-off-by: Tobias Klausmann <tobias.johannes.klausm...@mni.thm.de> > --- > src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 16 > ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > index 58092f4..a214ffc 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > @@ -529,8 +529,20 @@ ConstantFolding::expr(Instruction *i, > lshift = 32 - width - offset; > } > 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: > + if (i->subOp == NV50_IR_SUBOP_EXTBF_REV) > + res.data.s32 = util_bitreverse(a->data.s32); > + else > + res.data.s32 = a->data.s32;
Why not do this once outside of the switch statement? The two are actually the same -- util_bitreverse doesn't care about signed/unsigned, and res.data is a union. > + res.data.s32 = (res.data.s32 << lshift) >> rshift; > + break; > + case TYPE_U32: > + if (i->subOp == NV50_IR_SUBOP_EXTBF_REV) > + res.data.u32 = util_bitreverse(a->data.u32); > + else > + res.data.u32 = a->data.u32; > + res.data.u32 = (res.data.u32 << lshift) >> rshift; > + break; > default: > return; > } > -- > 1.8.4.5 > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev