[llvm] r207088 - X86: Emit test instead of constant shift + compare if the shift result is unused.

Benjamin Kramer benny.kra at gmail.com
Thu Apr 24 13:59:37 PDT 2014


On 24.04.2014, at 22:01, Tobias Grosser <tobias at grosser.es> wrote:

> On 24/04/2014 10:15, Benjamin Kramer wrote:
>> Author: d0k
>> Date: Thu Apr 24 03:15:31 2014
>> New Revision: 207088
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=207088&view=rev
>> Log:
>> X86: Emit test instead of constant shift + compare if the shift result is unused.
>> 
>> This allows us to compile
>>   return (mask & 0x8 ? a : b);
>> into
>>   testb $8, %dil
>>   cmovnel %edx, %esi
>> instead of
>>   andl  $8, %edi
>>   shrl  $3, %edi
>>   cmovnel %edx, %esi
>> 
>> which we formed previously because dag combiner canonicalizes setcc of and into shift.
> 
> After this commit, my -O3 test-suite buildbot showed a miscompare during the execution of MultiSource/Benchmarks/mediabench/g721/g721encode/encode.
> 
> http://lab.llvm.org:8011/builders/polly-perf-O3/builds/2811
> 
> The only other two commits in this batch are 207090 and 207091 from Chandler, but I guess they should not cause this.
> 
> I did not investigate further.

Good catch, r207145 should help.

- Ben




More information about the llvm-commits mailing list