[X86] Add avx512bw command lines to avx512-select.ll

Prep for fixing PR42355 and ensuring we have coverage of
ISD::SELECT for v64i8/v32i16 on KNL and SKX configs.

llvm-svn: 364092
This commit is contained in:
Craig Topper 2019-06-21 18:49:42 +00:00
parent aa14b9b4c2
commit 21c023850f

View File

@ -1,6 +1,8 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-unknown-unknown -mcpu=knl | FileCheck %s --check-prefix=X86
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=knl | FileCheck %s --check-prefix=X64
; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=avx512f | FileCheck %s --check-prefixes=X86,X86-AVX512F
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512f | FileCheck %s --check-prefixes=X64,X64-AVX512F
; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=avx512bw | FileCheck %s --check-prefixes=X86,X86-AVX512BW
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512bw | FileCheck %s --check-prefixes=X64,X64-AVX512BW
define <16 x i32> @select00(i32 %a, <16 x i32> %b) nounwind {
; X86-LABEL: select00:
@ -147,25 +149,45 @@ define i8 @select05(i8 %a.0, i8 %m) {
}
define i8 @select05_mem(<8 x i1>* %a.0, <8 x i1>* %m) {
; X86-LABEL: select05_mem:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: kmovw (%ecx), %k0
; X86-NEXT: kmovw (%eax), %k1
; X86-NEXT: korw %k1, %k0, %k0
; X86-NEXT: kmovw %k0, %eax
; X86-NEXT: # kill: def $al killed $al killed $eax
; X86-NEXT: retl
; X86-AVX512F-LABEL: select05_mem:
; X86-AVX512F: # %bb.0:
; X86-AVX512F-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-AVX512F-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-AVX512F-NEXT: kmovw (%ecx), %k0
; X86-AVX512F-NEXT: kmovw (%eax), %k1
; X86-AVX512F-NEXT: korw %k1, %k0, %k0
; X86-AVX512F-NEXT: kmovw %k0, %eax
; X86-AVX512F-NEXT: # kill: def $al killed $al killed $eax
; X86-AVX512F-NEXT: retl
;
; X64-LABEL: select05_mem:
; X64: # %bb.0:
; X64-NEXT: kmovw (%rsi), %k0
; X64-NEXT: kmovw (%rdi), %k1
; X64-NEXT: korw %k1, %k0, %k0
; X64-NEXT: kmovw %k0, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
; X64-AVX512F-LABEL: select05_mem:
; X64-AVX512F: # %bb.0:
; X64-AVX512F-NEXT: kmovw (%rsi), %k0
; X64-AVX512F-NEXT: kmovw (%rdi), %k1
; X64-AVX512F-NEXT: korw %k1, %k0, %k0
; X64-AVX512F-NEXT: kmovw %k0, %eax
; X64-AVX512F-NEXT: # kill: def $al killed $al killed $eax
; X64-AVX512F-NEXT: retq
;
; X86-AVX512BW-LABEL: select05_mem:
; X86-AVX512BW: # %bb.0:
; X86-AVX512BW-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-AVX512BW-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-AVX512BW-NEXT: kmovw (%ecx), %k0
; X86-AVX512BW-NEXT: kmovw (%eax), %k1
; X86-AVX512BW-NEXT: korw %k1, %k0, %k0
; X86-AVX512BW-NEXT: kmovd %k0, %eax
; X86-AVX512BW-NEXT: # kill: def $al killed $al killed $eax
; X86-AVX512BW-NEXT: retl
;
; X64-AVX512BW-LABEL: select05_mem:
; X64-AVX512BW: # %bb.0:
; X64-AVX512BW-NEXT: kmovw (%rsi), %k0
; X64-AVX512BW-NEXT: kmovw (%rdi), %k1
; X64-AVX512BW-NEXT: korw %k1, %k0, %k0
; X64-AVX512BW-NEXT: kmovd %k0, %eax
; X64-AVX512BW-NEXT: # kill: def $al killed $al killed $eax
; X64-AVX512BW-NEXT: retq
%mask = load <8 x i1> , <8 x i1>* %m
%a = load <8 x i1> , <8 x i1>* %a.0
%r = select <8 x i1> %mask, <8 x i1> <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>, <8 x i1> %a
@ -194,25 +216,45 @@ define i8 @select06(i8 %a.0, i8 %m) {
}
define i8 @select06_mem(<8 x i1>* %a.0, <8 x i1>* %m) {
; X86-LABEL: select06_mem:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: kmovw (%ecx), %k0
; X86-NEXT: kmovw (%eax), %k1
; X86-NEXT: kandw %k1, %k0, %k0
; X86-NEXT: kmovw %k0, %eax
; X86-NEXT: # kill: def $al killed $al killed $eax
; X86-NEXT: retl
; X86-AVX512F-LABEL: select06_mem:
; X86-AVX512F: # %bb.0:
; X86-AVX512F-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-AVX512F-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-AVX512F-NEXT: kmovw (%ecx), %k0
; X86-AVX512F-NEXT: kmovw (%eax), %k1
; X86-AVX512F-NEXT: kandw %k1, %k0, %k0
; X86-AVX512F-NEXT: kmovw %k0, %eax
; X86-AVX512F-NEXT: # kill: def $al killed $al killed $eax
; X86-AVX512F-NEXT: retl
;
; X64-LABEL: select06_mem:
; X64: # %bb.0:
; X64-NEXT: kmovw (%rsi), %k0
; X64-NEXT: kmovw (%rdi), %k1
; X64-NEXT: kandw %k1, %k0, %k0
; X64-NEXT: kmovw %k0, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
; X64-AVX512F-LABEL: select06_mem:
; X64-AVX512F: # %bb.0:
; X64-AVX512F-NEXT: kmovw (%rsi), %k0
; X64-AVX512F-NEXT: kmovw (%rdi), %k1
; X64-AVX512F-NEXT: kandw %k1, %k0, %k0
; X64-AVX512F-NEXT: kmovw %k0, %eax
; X64-AVX512F-NEXT: # kill: def $al killed $al killed $eax
; X64-AVX512F-NEXT: retq
;
; X86-AVX512BW-LABEL: select06_mem:
; X86-AVX512BW: # %bb.0:
; X86-AVX512BW-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-AVX512BW-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-AVX512BW-NEXT: kmovw (%ecx), %k0
; X86-AVX512BW-NEXT: kmovw (%eax), %k1
; X86-AVX512BW-NEXT: kandw %k1, %k0, %k0
; X86-AVX512BW-NEXT: kmovd %k0, %eax
; X86-AVX512BW-NEXT: # kill: def $al killed $al killed $eax
; X86-AVX512BW-NEXT: retl
;
; X64-AVX512BW-LABEL: select06_mem:
; X64-AVX512BW: # %bb.0:
; X64-AVX512BW-NEXT: kmovw (%rsi), %k0
; X64-AVX512BW-NEXT: kmovw (%rdi), %k1
; X64-AVX512BW-NEXT: kandw %k1, %k0, %k0
; X64-AVX512BW-NEXT: kmovd %k0, %eax
; X64-AVX512BW-NEXT: # kill: def $al killed $al killed $eax
; X64-AVX512BW-NEXT: retq
%mask = load <8 x i1> , <8 x i1>* %m
%a = load <8 x i1> , <8 x i1>* %a.0
%r = select <8 x i1> %mask, <8 x i1> %a, <8 x i1> zeroinitializer
@ -220,32 +262,59 @@ define i8 @select06_mem(<8 x i1>* %a.0, <8 x i1>* %m) {
ret i8 %res;
}
define i8 @select07(i8 %a.0, i8 %b.0, i8 %m) {
; X86-LABEL: select07:
; X86: # %bb.0:
; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: kmovw %eax, %k0
; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: kmovw %eax, %k1
; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: kmovw %eax, %k2
; X86-NEXT: kandnw %k2, %k0, %k2
; X86-NEXT: kandw %k0, %k1, %k0
; X86-NEXT: korw %k2, %k0, %k0
; X86-NEXT: kmovw %k0, %eax
; X86-NEXT: # kill: def $al killed $al killed $eax
; X86-NEXT: retl
; X86-AVX512F-LABEL: select07:
; X86-AVX512F: # %bb.0:
; X86-AVX512F-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-AVX512F-NEXT: kmovw %eax, %k0
; X86-AVX512F-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-AVX512F-NEXT: kmovw %eax, %k1
; X86-AVX512F-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-AVX512F-NEXT: kmovw %eax, %k2
; X86-AVX512F-NEXT: kandnw %k2, %k0, %k2
; X86-AVX512F-NEXT: kandw %k0, %k1, %k0
; X86-AVX512F-NEXT: korw %k2, %k0, %k0
; X86-AVX512F-NEXT: kmovw %k0, %eax
; X86-AVX512F-NEXT: # kill: def $al killed $al killed $eax
; X86-AVX512F-NEXT: retl
;
; X64-LABEL: select07:
; X64: # %bb.0:
; X64-NEXT: kmovw %edx, %k0
; X64-NEXT: kmovw %edi, %k1
; X64-NEXT: kmovw %esi, %k2
; X64-NEXT: kandnw %k2, %k0, %k2
; X64-NEXT: kandw %k0, %k1, %k0
; X64-NEXT: korw %k2, %k0, %k0
; X64-NEXT: kmovw %k0, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
; X64-AVX512F-LABEL: select07:
; X64-AVX512F: # %bb.0:
; X64-AVX512F-NEXT: kmovw %edx, %k0
; X64-AVX512F-NEXT: kmovw %edi, %k1
; X64-AVX512F-NEXT: kmovw %esi, %k2
; X64-AVX512F-NEXT: kandnw %k2, %k0, %k2
; X64-AVX512F-NEXT: kandw %k0, %k1, %k0
; X64-AVX512F-NEXT: korw %k2, %k0, %k0
; X64-AVX512F-NEXT: kmovw %k0, %eax
; X64-AVX512F-NEXT: # kill: def $al killed $al killed $eax
; X64-AVX512F-NEXT: retq
;
; X86-AVX512BW-LABEL: select07:
; X86-AVX512BW: # %bb.0:
; X86-AVX512BW-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-AVX512BW-NEXT: kmovd %eax, %k0
; X86-AVX512BW-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-AVX512BW-NEXT: kmovd %eax, %k1
; X86-AVX512BW-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-AVX512BW-NEXT: kmovd %eax, %k2
; X86-AVX512BW-NEXT: kandnw %k2, %k0, %k2
; X86-AVX512BW-NEXT: kandw %k0, %k1, %k0
; X86-AVX512BW-NEXT: korw %k2, %k0, %k0
; X86-AVX512BW-NEXT: kmovd %k0, %eax
; X86-AVX512BW-NEXT: # kill: def $al killed $al killed $eax
; X86-AVX512BW-NEXT: retl
;
; X64-AVX512BW-LABEL: select07:
; X64-AVX512BW: # %bb.0:
; X64-AVX512BW-NEXT: kmovd %edx, %k0
; X64-AVX512BW-NEXT: kmovd %edi, %k1
; X64-AVX512BW-NEXT: kmovd %esi, %k2
; X64-AVX512BW-NEXT: kandnw %k2, %k0, %k2
; X64-AVX512BW-NEXT: kandw %k0, %k1, %k0
; X64-AVX512BW-NEXT: korw %k2, %k0, %k0
; X64-AVX512BW-NEXT: kmovd %k0, %eax
; X64-AVX512BW-NEXT: # kill: def $al killed $al killed $eax
; X64-AVX512BW-NEXT: retq
%mask = bitcast i8 %m to <8 x i1>
%a = bitcast i8 %a.0 to <8 x i1>
%b = bitcast i8 %b.0 to <8 x i1>
@ -279,11 +348,17 @@ define double @pr30561_f64(double %b, double %a, i1 %c) {
; X86-NEXT: fldl (%ecx)
; X86-NEXT: retl
;
; X64-LABEL: pr30561_f64:
; X64: # %bb.0:
; X64-NEXT: kmovw %edi, %k1
; X64-NEXT: vmovsd %xmm1, %xmm0, %xmm0 {%k1}
; X64-NEXT: retq
; X64-AVX512F-LABEL: pr30561_f64:
; X64-AVX512F: # %bb.0:
; X64-AVX512F-NEXT: kmovw %edi, %k1
; X64-AVX512F-NEXT: vmovsd %xmm1, %xmm0, %xmm0 {%k1}
; X64-AVX512F-NEXT: retq
;
; X64-AVX512BW-LABEL: pr30561_f64:
; X64-AVX512BW: # %bb.0:
; X64-AVX512BW-NEXT: kmovd %edi, %k1
; X64-AVX512BW-NEXT: vmovsd %xmm1, %xmm0, %xmm0 {%k1}
; X64-AVX512BW-NEXT: retq
%cond = select i1 %c, double %a, double %b
ret double %cond
}
@ -298,33 +373,61 @@ define float @pr30561_f32(float %b, float %a, i1 %c) {
; X86-NEXT: flds (%ecx)
; X86-NEXT: retl
;
; X64-LABEL: pr30561_f32:
; X64: # %bb.0:
; X64-NEXT: kmovw %edi, %k1
; X64-NEXT: vmovss %xmm1, %xmm0, %xmm0 {%k1}
; X64-NEXT: retq
; X64-AVX512F-LABEL: pr30561_f32:
; X64-AVX512F: # %bb.0:
; X64-AVX512F-NEXT: kmovw %edi, %k1
; X64-AVX512F-NEXT: vmovss %xmm1, %xmm0, %xmm0 {%k1}
; X64-AVX512F-NEXT: retq
;
; X64-AVX512BW-LABEL: pr30561_f32:
; X64-AVX512BW: # %bb.0:
; X64-AVX512BW-NEXT: kmovd %edi, %k1
; X64-AVX512BW-NEXT: vmovss %xmm1, %xmm0, %xmm0 {%k1}
; X64-AVX512BW-NEXT: retq
%cond = select i1 %c, float %a, float %b
ret float %cond
}
define <16 x i16> @pr31515(<16 x i1> %a, <16 x i1> %b, <16 x i16> %c) nounwind {
; X86-LABEL: pr31515:
; X86: # %bb.0:
; X86-NEXT: vpand %xmm1, %xmm0, %xmm0
; X86-NEXT: vpmovzxbw {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero,xmm0[8],zero,xmm0[9],zero,xmm0[10],zero,xmm0[11],zero,xmm0[12],zero,xmm0[13],zero,xmm0[14],zero,xmm0[15],zero
; X86-NEXT: vpsllw $15, %ymm0, %ymm0
; X86-NEXT: vpsraw $15, %ymm0, %ymm0
; X86-NEXT: vpandn %ymm2, %ymm0, %ymm0
; X86-NEXT: retl
; X86-AVX512F-LABEL: pr31515:
; X86-AVX512F: # %bb.0:
; X86-AVX512F-NEXT: vpand %xmm1, %xmm0, %xmm0
; X86-AVX512F-NEXT: vpmovzxbw {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero,xmm0[8],zero,xmm0[9],zero,xmm0[10],zero,xmm0[11],zero,xmm0[12],zero,xmm0[13],zero,xmm0[14],zero,xmm0[15],zero
; X86-AVX512F-NEXT: vpsllw $15, %ymm0, %ymm0
; X86-AVX512F-NEXT: vpsraw $15, %ymm0, %ymm0
; X86-AVX512F-NEXT: vpandn %ymm2, %ymm0, %ymm0
; X86-AVX512F-NEXT: retl
;
; X64-LABEL: pr31515:
; X64: # %bb.0:
; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
; X64-NEXT: vpmovzxbw {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero,xmm0[8],zero,xmm0[9],zero,xmm0[10],zero,xmm0[11],zero,xmm0[12],zero,xmm0[13],zero,xmm0[14],zero,xmm0[15],zero
; X64-NEXT: vpsllw $15, %ymm0, %ymm0
; X64-NEXT: vpsraw $15, %ymm0, %ymm0
; X64-NEXT: vpandn %ymm2, %ymm0, %ymm0
; X64-NEXT: retq
; X64-AVX512F-LABEL: pr31515:
; X64-AVX512F: # %bb.0:
; X64-AVX512F-NEXT: vpand %xmm1, %xmm0, %xmm0
; X64-AVX512F-NEXT: vpmovzxbw {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero,xmm0[8],zero,xmm0[9],zero,xmm0[10],zero,xmm0[11],zero,xmm0[12],zero,xmm0[13],zero,xmm0[14],zero,xmm0[15],zero
; X64-AVX512F-NEXT: vpsllw $15, %ymm0, %ymm0
; X64-AVX512F-NEXT: vpsraw $15, %ymm0, %ymm0
; X64-AVX512F-NEXT: vpandn %ymm2, %ymm0, %ymm0
; X64-AVX512F-NEXT: retq
;
; X86-AVX512BW-LABEL: pr31515:
; X86-AVX512BW: # %bb.0:
; X86-AVX512BW-NEXT: # kill: def $ymm2 killed $ymm2 def $zmm2
; X86-AVX512BW-NEXT: vpand %xmm1, %xmm0, %xmm0
; X86-AVX512BW-NEXT: vpsllw $7, %xmm0, %xmm0
; X86-AVX512BW-NEXT: vpmovb2m %zmm0, %k0
; X86-AVX512BW-NEXT: knotw %k0, %k1
; X86-AVX512BW-NEXT: vmovdqu16 %zmm2, %zmm0 {%k1} {z}
; X86-AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
; X86-AVX512BW-NEXT: retl
;
; X64-AVX512BW-LABEL: pr31515:
; X64-AVX512BW: # %bb.0:
; X64-AVX512BW-NEXT: # kill: def $ymm2 killed $ymm2 def $zmm2
; X64-AVX512BW-NEXT: vpand %xmm1, %xmm0, %xmm0
; X64-AVX512BW-NEXT: vpsllw $7, %xmm0, %xmm0
; X64-AVX512BW-NEXT: vpmovb2m %zmm0, %k0
; X64-AVX512BW-NEXT: knotw %k0, %k1
; X64-AVX512BW-NEXT: vmovdqu16 %zmm2, %zmm0 {%k1} {z}
; X64-AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0
; X64-AVX512BW-NEXT: retq
%mask = and <16 x i1> %a, %b
%res = select <16 x i1> %mask, <16 x i16> zeroinitializer, <16 x i16> %c
ret <16 x i16> %res