This is the mail archive of the gcc-bugs@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]

[Bug target/20781] 64 bit shift by non-constant implemented as libcall on PPC32


------- Additional Comments From segher at kernel dot crashing dot org  2005-04-07 23:34 -------
Subject: Re:  New: 64 bit shift by non-constant implemented as libcall on PPC32

> (O5 will give slightly better code for both, but let's start somewhere 
> :P)

Well the code for the left shift can be replaced with

	subfic  r6,r5,32
	addi    r7,r5,-32
	slw     r3,r3,r5
	srw     r6,r4,r6
	slw     r7,r4,r7
	slw     r4,r4,r5
	or      r5,r6,r7
	or      r3,r3,r5

and similar for the right shift (and also for signed shift counts),
as shift counts < 0 and >= 64 are undefined here in C.  If you want
to verify this, do take care with count == 32, as it's "special";
but you can also just look in Book I appendix C.1 and trust that.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20781


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