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

            Bug ID: 115418
           Summary: [14 regression] Extra movapd emitted for MAX
                    implementation
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

```
#define MAX(a, b) ((a) < (b) ? (b) : (a))
#define MAX3(a, b, c) MAX((a), MAX((b), (c)))

double f(double a, double b, double c)
{
return MAX3(a,b,c);
}
```

```
$ gcc-14 /tmp/foo200.c -S -o - -O2
.file   "foo200.c"
.text
.p2align 4
.globl  f
.type   f, @function
f:
.LFB0:
.cfi_startproc
movapd  %xmm2, %xmm3
maxsd   %xmm1, %xmm3
maxsd   %xmm0, %xmm3
movapd  %xmm3, %xmm0
ret
.cfi_endproc
.LFE0:
.size   f, .-f
.ident  "GCC: (Gentoo Hardened 14.1.1_p20240608 p2) 14.1.1 20240608"
.section        .note.GNU-stack,"",@progbits
```

I only see the extra movapd with 14.

Reply via email to