[llvm-bugs] [Bug 47066] New: Use vpermps instead of vpermilps

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 9 13:45:02 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47066

            Bug ID: 47066
           Summary: Use vpermps instead of vpermilps
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

#define N 16
float f1[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float f2[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));

void foo ()
{
  int j;
  for (j=0; j<N; j++)
    f1[j] += f2[N-j];
}


Clang -O3 -mavx512f:

foo():                                # @foo()
        vpermilps       zmm0, zmmword ptr [rip + f2+4], 27 # zmm0 =
mem[3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12]
        vshuff64x2      zmm0, zmm0, zmm0, 27    # zmm0 = zmm0[6,7,4,5,2,3,0,1]
        vaddps  zmm0, zmm0, zmmword ptr [rip + f1]
        vmovaps zmmword ptr [rip + f1], zmm0
        vzeroupper
        ret

ICC -O3 -mavx512f:

foo():
        vmovups   zmm16, ZMMWORD PTR .L_2il0floatpacket.0[rip]  #9.14
        vpermps   zmm17, zmm16, ZMMWORD PTR 4+f2[rip]           #9.14
        vaddps    zmm18, zmm17, ZMMWORD PTR f1[rip]             #9.5
        vmovups   ZMMWORD PTR f1[rip], zmm18                    #9.5
        vzeroupper                                              #10.1

https://godbolt.org/z/7bToc7

Interestingly, if I changed float to double, Clang matches ICC:
https://godbolt.org/z/h13beq

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200809/5a89bc49/attachment-0001.html>


More information about the llvm-bugs mailing list