[llvm-bugs] [Bug 46393] New: Failure to optimize vpmovsxwd+vpslld properly

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 18 15:32:39 PDT 2020


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

            Bug ID: 46393
           Summary: Failure to optimize vpmovsxwd+vpslld properly
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier 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

typedef int32_t v8i32 __attribute__((vector_size(32)));

v8i32 f(__m128i a, uint8_t u)
{
    return __builtin_ia32_pslldi256((v8i32)_mm256_maskz_cvtepi16_epi32(u, a),
16);
}

With -O3 -march=tigerlake, GCC outputs this :

f(long long __vector(2), unsigned char):
  kmovb k1, edi
  vpmovsxwd ymm0{k1}{z}, xmm0
  vpslld ymm0, ymm0, 16
  ret

LLVM outputs this :

.LCPI0_0:
  .short 16 # 0x10
  .short 0 # 0x0
  .short 18 # 0x12
  .short 1 # 0x1
  .short 20 # 0x14
  .short 2 # 0x2
  .short 22 # 0x16
  .short 3 # 0x3
  .short 24 # 0x18
  .short 4 # 0x4
  .short 26 # 0x1a
  .short 5 # 0x5
  .short 28 # 0x1c
  .short 6 # 0x6
  .short 30 # 0x1e
  .short 7 # 0x7
f(long long __vector(2), unsigned char):
  vmovdqa ymm1, ymmword ptr [rip + .LCPI0_0] # ymm1 =
[16,0,18,1,20,2,22,3,24,4,26,5,28,6,30,7]
  kmovd k1, edi
  vpxor xmm2, xmm2, xmm2
  vpermi2w ymm1, ymm0, ymm2
  vmovdqa32 ymm0 {k1} {z}, ymm1
  ret

I've been incapable of narrowing this down to any specific flag other than
-march=tigerlake.

-- 
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/20200618/c4f1cc38/attachment.html>


More information about the llvm-bugs mailing list