[llvm] r266963 - [AVX512] Add support for lowering CTTZ v64i8 and v32i16 with BWI instructions.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 23:39:35 PDT 2016
Author: ctopper
Date: Thu Apr 21 01:39:34 2016
New Revision: 266963
URL: http://llvm.org/viewvc/llvm-project?rev=266963&view=rev
Log:
[AVX512] Add support for lowering CTTZ v64i8 and v32i16 with BWI instructions.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/vector-tzcnt-512.ll
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=266963&r1=266962&r2=266963&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Apr 21 01:39:34 2016
@@ -1486,6 +1486,7 @@ X86TargetLowering::X86TargetLowering(con
setOperationAction(ISD::MLOAD, VT, Legal);
setOperationAction(ISD::MSTORE, VT, Legal);
setOperationAction(ISD::CTPOP, VT, Custom);
+ setOperationAction(ISD::CTTZ, VT, Custom);
setOperationPromotedToType(ISD::AND, VT, MVT::v8i64);
setOperationPromotedToType(ISD::OR, VT, MVT::v8i64);
Modified: llvm/trunk/test/CodeGen/X86/vector-tzcnt-512.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-tzcnt-512.ll?rev=266963&r1=266962&r2=266963&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-tzcnt-512.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-tzcnt-512.ll Thu Apr 21 01:39:34 2016
@@ -1,6 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl -mattr=+avx512cd,-avx512bw | FileCheck %s --check-prefix=ALL --check-prefix=AVX512CD
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl -mattr=+avx512cd,+avx512bw | FileCheck %s --check-prefix=ALL --check-prefix=AVX512CDBW
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl -mattr=+avx512bw | FileCheck %s --check-prefix=ALL --check-prefix=AVX512BW
define <8 x i64> @testv8i64(<8 x i64> %in) nounwind {
; ALL-LABEL: testv8i64:
@@ -169,109 +170,41 @@ define <32 x i16> @testv32i16(<32 x i16>
;
; AVX512CDBW-LABEL: testv32i16:
; AVX512CDBW: ## BB#0:
-; AVX512CDBW-NEXT: vextracti32x4 $3, %zmm0, %xmm1
-; AVX512CDBW-NEXT: vpextrw $1, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vmovd %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntw %cx, %cx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm2
-; AVX512CDBW-NEXT: vpinsrw $1, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $2, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $2, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $3, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $3, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $4, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $4, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $5, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $5, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $6, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $6, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $7, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $7, %eax, %xmm2, %xmm1
-; AVX512CDBW-NEXT: vextracti32x4 $2, %zmm0, %xmm2
-; AVX512CDBW-NEXT: vpextrw $1, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vmovd %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntw %cx, %cx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm3
-; AVX512CDBW-NEXT: vpinsrw $1, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $2, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $2, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $3, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $3, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $4, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $4, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $5, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $5, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $6, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $6, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $7, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $7, %eax, %xmm3, %xmm2
-; AVX512CDBW-NEXT: vinserti128 $1, %xmm1, %ymm2, %ymm1
-; AVX512CDBW-NEXT: vextracti32x4 $1, %zmm0, %xmm2
-; AVX512CDBW-NEXT: vpextrw $1, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vmovd %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntw %cx, %cx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm3
-; AVX512CDBW-NEXT: vpinsrw $1, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $2, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $2, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $3, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $3, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $4, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $4, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $5, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $5, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $6, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $6, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $7, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $7, %eax, %xmm3, %xmm2
-; AVX512CDBW-NEXT: vpextrw $1, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vmovd %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntw %cx, %cx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm3
-; AVX512CDBW-NEXT: vpinsrw $1, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $2, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $2, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $3, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $3, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $4, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $4, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $5, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $5, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $6, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $6, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $7, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $7, %eax, %xmm3, %xmm0
-; AVX512CDBW-NEXT: vinserti128 $1, %xmm2, %ymm0, %ymm0
-; AVX512CDBW-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpxord %zmm1, %zmm1, %zmm1
+; AVX512CDBW-NEXT: vpsubw %zmm0, %zmm1, %zmm1
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpsubw {{.*}}(%rip), %zmm0, %zmm0
+; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm2
+; AVX512CDBW-NEXT: vmovdqu8 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
+; AVX512CDBW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
+; AVX512CDBW-NEXT: vpsrlw $4, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
+; AVX512CDBW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpsllw $8, %zmm0, %zmm1
+; AVX512CDBW-NEXT: vpaddb %zmm0, %zmm1, %zmm0
+; AVX512CDBW-NEXT: vpsrlw $8, %zmm0, %zmm0
; AVX512CDBW-NEXT: retq
+;
+; AVX512BW-LABEL: testv32i16:
+; AVX512BW: ## BB#0:
+; AVX512BW-NEXT: vpxord %zmm1, %zmm1, %zmm1
+; AVX512BW-NEXT: vpsubw %zmm0, %zmm1, %zmm1
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512BW-NEXT: vpsubw {{.*}}(%rip), %zmm0, %zmm0
+; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
+; AVX512BW-NEXT: vmovdqu8 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
+; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
+; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
+; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
+; AVX512BW-NEXT: vpsllw $8, %zmm0, %zmm1
+; AVX512BW-NEXT: vpaddb %zmm0, %zmm1, %zmm0
+; AVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
+; AVX512BW-NEXT: retq
%out = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %in, i1 0)
ret <32 x i16> %out
}
@@ -311,109 +244,41 @@ define <32 x i16> @testv32i16u(<32 x i16
;
; AVX512CDBW-LABEL: testv32i16u:
; AVX512CDBW: ## BB#0:
-; AVX512CDBW-NEXT: vextracti32x4 $3, %zmm0, %xmm1
-; AVX512CDBW-NEXT: vpextrw $1, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vmovd %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntw %cx, %cx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm2
-; AVX512CDBW-NEXT: vpinsrw $1, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $2, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $2, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $3, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $3, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $4, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $4, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $5, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $5, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $6, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $6, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrw $7, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $7, %eax, %xmm2, %xmm1
-; AVX512CDBW-NEXT: vextracti32x4 $2, %zmm0, %xmm2
-; AVX512CDBW-NEXT: vpextrw $1, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vmovd %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntw %cx, %cx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm3
-; AVX512CDBW-NEXT: vpinsrw $1, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $2, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $2, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $3, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $3, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $4, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $4, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $5, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $5, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $6, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $6, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $7, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $7, %eax, %xmm3, %xmm2
-; AVX512CDBW-NEXT: vinserti128 $1, %xmm1, %ymm2, %ymm1
-; AVX512CDBW-NEXT: vextracti32x4 $1, %zmm0, %xmm2
-; AVX512CDBW-NEXT: vpextrw $1, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vmovd %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntw %cx, %cx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm3
-; AVX512CDBW-NEXT: vpinsrw $1, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $2, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $2, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $3, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $3, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $4, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $4, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $5, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $5, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $6, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $6, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $7, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $7, %eax, %xmm3, %xmm2
-; AVX512CDBW-NEXT: vpextrw $1, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vmovd %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntw %cx, %cx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm3
-; AVX512CDBW-NEXT: vpinsrw $1, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $2, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $2, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $3, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $3, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $4, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $4, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $5, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $5, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $6, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $6, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrw $7, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntw %ax, %ax
-; AVX512CDBW-NEXT: vpinsrw $7, %eax, %xmm3, %xmm0
-; AVX512CDBW-NEXT: vinserti128 $1, %xmm2, %ymm0, %ymm0
-; AVX512CDBW-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpxord %zmm1, %zmm1, %zmm1
+; AVX512CDBW-NEXT: vpsubw %zmm0, %zmm1, %zmm1
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpsubw {{.*}}(%rip), %zmm0, %zmm0
+; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm2
+; AVX512CDBW-NEXT: vmovdqu8 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
+; AVX512CDBW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
+; AVX512CDBW-NEXT: vpsrlw $4, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
+; AVX512CDBW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpsllw $8, %zmm0, %zmm1
+; AVX512CDBW-NEXT: vpaddb %zmm0, %zmm1, %zmm0
+; AVX512CDBW-NEXT: vpsrlw $8, %zmm0, %zmm0
; AVX512CDBW-NEXT: retq
+;
+; AVX512BW-LABEL: testv32i16u:
+; AVX512BW: ## BB#0:
+; AVX512BW-NEXT: vpxord %zmm1, %zmm1, %zmm1
+; AVX512BW-NEXT: vpsubw %zmm0, %zmm1, %zmm1
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512BW-NEXT: vpsubw {{.*}}(%rip), %zmm0, %zmm0
+; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
+; AVX512BW-NEXT: vmovdqu8 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
+; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
+; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
+; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
+; AVX512BW-NEXT: vpsllw $8, %zmm0, %zmm1
+; AVX512BW-NEXT: vpaddb %zmm0, %zmm1, %zmm0
+; AVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
+; AVX512BW-NEXT: retq
%out = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %in, i1 -1)
ret <32 x i16> %out
}
@@ -447,334 +312,35 @@ define <64 x i8> @testv64i8(<64 x i8> %i
;
; AVX512CDBW-LABEL: testv64i8:
; AVX512CDBW: ## BB#0:
-; AVX512CDBW-NEXT: vextracti32x4 $3, %zmm0, %xmm1
-; AVX512CDBW-NEXT: vpextrb $1, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: movl $8, %eax
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpextrb $0, %xmm1, %edx
-; AVX512CDBW-NEXT: tzcntl %edx, %edx
-; AVX512CDBW-NEXT: cmpl $32, %edx
-; AVX512CDBW-NEXT: cmovel %eax, %edx
-; AVX512CDBW-NEXT: vmovd %edx, %xmm2
-; AVX512CDBW-NEXT: vpinsrb $1, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $2, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $2, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $3, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $3, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $4, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $4, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $5, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $5, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $6, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $6, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $7, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $7, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $8, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $8, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $9, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $9, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $10, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $10, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $11, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $11, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $12, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $12, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $13, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $13, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $14, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $14, %ecx, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $15, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $15, %ecx, %xmm2, %xmm1
-; AVX512CDBW-NEXT: vextracti32x4 $2, %zmm0, %xmm2
-; AVX512CDBW-NEXT: vpextrb $1, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpextrb $0, %xmm2, %edx
-; AVX512CDBW-NEXT: tzcntl %edx, %edx
-; AVX512CDBW-NEXT: cmpl $32, %edx
-; AVX512CDBW-NEXT: cmovel %eax, %edx
-; AVX512CDBW-NEXT: vmovd %edx, %xmm3
-; AVX512CDBW-NEXT: vpinsrb $1, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $2, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $2, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $3, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $3, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $4, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $4, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $5, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $5, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $6, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $6, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $7, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $7, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $8, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $8, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $9, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $9, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $10, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $10, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $11, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $11, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $12, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $12, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $13, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $13, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $14, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $14, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $15, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $15, %ecx, %xmm3, %xmm2
-; AVX512CDBW-NEXT: vinserti128 $1, %xmm1, %ymm2, %ymm1
-; AVX512CDBW-NEXT: vextracti32x4 $1, %zmm0, %xmm2
-; AVX512CDBW-NEXT: vpextrb $1, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpextrb $0, %xmm2, %edx
-; AVX512CDBW-NEXT: tzcntl %edx, %edx
-; AVX512CDBW-NEXT: cmpl $32, %edx
-; AVX512CDBW-NEXT: cmovel %eax, %edx
-; AVX512CDBW-NEXT: vmovd %edx, %xmm3
-; AVX512CDBW-NEXT: vpinsrb $1, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $2, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $2, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $3, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $3, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $4, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $4, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $5, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $5, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $6, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $6, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $7, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $7, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $8, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $8, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $9, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $9, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $10, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $10, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $11, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $11, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $12, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $12, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $13, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $13, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $14, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $14, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $15, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $15, %ecx, %xmm3, %xmm2
-; AVX512CDBW-NEXT: vpextrb $1, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpextrb $0, %xmm0, %edx
-; AVX512CDBW-NEXT: tzcntl %edx, %edx
-; AVX512CDBW-NEXT: cmpl $32, %edx
-; AVX512CDBW-NEXT: cmovel %eax, %edx
-; AVX512CDBW-NEXT: vmovd %edx, %xmm3
-; AVX512CDBW-NEXT: vpinsrb $1, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $2, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $2, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $3, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $3, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $4, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $4, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $5, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $5, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $6, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $6, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $7, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $7, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $8, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $8, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $9, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $9, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $10, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $10, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $11, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $11, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $12, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $12, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $13, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $13, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $14, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $14, %ecx, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $15, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: cmpl $32, %ecx
-; AVX512CDBW-NEXT: cmovel %eax, %ecx
-; AVX512CDBW-NEXT: vpinsrb $15, %ecx, %xmm3, %xmm0
-; AVX512CDBW-NEXT: vinserti128 $1, %xmm2, %ymm0, %ymm0
-; AVX512CDBW-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpxord %zmm1, %zmm1, %zmm1
+; AVX512CDBW-NEXT: vpsubb %zmm0, %zmm1, %zmm1
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpsubb {{.*}}(%rip), %zmm0, %zmm0
+; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm2
+; AVX512CDBW-NEXT: vmovdqu8 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
+; AVX512CDBW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
+; AVX512CDBW-NEXT: vpsrlw $4, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
+; AVX512CDBW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
; AVX512CDBW-NEXT: retq
+;
+; AVX512BW-LABEL: testv64i8:
+; AVX512BW: ## BB#0:
+; AVX512BW-NEXT: vpxord %zmm1, %zmm1, %zmm1
+; AVX512BW-NEXT: vpsubb %zmm0, %zmm1, %zmm1
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512BW-NEXT: vpsubb {{.*}}(%rip), %zmm0, %zmm0
+; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
+; AVX512BW-NEXT: vmovdqu8 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
+; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
+; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
+; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
+; AVX512BW-NEXT: retq
%out = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %in, i1 0)
ret <64 x i8> %out
}
@@ -808,205 +374,35 @@ define <64 x i8> @testv64i8u(<64 x i8> %
;
; AVX512CDBW-LABEL: testv64i8u:
; AVX512CDBW: ## BB#0:
-; AVX512CDBW-NEXT: vextracti32x4 $3, %zmm0, %xmm1
-; AVX512CDBW-NEXT: vpextrb $1, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpextrb $0, %xmm1, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm2
-; AVX512CDBW-NEXT: vpinsrb $1, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $2, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $2, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $3, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $3, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $4, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $4, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $5, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $5, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $6, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $6, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $7, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $7, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $8, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $8, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $9, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $9, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $10, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $10, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $11, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $11, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $12, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $12, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $13, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $13, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $14, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $14, %eax, %xmm2, %xmm2
-; AVX512CDBW-NEXT: vpextrb $15, %xmm1, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $15, %eax, %xmm2, %xmm1
-; AVX512CDBW-NEXT: vextracti32x4 $2, %zmm0, %xmm2
-; AVX512CDBW-NEXT: vpextrb $1, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpextrb $0, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm3
-; AVX512CDBW-NEXT: vpinsrb $1, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $2, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $2, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $3, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $3, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $4, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $4, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $5, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $5, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $6, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $6, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $7, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $7, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $8, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $8, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $9, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $9, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $10, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $10, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $11, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $11, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $12, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $12, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $13, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $13, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $14, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $14, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $15, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $15, %eax, %xmm3, %xmm2
-; AVX512CDBW-NEXT: vinserti128 $1, %xmm1, %ymm2, %ymm1
-; AVX512CDBW-NEXT: vextracti32x4 $1, %zmm0, %xmm2
-; AVX512CDBW-NEXT: vpextrb $1, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpextrb $0, %xmm2, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm3
-; AVX512CDBW-NEXT: vpinsrb $1, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $2, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $2, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $3, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $3, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $4, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $4, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $5, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $5, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $6, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $6, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $7, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $7, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $8, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $8, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $9, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $9, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $10, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $10, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $11, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $11, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $12, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $12, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $13, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $13, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $14, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $14, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $15, %xmm2, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $15, %eax, %xmm3, %xmm2
-; AVX512CDBW-NEXT: vpextrb $1, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpextrb $0, %xmm0, %ecx
-; AVX512CDBW-NEXT: tzcntl %ecx, %ecx
-; AVX512CDBW-NEXT: vmovd %ecx, %xmm3
-; AVX512CDBW-NEXT: vpinsrb $1, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $2, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $2, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $3, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $3, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $4, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $4, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $5, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $5, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $6, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $6, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $7, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $7, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $8, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $8, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $9, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $9, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $10, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $10, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $11, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $11, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $12, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $12, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $13, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $13, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $14, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $14, %eax, %xmm3, %xmm3
-; AVX512CDBW-NEXT: vpextrb $15, %xmm0, %eax
-; AVX512CDBW-NEXT: tzcntl %eax, %eax
-; AVX512CDBW-NEXT: vpinsrb $15, %eax, %xmm3, %xmm0
-; AVX512CDBW-NEXT: vinserti128 $1, %xmm2, %ymm0, %ymm0
-; AVX512CDBW-NEXT: vinserti64x4 $1, %ymm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpxord %zmm1, %zmm1, %zmm1
+; AVX512CDBW-NEXT: vpsubb %zmm0, %zmm1, %zmm1
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpsubb {{.*}}(%rip), %zmm0, %zmm0
+; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm2
+; AVX512CDBW-NEXT: vmovdqu8 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
+; AVX512CDBW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
+; AVX512CDBW-NEXT: vpsrlw $4, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512CDBW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
+; AVX512CDBW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
; AVX512CDBW-NEXT: retq
+;
+; AVX512BW-LABEL: testv64i8u:
+; AVX512BW: ## BB#0:
+; AVX512BW-NEXT: vpxord %zmm1, %zmm1, %zmm1
+; AVX512BW-NEXT: vpsubb %zmm0, %zmm1, %zmm1
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512BW-NEXT: vpsubb {{.*}}(%rip), %zmm0, %zmm0
+; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
+; AVX512BW-NEXT: vmovdqu8 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
+; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
+; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
+; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
+; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
+; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
+; AVX512BW-NEXT: retq
%out = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %in, i1 -1)
ret <64 x i8> %out
}
More information about the llvm-commits
mailing list