[Mesa-dev] [PATCH 11/14] R600/SI: add OMOD patterns

Christian König deathsimple at vodafone.de
Thu Feb 21 00:44:43 PST 2013


Am 21.02.2013 09:26, schrieb Michel Dänzer:
> On Mit, 2013-02-20 at 18:46 +0100, Christian König wrote:
>>   
>> diff --git a/lib/Target/R600/SIInstructions.td b/lib/Target/R600/SIInstructions.td
>> index 833e6cd..7c157e9 100644
>> --- a/lib/Target/R600/SIInstructions.td
>> +++ b/lib/Target/R600/SIInstructions.td
>> @@ -1232,6 +1232,24 @@ def : Pat <
>>      0 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 1 /* NEG */)
>>   >;
>>   
>> +def : Pat <
>> +  (fmul VReg_32:$src, (f32 FP_0_5)),
>> +  (V_ADD_F32_e64 VReg_32:$src, (i32 0x80 /* SRC1 */),
>> +   0 /* ABS */, 0 /* CLAMP */, 3 /* OMOD */, 0 /* NEG */)
>> +>;
>> +
>> +def : Pat <
>> +  (fmul VReg_32:$src, (f32 FP_TWO)),
>> +  (V_ADD_F32_e64 VReg_32:$src, (i32 0x80 /* SRC1 */),
>> +   0 /* ABS */, 0 /* CLAMP */, 1 /* OMOD */, 0 /* NEG */)
>> +>;
>> +
>> +def : Pat <
>> +  (fmul VReg_32:$src, (f32 FP_FOUR)),
>> +  (V_ADD_F32_e64 VReg_32:$src, (i32 0x80 /* SRC1 */),
>> +   0 /* ABS */, 0 /* CLAMP */, 2 /* OMOD */, 0 /* NEG */)
>> +>;
> Is there any advantage to doing it like this as opposed to using
> V_MUL_F32_e32 with the corresponding inline constant source operands? I
> guess it could work for SGPRs as the source as well, if the patterns
> used VSrc instead of VReg, but otherwise MUL would result in more
> compact code.

Good question, I don't see any advantage right now. I just wanted to 
make sure that it's working as expected by doing a full piglit test run.

Going to change my folding to use V_MUL instead and dropping this patch 
from the patchset.

Do I have your Rb for the rest? If yes I really want to commit this, 
cause patch 12 is fixing 40 piglit tests for me.

Christian.


More information about the mesa-dev mailing list