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]

Very strange ia64 code generation problem


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)"


There is no predicate for "mux1 r8 = r14, 0xb". The 33.mach RTL dump
looks fine to me.

(insn 27 55 37 0 0x20000000003148a0 (cond_exec (eq (reg:BI 262 p6 [344])
            (const_int 0 [0x0]))
        (set (reg:DI 8 r8 [343])
            (unspec:DI [
                    (reg:DI 14 r14 [349])
                    (const_int 11 [0xb])
                ] 56))) 767 {mf+250} (insn_list 20 (nil))
    (expr_list:REG_DEAD (reg:DI 14 r14 [349])
        (expr_list:REG_DEAD (reg:BI 262 p6 [344])
            (nil))))

is

 __c.__m = ((long) __builtin_ia64_mux1 ((long) (__c.__m), (int)(0xb)));

But there is no "(p7)" in the assembly output. Any ideas?

Thanks.


H.J.
---
;; Function bswap_int

(note 2 0 44 NOTE_INSN_DELETED)

(note 44 2 51 0 [bb 0] NOTE_INSN_BASIC_BLOCK)

(note 51 44 3 0 NOTE_INSN_PROLOGUE_END)

(insn 3 51 5 0 (nil) (set (reg/v:SI 8 r8 [341])
        (reg:SI 112 r32)) 5 {*movsi_internal} (nil)
    (expr_list:REG_DEAD (reg:SI 112 r32)
        (nil)))

(note 5 3 12 0 NOTE_INSN_FUNCTION_BEG)

(insn 12 5 19 0 0x20000000003148a0 (set (reg:BI 262 p6 [344])
        (eq:BI (reg/v:SI 113 r33 [342])
            (const_int 0 [0x0]))) 203 {*cmpsi_normal} (nil)
    (expr_list:REG_DEAD (reg/v:SI 113 r33 [342])
        (nil)))

(note 19 12 54 0 NOTE_INSN_DELETED)

(insn 54 19 20 0 (nil) (unspec_volatile [
            (const_int 3 [0x3])
        ] 2) -1 (nil)
    (nil))

(insn 20 54 22 0 0x20000000003147e0 (cond_exec (eq (reg:BI 262 p6 [344])
            (const_int 0 [0x0]))
        (set (reg:DI 14 r14 [349])
            (ashift:DI (reg:DI 8 r8 [341])
                (const_int 32 [0x20])))) 695 {mf+178} (nil)
    (nil))

(note 22 20 55 0 NOTE_INSN_DELETED)

(insn 55 22 27 0 (nil) (unspec_volatile [
            (const_int 3 [0x3])
        ] 2) -1 (nil)
    (nil))

(insn 27 55 37 0 0x20000000003148a0 (cond_exec (eq (reg:BI 262 p6 [344])
            (const_int 0 [0x0]))
        (set (reg:DI 8 r8 [343])
            (unspec:DI [
                    (reg:DI 14 r14 [349])
                    (const_int 11 [0xb])
                ] 56))) 767 {mf+250} (insn_list 20 (nil))
    (expr_list:REG_DEAD (reg:DI 14 r14 [349])
        (expr_list:REG_DEAD (reg:BI 262 p6 [344])
            (nil))))

(note 37 27 43 0 NOTE_INSN_FUNCTION_END)

(insn 43 37 53 0 0x2000000000314900 (use (reg/i:SI 8 r8)) -1 (nil)
    (nil))

(jump_insn 53 43 56 0 (nil) (return) 230 {return} (nil)
    (nil))

(insn 56 53 52 0 (nil) (unspec_volatile [
            (const_int 3 [0x3])
        ] 2) -1 (nil)
    (nil))

(barrier 52 56 50)

(note 50 52 0 NOTE_INSN_DELETED)


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