[llvm-bugs] [Bug 31024] New: [X86] Unnecessary register moves

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 15 08:32:43 PST 2016


            Bug ID: 31024
           Summary: [X86] Unnecessary register moves
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

define <8 x i64> @sext_16i8_to_8i64(<16 x i8> %A) nounwind uwtable readnone ssp
  %B = shufflevector <16 x i8> %A, <16 x i8> undef, <8 x i32> <i32 0, i32 1,
i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %C = sext <8 x i8> %B to <8 x i64>
  ret <8 x i64> %C

llc -mtriple=x86_64-unknown-unknown -mattr=+avx2

  vpmovsxbq %xmm0, %ymm2
  vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
  vpmovsxbq %xmm0, %ymm1
  vmovdqa %ymm2, %ymm0

This could avoid the register move:

  vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
  vpmovsxbq %xmm0, %ymm0
  vpmovsxbq %xmm1, %ymm1

Reg-reg moves are almost free but its still better to avoid them if we can.

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/20161115/83448a5a/attachment.html>

More information about the llvm-bugs mailing list