https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88521

--- Comment #8 from mateuszb at poczta dot onet.pl ---
My proposition is:

Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c      (revision 267245)
+++ gcc/config/i386/i386.c      (working copy)
@@ -9063,6 +9063,13 @@
              && !COMPLEX_MODE_P (mode))
            regno = FIRST_SSE_REG;
          break;
+       case 8:
+       case 4:
+         if (valtype != NULL_TREE && AGGREGATE_TYPE_P (valtype))
+           break;
+         if (mode == SFmode || mode == DFmode)
+           regno = FIRST_SSE_REG;
+         break;
        default:
          break;
         }

which gives:

$ cat t.c
float fun1(void)
{
    return 4.14f;
}

typedef struct {float x;} Float;

Float fun2(void)
{
    Float v;
    v.x = 4.14f;
    return v;
}

Mateusz@Mateusz-i7 /c/temp
$ gcc -c -O2 -o t.o t.c

Mateusz@Mateusz-i7 /c/temp
$ objdump -dr t.o

t.o:     file format pe-x86-64


Disassembly of section .text:

0000000000000000 <fun1>:
   0:   f3 0f 10 05 00 00 00    movss  0x0(%rip),%xmm0        # 8 <fun1+0x8>
   7:   00
                        4: R_X86_64_PC32        .rdata
   8:   c3                      retq
   9:   0f 1f 80 00 00 00 00    nopl   0x0(%rax)

0000000000000010 <fun2>:
  10:   8b 05 00 00 00 00       mov    0x0(%rip),%eax        # 16 <fun2+0x6>
                        12: R_X86_64_PC32       .rdata
  16:   c3                      retq
  17:   90                      nop
  18:   90                      nop
  19:   90                      nop
  1a:   90                      nop
  1b:   90                      nop
  1c:   90                      nop
  1d:   90                      nop
  1e:   90                      nop
  1f:   90                      nop

Reply via email to