1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s --check-prefixes=AVX,AVX1
3 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx2 < %s | FileCheck %s --check-prefixes=AVX,AVX2
4 ; RUN: llc -mtriple=i386-unknown-linux-gnu -mcpu=knl < %s | FileCheck %s --check-prefixes=AVX,KNL-32
7 ; Verify that we don't crash during codegen due to a wrong lowering
8 ; of a setcc node with illegal operand types and return type.
10 define <8 x i16> @pr25080(<8 x i32> %a) {
11 ; AVX1-LABEL: pr25080:
12 ; AVX1: # %bb.0: # %entry
13 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
14 ; AVX1-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
15 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
16 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
17 ; AVX1-NEXT: vpackssdw %xmm0, %xmm0, %xmm0
18 ; AVX1-NEXT: vpor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
19 ; AVX1-NEXT: vzeroupper
22 ; AVX2-LABEL: pr25080:
23 ; AVX2: # %bb.0: # %entry
24 ; AVX2-NEXT: vpbroadcastd {{.*#+}} xmm1 = [8388607,8388607,8388607,8388607]
25 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm0
26 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
27 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
28 ; AVX2-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
29 ; AVX2-NEXT: vpackssdw %xmm0, %xmm0, %xmm0
30 ; AVX2-NEXT: vpor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
31 ; AVX2-NEXT: vzeroupper
34 ; KNL-32-LABEL: pr25080:
35 ; KNL-32: # %bb.0: # %entry
36 ; KNL-32-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
37 ; KNL-32-NEXT: vptestnmd {{\.?LCPI[0-9]+_[0-9]+}}{1to16}, %zmm0, %k0
38 ; KNL-32-NEXT: movb $15, %al
39 ; KNL-32-NEXT: kmovw %eax, %k1
40 ; KNL-32-NEXT: korw %k1, %k0, %k1
41 ; KNL-32-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
42 ; KNL-32-NEXT: vpmovdw %zmm0, %ymm0
43 ; KNL-32-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
46 %0 = trunc <8 x i32> %a to <8 x i23>
47 %1 = icmp eq <8 x i23> %0, zeroinitializer
48 %2 = or <8 x i1> %1, <i1 true, i1 true, i1 true, i1 true, i1 false, i1 false, i1 false, i1 false>
49 %3 = sext <8 x i1> %2 to <8 x i16>
53 define void @pr26232(i64 %a, <16 x i1> %b) {
54 ; AVX1-LABEL: pr26232:
55 ; AVX1: # %bb.0: # %allocas
56 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
57 ; AVX1-NEXT: .p2align 4, 0x90
58 ; AVX1-NEXT: .LBB1_1: # %for_loop599
59 ; AVX1-NEXT: # =>This Inner Loop Header: Depth=1
60 ; AVX1-NEXT: cmpq $65536, %rdi # imm = 0x10000
62 ; AVX1-NEXT: vmovd %eax, %xmm2
63 ; AVX1-NEXT: vpshufb %xmm1, %xmm2, %xmm2
64 ; AVX1-NEXT: vpand %xmm0, %xmm2, %xmm2
65 ; AVX1-NEXT: vpsllw $7, %xmm2, %xmm2
66 ; AVX1-NEXT: vpmovmskb %xmm2, %eax
67 ; AVX1-NEXT: testl %eax, %eax
68 ; AVX1-NEXT: jne .LBB1_1
69 ; AVX1-NEXT: # %bb.2: # %for_exit600
72 ; AVX2-LABEL: pr26232:
73 ; AVX2: # %bb.0: # %allocas
74 ; AVX2-NEXT: .p2align 4, 0x90
75 ; AVX2-NEXT: .LBB1_1: # %for_loop599
76 ; AVX2-NEXT: # =>This Inner Loop Header: Depth=1
77 ; AVX2-NEXT: cmpq $65536, %rdi # imm = 0x10000
79 ; AVX2-NEXT: vmovd %eax, %xmm1
80 ; AVX2-NEXT: vpbroadcastb %xmm1, %xmm1
81 ; AVX2-NEXT: vpand %xmm0, %xmm1, %xmm1
82 ; AVX2-NEXT: vpsllw $7, %xmm1, %xmm1
83 ; AVX2-NEXT: vpmovmskb %xmm1, %eax
84 ; AVX2-NEXT: testl %eax, %eax
85 ; AVX2-NEXT: jne .LBB1_1
86 ; AVX2-NEXT: # %bb.2: # %for_exit600
89 ; KNL-32-LABEL: pr26232:
90 ; KNL-32: # %bb.0: # %allocas
91 ; KNL-32-NEXT: pushl %esi
92 ; KNL-32-NEXT: .cfi_def_cfa_offset 8
93 ; KNL-32-NEXT: .cfi_offset %esi, -8
94 ; KNL-32-NEXT: vpmovsxbd %xmm0, %zmm0
95 ; KNL-32-NEXT: vpslld $31, %zmm0, %zmm0
96 ; KNL-32-NEXT: vptestmd %zmm0, %zmm0, %k0
97 ; KNL-32-NEXT: movl {{[0-9]+}}(%esp), %eax
98 ; KNL-32-NEXT: movl {{[0-9]+}}(%esp), %ecx
99 ; KNL-32-NEXT: movl $65535, %edx # imm = 0xFFFF
100 ; KNL-32-NEXT: .p2align 4, 0x90
101 ; KNL-32-NEXT: .LBB1_1: # %for_loop599
102 ; KNL-32-NEXT: # =>This Inner Loop Header: Depth=1
103 ; KNL-32-NEXT: cmpl $65536, %ecx # imm = 0x10000
104 ; KNL-32-NEXT: movl %eax, %esi
105 ; KNL-32-NEXT: sbbl $0, %esi
106 ; KNL-32-NEXT: movl $0, %esi
107 ; KNL-32-NEXT: cmovll %edx, %esi
108 ; KNL-32-NEXT: kmovw %esi, %k1
109 ; KNL-32-NEXT: kandw %k0, %k1, %k1
110 ; KNL-32-NEXT: kortestw %k1, %k1
111 ; KNL-32-NEXT: jne .LBB1_1
112 ; KNL-32-NEXT: # %bb.2: # %for_exit600
113 ; KNL-32-NEXT: popl %esi
114 ; KNL-32-NEXT: .cfi_def_cfa_offset 4
117 br label %for_test11.preheader
119 for_test11.preheader: ; preds = %for_test11.preheader, %allocas
120 br i1 undef, label %for_loop599, label %for_test11.preheader
122 for_loop599: ; preds = %for_loop599, %for_test11.preheader
123 %less_i_load605_ = icmp slt i64 %a, 65536
124 %less_i_load605__broadcast_init = insertelement <16 x i1> undef, i1 %less_i_load605_, i32 0
125 %less_i_load605__broadcast = shufflevector <16 x i1> %less_i_load605__broadcast_init, <16 x i1> undef, <16 x i32> zeroinitializer
126 %"oldMask&test607" = and <16 x i1> %less_i_load605__broadcast, %b
127 %intmask.i894 = bitcast <16 x i1> %"oldMask&test607" to i16
128 %res.i895 = icmp eq i16 %intmask.i894, 0
129 br i1 %res.i895, label %for_exit600, label %for_loop599
131 for_exit600: ; preds = %for_loop599
135 define <4 x i32> @pcmpgt(<4 x i8> %x) {
138 ; AVX-NEXT: vpmovzxbd {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero
139 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
140 ; AVX-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
141 ; AVX-NEXT: ret{{[l|q]}}
142 %zext = zext <4 x i8> %x to <4 x i32>
143 %icmp = icmp ne <4 x i32> %zext, zeroinitializer
144 %sext = sext <4 x i1> %icmp to <4 x i32>