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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to