Very strange ia64 code generation problem
H. J. Lu
hjl@lucon.org
Sun Jul 20 01:32:00 GMT 2003
On Sat, Jul 19, 2003 at 08:52:32AM -0700, H. J. Lu wrote:
> While working on ia64 intrinsics, I found a very strange ia64 code
> generation problem. The following input:
>
> unsigned int
> bswap_int (unsigned int x, int s)
> {
> return s ? (__extension__ ({ register unsigned int __v, __x = (x); { union { unsigned long long __u; long __m; } __c; __c.__u = ((unsigned long long) __x) << 32; __c.__m = ((long) __builtin_ia64_mux1 ((long) (__c.__m), (int)(0xb))); __v = (unsigned int) __c.__u; } __v; })) : x;
> }
>
> "gcc -O" gives me
>
> .file "foo.i"
> .pred.safe_across_calls p1-p5,p16-p63
> .text
> .align 16
> .global bswap_int#
> .proc bswap_int#
> bswap_int:
> .prologue
> .body
> mov r8 = r32
> cmp4.eq p6, p7 = 0, r33
> ;;
> (p7) shl r14 = r8, 32
> ;;
> mux1 r8 = r14, 0xb
> ^^^^^^^^^^^^^^^^^^
> br.ret.sptk.many rp
> ;;
> .endp bswap_int#
> .ident "GCC: (GNU) 3.3 20030715 (Red Hat Linux 3.3-14)"
>
It turns out that it is a gcc bug. I opened a critical bug report:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11599
H.J.
More information about the Gcc
mailing list