[llvm-bugs] [Bug 33483] New: [X86][SSE] Use re-materializable -1 for vector increment/decrement

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 16 10:25:38 PDT 2017


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

            Bug ID: 33483
           Summary: [X86][SSE] Use re-materializable -1 for vector
                    increment/decrement
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    peter at cordes.ca, spatel+llvm at rotateright.com

define <4 x i32> @inc(<4 x i32>)  {
  %2 = add <4 x i32> %0, <i32 1, i32 1, i32 1, i32 1>
  ret <4 x i32> %2
}
define <4 x i32> @dec(<4 x i32>)  {
  %2 = sub <4 x i32> %0, <i32 1, i32 1, i32 1, i32 1>
  ret <4 x i32> %2
}

These currently do a constant load:

inc:
  vpaddd .LCPI0_0(%rip), %xmm0, %xmm0
  retq

dec:
  vpsubd .LCPI1_0(%rip), %xmm0, %xmm0
  retq

But they could do this using the re-materializable -1 value instead:

inc:
  vcmpeqd %xmm1, %xmm1, %xmm1
  vpsubd %xmm1, %xmm0, %xmm0
  retq

dec:
  vcmpeqd %xmm1, %xmm1, %xmm1
  vpaddd %xmm1, %xmm0, %xmm0
  retq

-- 
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/20170616/127b5e62/attachment.html>


More information about the llvm-bugs mailing list