On Tue, Apr 23, 2013 at 2:23 AM, Chris Forbes <chr...@ijw.co.nz> wrote: > + /* Save op0 */ > + ir_variable *temp = new(ir) ir_variable(ir->operands[0]-> > type, "bfi_base", > + ir_var_temporary); > + this->base_ir->insert_before(temp); > + this->base_ir->insert_before(assign(temp, ir->operands[0])); > + > + ir->operation = ir_triop_bfi; > + ir->operands[0] = new(ir) ir_expression(ir_binop_bfm, ir->type, > + swizzle_xxxx(ir->operands[3]), > + swizzle_xxxx(ir->operands[2])); > + /* ir->operands[1] is still the value to insert. */ > + ir->operands[2] = new(ir) ir_dereference_variable(temp); > + ir->operands[3] = NULL; > > Emitting the temp and assignment to it into the IR seems spurious -- > is there a reason something like this doesn't work:? > > ir_rvalue *base_expr = ir->operands[0]; > ir->operation = ir_triop_bfi; > ir->operands[0] = new(ir) ir_expression(ir_binop_bfm, ir-type, > swizzle_xxxx(ir->operands[3]), > swizzle_xxxx(ir->operands[2])); > /* ir->operands[1] is still the value to insert. */ > ir->operands[2] = base_expr; > ir->operands[3] = NULL; > > I might have missed something :) > > -- Chris
Yes, that is much simpler. I'd just copied the lrp_to_arith function to begin with, but it actually has a reason to create a temporary and do the assignment: it uses the temporary multiple times. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev