https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61195
            Bug ID: 61195
           Summary: single precision fmov does not need to switch mode
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chrbr at gcc dot gnu.org

for SH4/SH2A the compiler forces a PR mode switch for the floating point moves:

so

float
foo(float f)
{
        return f;
}

compiles as:

        mov.l   .L2,r1
        lds.l   @r1+,fpscr
        add     #-4,r1
        fmov    fr4,fr0
        add     #4,r1
        rts
        lds.l   @r1+,fpscr
.L3:
        .align 2
.L2:
        .long   ___fpscr_values

This is not necessary, since the prevailing mode for PR=0 is single precision
(double precision would be set with SZ=1)

so the function can be just be compiled as

_foo:
        rts
        fmov    fr4,fr0

Reply via email to