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

             Bug #: 50302
           Summary: inefficient float->double conversion in AVX with
                    -mtune=generic
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: andi-...@firstfloor.org


I noticed that with AVX and -mtune=generic and converting a single float to a
double gcc still generates

vunpcklps reg,reg
vcvtps2pd reg,reg

instead of the more straight forward and likely more power efficient

vcvtss2sd reg,reg

AFAIK the first sequence was only needed on some older AMD CPUs with SSE
to avoid a conversion penalty, does it really still make sense for AVX?

Perhaps that should be fixed for tune=generic ?

Test case:

#include <stdio.h>
float a = 1, b = 2;
float c;

int main(void)
{
        c = a + b;
        printf("%f\n", c);
        return 0;
}

Reply via email to