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]

PATCH - PPC-darwin Correct initialization of 'long long' with constant



-mpowerpc64 for PPC has a bug passing constant to a function expecting 'long long'. The MSW is incorrectly passed to the function. So, in the following code fragment:

void LL(long long);
...
LL(1);

We generate:

_main:
         li r3,1				<--- bad!
         li r4,1
         b L_LL$stub

Attached patch attempts to fix this. Recognition of PARALLEL pattern is
identical to
what went in function.c:assign_parms for incoming register assignment.
PPC-darwin
bootstrapped and dejagnu  passed.

OK for main line?

Fariborz Jahanian <fjahanian@apple.com>

ChangeLog:

2004-01-13  Fariborz Jahanian <fjahanian@apple.com>
         * expr.c (emit_group_load): split constant
         correctly into register components of PARALLEL insn.



Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.614
diff -c -p -r1.614 expr.c
*** expr.c      10 Jan 2004 20:50:53 -0000      1.614
--- expr.c      14 Jan 2004 00:01:12 -0000
*************** emit_group_load (rtx dst, rtx orig_src,
*** 1948,1953 ****
--- 1948,1956 ----
           emit_move_insn (mem, src);
           tmps[i] = adjust_address (mem, mode, (int) bytepos);
         }
+       else if (CONSTANT_P (src) && GET_MODE (dst) != BLKmode
+              && XVECLEN (dst, 0) > 1)
+       tmps[i] = simplify_gen_subreg (mode, src, GET_MODE(dst),
bytepos);
         else if (CONSTANT_P (src)
                || (GET_CODE (src) == REG && GET_MODE (src) == mode))
         tmps[i] = src;


Test case:


Attachment: test.c
Description: Text document


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