This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange (wrong?) aliasing outcome


On Mon, Oct 25, 2004 at 12:50:03PM +0200, Michael Veksler wrote:
> I don't understand why when 'f' is not inlined, the (expensive)
> division is not moved to the beginning of the function.

It's quite obvious if you look at the dump:

;;        0--> 33   [--sp]=bx                          :decoder0,p0|p1,(p4+p3)
;;        1--> 34   {sp=sp-0x4;clobber flags;clobber [s:decodern,p0|p1
;;        2--> 6    bx=[sp+0xc]                        :decodern,p2
;;        3--> 7    cx=[sp+0x10]                       :decodern,p2
;;        6--> 13   ax=[bx]                            :decodern,p2
;;       10--> 14   [cx+0x4]=ax                        :decoder0,(p4+p3)
;;       10--> 31   {dx=ax>>0x1f;clobber flags;}       :decodern,p0|p1
;;       11--> 32   {ax=ax/[bx+0x4];dx=ax%[bx+0x4];use :decoder0,(p2+p0+idiv),(p0+idiv),((p0|p1)+idiv),idiv*34
;;       50--> 19   [cx]=ax                            :decoder0,(p4+p3)
;;       51--> 41   {ax=[sp];sp=sp+0x4;clobber [scratch:decoder0,(p2+(p0|p1))
;;       53--> 38   {bx=[sp];sp=sp+0x4;}               :decoder0,(p2+(p0|p1))
;;       56--> 39   return                             :decoder0

Note the instructions issued in cycle 10.  In particular,
dx gets the replicated sign bit of ax.  This is because the
division instruction is 64bit/32bit -> 32bit.

So the division instruction is emitted as soon as it could be.
The write to pb->v[1] just happens in parallel.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]