[llvm] r251630 - AMDGPU/SI: use S_AND for i1 trunc

Michel Dänzer via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 29 20:21:26 PDT 2015


On 30.10.2015 00:12, Christian König via llvm-commits wrote:
> On 29.10.2015 16:05, Marek Olsak via llvm-commits wrote:
>>
>> --- llvm/trunk/lib/Target/AMDGPU/SIInstructions.td (original)
>> +++ llvm/trunk/lib/Target/AMDGPU/SIInstructions.td Thu Oct 29 10:05:03
>> 2015
>> @@ -3183,12 +3183,12 @@ def : Pat <
>>     def : Pat <
>>     (i1 (trunc i32:$a)),
>> -  (V_CMP_EQ_I32_e64 (V_AND_B32_e64 (i32 1), $a), 1)
>> +  (V_CMP_EQ_I32_e64 (S_AND_B32 (i32 1), $a), 1)
>>   >;
> 
> Maybe a dump question, but wouldn't do a compare for greater than zero
> do the same in just one instruction instead of two?

No, that would incorrectly result in 1 even even if the LSB is 0, for
all even input values (except 0).


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the llvm-commits mailing list