http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59180

            Bug ID: 59180
           Summary: x87 constraint "+tg" worse that "+tm" or "+t"
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org
            Target: x86_64-linux-gnu

static double f(double x){asm volatile("":"+tg"(x));return x;}
double g(double a,double b,double c){
  return f(f(a)+f(f(b)*f(c)));
}

compiled with -O3 -m32:

    .cfi_startproc
    subl    $28, %esp
    .cfi_def_cfa_offset 32
    fldl    32(%esp)
    fstpl    (%esp)
    fldl    40(%esp)
    fstpl    8(%esp)
    fldl    48(%esp)
    fstpl    16(%esp)
    fldl    8(%esp)
    fmull    16(%esp)
    fstpl    8(%esp)
    fldl    (%esp)
    faddl    8(%esp)
    fstpl    (%esp)
    fldl    (%esp)
    addl    $28, %esp
    .cfi_def_cfa_offset 4
    ret
    .cfi_endproc

If I give it only "+t" or "+tm", it generates the much better:

    .cfi_startproc
    fldl    4(%esp)
    fldl    12(%esp)
    fldl    20(%esp)
    fmulp    %st, %st(1)
    faddp    %st, %st(1)
    ret
    .cfi_endproc

Reply via email to