[aarch64-port-dev ] RFR: Minor optimisation for divide by 2

Andrew Haley aph at redhat.com
Mon May 12 12:10:37 UTC 2014


Hi,

On 04/29/2014 10:16 AM, Edward Nevill wrote:

> C2 currently generates
> 
> mov rdst, rsrc, asr #31
> mov rdst, rdst, lsr #31
> add rdst, rsrc, rdst
> mov rdst, rdst, asr #1
> 
> for divide by 2.

I get

 asr	rdst, rsrc, #31
 add	rtmp, rsrc, rdst, lsr #31
 asr	rdst, rtmp, #1

from C2.  Which is not as nice as yours, but less worrying.

> The following patch reduces this to
> 
> add rdst, rsrc, rsrc, lsr #31
> mov rdst, rdst, asr #1
> 
> I know this is very minor, but it offends me:-)
> 
> OK?

Why is there no long version of this?

Andrew.


More information about the aarch64-port-dev mailing list