[llvm-bugs] [Bug 43660] New: [X86] Use combineLogicBlendIntoConditionalNegate for SSSE3+ targets

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 13 03:48:03 PDT 2019


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

            Bug ID: 43660
           Summary: [X86] Use combineLogicBlendIntoConditionalNegate for
                    SSSE3+ targets
           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,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

Current Codegen: https://gcc.godbolt.org/z/mmT1B1

As mentioned on D62777, basic SSE2 targets manage to simplify:

define <16 x i8> @non_splat_minus_one_divisor_0(<16 x i8> %A) {
  %div = sdiv <16 x i8> %A, <i8 -1, i8 -1, i8 1, i8 -1, i8 -1, i8 -1, i8 1, i8
-1, i8 -1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
  ret <16 x i8> %div
}

to:

non_splat_minus_one_divisor_0: # @non_splat_minus_one_divisor_0
  movdqa .LCPI0_0(%rip), %xmm1 # xmm1 =
[0,0,255,0,0,0,255,0,0,255,255,255,255,255,255,255]
  pxor %xmm1, %xmm0
  psubb %xmm0, %xmm1
  movdqa %xmm1, %xmm0
  retq

but later targets end up with:

non_splat_minus_one_divisor_0: # @non_splat_minus_one_divisor_0
  pxor %xmm1, %xmm1
  psubb %xmm0, %xmm1
  pshufb .LCPI0_0(%rip), %xmm1 # xmm1 =
xmm1[0,1],zero,xmm1[3,4,5],zero,xmm1[7,8],zero,zero,zero,zero,zero,zero,zero
  pshufb .LCPI0_1(%rip), %xmm0 # xmm0 =
zero,zero,xmm0[2],zero,zero,zero,xmm0[6],zero,zero,xmm0[9,10,11,12,13,14,15]
  por %xmm1, %xmm0
  retq

or (after SSE41):

non_splat_minus_one_divisor_0: # @non_splat_minus_one_divisor_0
  vmovdqa .LCPI0_0(%rip), %xmm2 # xmm2 =
[0,0,255,0,0,0,255,0,0,255,255,255,255,255,255,255]
  vpxor %xmm1, %xmm1, %xmm1
  vpsubb %xmm0, %xmm1, %xmm1
  vpblendvb %xmm2, %xmm0, %xmm1, %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/20191013/05e29ded/attachment.html>


More information about the llvm-bugs mailing list