[Mesa-dev] [PATCH 12/19] i965/fs: Pass fs_regs by constant reference where possible.
Matt Turner
mattst88 at gmail.com
Sat Feb 22 12:37:27 PST 2014
On Sat, Feb 22, 2014 at 9:22 AM, Pohjolainen, Topi
<topi.pohjolainen at intel.com> wrote:
> On Thu, Feb 20, 2014 at 01:41:25PM -0800, Matt Turner wrote:
>> void
>> -fs_visitor::emit_lrp(fs_reg dst, fs_reg x, fs_reg y, fs_reg a)
>> +fs_visitor::emit_lrp(const fs_reg &dst, const fs_reg &x, const fs_reg &y,
>> + const fs_reg &a)
>> {
>> if (brw->gen < 6 ||
>> !x.is_valid_3src() ||
>> @@ -225,8 +226,9 @@ fs_visitor::emit_lrp(fs_reg dst, fs_reg x, fs_reg y, fs_reg a)
>>
>> emit(MUL(y_times_a, y, a));
>>
>> - a.negate = !a.negate;
>> - emit(ADD(one_minus_a, a, fs_reg(1.0f)));
>> + fs_reg negative_a = a;
>> + negative_a.negate = !a.negate;
>> + emit(ADD(one_minus_a, negative_a, fs_reg(1.0f)));
>
> If you left the type of 'a' intact this change wouldn't be needed. But I don't
> have preference whether letting the compiler to emit the copy or doing it
> manually here.
Right, thanks for the comments. I did it this way so that in the case
we can emit a LRP instruction, we didn't have to make a copy. We have
to make one for this branch regardless, but it helps the other case.
More information about the mesa-dev
mailing list