[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


            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


non_splat_minus_one_divisor_0: # @non_splat_minus_one_divisor_0
  movdqa .LCPI0_0(%rip), %xmm1 # xmm1 =
  pxor %xmm1, %xmm0
  psubb %xmm0, %xmm1
  movdqa %xmm1, %xmm0

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 =
  pshufb .LCPI0_1(%rip), %xmm0 # xmm0 =
  por %xmm1, %xmm0

or (after SSE41):

non_splat_minus_one_divisor_0: # @non_splat_minus_one_divisor_0
  vmovdqa .LCPI0_0(%rip), %xmm2 # xmm2 =
  vpxor %xmm1, %xmm1, %xmm1
  vpsubb %xmm0, %xmm1, %xmm1
  vpblendvb %xmm2, %xmm0, %xmm1, %xmm0

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