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: [PATCH] - Use of powerpc 64bit instructions in 32bit ABI


>>>>> Fariborz Jahanian writes:

Fariborz> Yes. The very early apple's implementation assumed word_mode == DImode 
Fariborz> and emit_group{load/store} just work by
Fariborz> using PARALLEL for function arguments/return values to register pairs. 
Fariborz> Problem started arising in other parts of
Fariborz> the compiler;  which uses word_mode==DImode to figure out, for example, 
Fariborz> number of registers used in passing
Fariborz> structure-by-value; with register size remaining 32-bit.

	To be concrete, let's take a trivial example from Fariborz:

long long
LL(long long val)
{
  return val+1;
}

Modifying the backend so that GPRs may contain DImode, passing arguments
via PARALLEL, and nothing else produces the following broken code:

        stw 3,-8(1)
        stw 4,-4(1)
        ld 9,-8(1)
        addi 9,9,1
        mr 3,9
        mr 4,9

Setting UNITS_PER_WORD to 8 (word_mode==DImode) and the other rs6000-local
changes produces the following correct but inefficient code:

        stw 3,-8(1)
        stw 4,-4(1)
        ld 4,-8(1)
        addi 4,4,1
        srdi 3,4,32

Apple's changes to the common parts of the compiler produce:

         li 5,0
         rldimi 5,3,32,0
         rldimi 5,4,0,32
         addi 4,5,1
         srdi 3,4,32

without any memory accesses.

	The patch to common parts of the compiler also fix some bugs that
occur in more complicated real-world applications, as Fariborz mentioned.

David


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