This is the mail archive of the gcc-patches@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: x86/MMX/SSE shift by immediate



On Jan 7, 2004, at 2:45 PM, Richard Henderson wrote:


On Wed, Jan 07, 2004 at 02:36:13PM -0800, Stuart Hastings wrote:
Yes, both of the CPUID instructions here kill %eax, %ebx, %ecx, and
%edx.  However, if I admit as much in the __asm__, and I compile with
-fPIC (default on Darwin/x86), GCC stops here with the diagnostic

	/Volumes/sandbox/stuart/gcc.fsf/gcc/testsuite/gcc.dg/i386-cpuid.h:39:
error: PIC register `ebx' clobbered in `asm'

Ergo, I chose to lie to GCC about the CPUID instruction. :-( I really
dislike doing this; sleazy tricks like this usually cause maintenance
headaches later on (e.g. if GCC gets smarter about the PIC register, we
could and should describe CPUID correctly here). Do you know a better
way?

__asm__ ("push %ebx; cpuid; pop %ebx" : "=a" (fl1) : "0" (0) : "ecx" "edx", cc");

Right. Wish I'd thought of that...


Ok with that fix.

Thank-you.


Which also removes the need for the nowhere call too, right?

Right again.


r~

I've revised the CPUID stuff per above, and added some more NOINLINEs in i386-sse-5.c. Everything still works on Darwin/x86(P4, -fPIC) and Linux/x86(P3, -fno-PIC). If I hear no objections, I'll commit this later today.


stuart hastings
Apple Computer

Attachment: gcc.fsf.diffs.txt
Description: Text document

Attachment: i386-cpuid.h
Description: Text document

Attachment: i386-sse-5.c
Description: Text document


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