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

            Bug ID: 94915
           Summary: MAX_EXPR weirdly optimized on x86 with -mtune=core2
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int f(int x, int y)
{
    return x > y ? x : y;
}

When compiling with -O3 -mtune=core2 -msse4.1, GCC outputs this :

f(int, int):
  movd xmm0, edi
  movd xmm1, esi
  pmaxsd xmm0, xmm1
  movd eax, xmm0
  ret

It would seem rather doubtful that this is the optimal solution for doing max
over a simple compare+cmov

Reply via email to