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: unassignedb...@nondot.org
          Reporter: llvm-...@redking.me.uk
                CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
                    pe...@cordes.ca, spatel+l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to