[Bug target/50302] New: inefficient float->double conversion in AVX with -mtune=generic

andi-gcc at firstfloor dot org gcc-bugzilla@gcc.gnu.org
Mon Sep 5 23:08:00 GMT 2011


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: unassigned@gcc.gnu.org
        ReportedBy: andi-gcc@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;
}



More information about the Gcc-bugs mailing list