This is the mail archive of the gcc-bugs@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]

SH-ELF: SFmode calling convention bug with -m4/-m4-single-only -ml



version: 3.0.2 also CVS
   host: i386
 target: sh-elf

When this testcase:

void func2(float, float, float, float);

void func(void)

{
        func2(0.0f, 1.0f, 2.0f, 3.0f);
}

is compiled with the options -O2 -m4 -ml, the following code is generated:

_func:
        mov.l   r14,@-r15
        sts.l   pr,@-r15
        mov     r15,r14
        mova    .L2,r0
        fmov.s  @r0+,fr5	<- 0.0f in fr5 (should be in fr4)
        fmov.s  @r0+,fr4	<- 1.0f in fr4 (should be in fr5)
        fmov.s  @r0+,fr7	<- 2.0f in fr7 (should be in fr6)
        mov.l   .L3,r1
        jsr     @r1
        fmov.s  @r0+,fr6	<- 3.0f in fr6 (should be in fr7)
        mov     r14,r15
        lds.l   @r15+,pr
        rts
        mov.l   @r15+,r14
.L4:
        .align 2
.L2:
        .float 0.00000000000000000000e0
        .float 1.00000000000000000000e0
        .float 2.00000000000000000000e0
        .float 3.00000000000000000000e0
.L3:
        .long   _func2

The culprit appears to be the FUNCTION_ARG macro in gcc/config/sh/sh.h.
It flips the least significant bit of the regno to which the parameter
is assigned if the options are -m4/-m4-single and -ml.

Toshi






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