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-prefix=AVX
3 ; RUN: llc -mtriple=i386-unknown-linux-gnu -mcpu=knl < %s | FileCheck %s --check-prefix=KNL-32
6 ; Verify that we don't crash during codegen due to a wrong lowering
7 ; of a setcc node with illegal operand types and return type.
9 define <8 x i16> @pr25080(<8 x i32> %a) {
11 ; AVX: # %bb.0: # %entry
12 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
13 ; AVX-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
14 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
15 ; AVX-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
16 ; AVX-NEXT: vpackssdw %xmm0, %xmm0, %xmm0
17 ; AVX-NEXT: vpor {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
18 ; AVX-NEXT: vzeroupper
21 ; KNL-32-LABEL: pr25080:
22 ; KNL-32: # %bb.0: # %entry
23 ; KNL-32-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
24 ; KNL-32-NEXT: vptestnmd {{\.?LCPI[0-9]+_[0-9]+}}{1to16}, %zmm0, %k0
25 ; KNL-32-NEXT: movb $15, %al
26 ; KNL-32-NEXT: kmovw %eax, %k1
27 ; KNL-32-NEXT: korw %k1, %k0, %k1
28 ; KNL-32-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
29 ; KNL-32-NEXT: vpmovdw %zmm0, %ymm0
30 ; KNL-32-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
33 %0 = trunc <8 x i32> %a to <8 x i23>
34 %1 = icmp eq <8 x i23> %0, zeroinitializer
35 %2 = or <8 x i1> %1, <i1 true, i1 true, i1 true, i1 true, i1 false, i1 false, i1 false, i1 false>
36 %3 = sext <8 x i1> %2 to <8 x i16>
40 define void @pr26232(i64 %a, <16 x i1> %b) {
42 ; AVX: # %bb.0: # %allocas
43 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
44 ; AVX-NEXT: .p2align 4, 0x90
45 ; AVX-NEXT: .LBB1_1: # %for_loop599
46 ; AVX-NEXT: # =>This Inner Loop Header: Depth=1
47 ; AVX-NEXT: cmpq $65536, %rdi # imm = 0x10000
49 ; AVX-NEXT: vmovd %eax, %xmm2
50 ; AVX-NEXT: vpshufb %xmm1, %xmm2, %xmm2
51 ; AVX-NEXT: vpand %xmm0, %xmm2, %xmm2
52 ; AVX-NEXT: vpsllw $7, %xmm2, %xmm2
53 ; AVX-NEXT: vpmovmskb %xmm2, %eax
54 ; AVX-NEXT: testl %eax, %eax
55 ; AVX-NEXT: jne .LBB1_1
56 ; AVX-NEXT: # %bb.2: # %for_exit600
59 ; KNL-32-LABEL: pr26232:
60 ; KNL-32: # %bb.0: # %allocas
61 ; KNL-32-NEXT: pushl %esi
62 ; KNL-32-NEXT: .cfi_def_cfa_offset 8
63 ; KNL-32-NEXT: .cfi_offset %esi, -8
64 ; KNL-32-NEXT: vpmovsxbd %xmm0, %zmm0
65 ; KNL-32-NEXT: vpslld $31, %zmm0, %zmm0
66 ; KNL-32-NEXT: vptestmd %zmm0, %zmm0, %k0
67 ; KNL-32-NEXT: movl {{[0-9]+}}(%esp), %eax
68 ; KNL-32-NEXT: movl {{[0-9]+}}(%esp), %ecx
69 ; KNL-32-NEXT: movl $65535, %edx # imm = 0xFFFF
70 ; KNL-32-NEXT: .p2align 4, 0x90
71 ; KNL-32-NEXT: .LBB1_1: # %for_loop599
72 ; KNL-32-NEXT: # =>This Inner Loop Header: Depth=1
73 ; KNL-32-NEXT: cmpl $65536, %ecx # imm = 0x10000
74 ; KNL-32-NEXT: movl %eax, %esi
75 ; KNL-32-NEXT: sbbl $0, %esi
76 ; KNL-32-NEXT: movl $0, %esi
77 ; KNL-32-NEXT: cmovll %edx, %esi
78 ; KNL-32-NEXT: kmovw %esi, %k1
79 ; KNL-32-NEXT: kandw %k0, %k1, %k1
80 ; KNL-32-NEXT: kortestw %k1, %k1
81 ; KNL-32-NEXT: jne .LBB1_1
82 ; KNL-32-NEXT: # %bb.2: # %for_exit600
83 ; KNL-32-NEXT: popl %esi
84 ; KNL-32-NEXT: .cfi_def_cfa_offset 4
87 br label %for_test11.preheader
89 for_test11.preheader: ; preds = %for_test11.preheader, %allocas
90 br i1 undef, label %for_loop599, label %for_test11.preheader
92 for_loop599: ; preds = %for_loop599, %for_test11.preheader
93 %less_i_load605_ = icmp slt i64 %a, 65536
94 %less_i_load605__broadcast_init = insertelement <16 x i1> undef, i1 %less_i_load605_, i32 0
95 %less_i_load605__broadcast = shufflevector <16 x i1> %less_i_load605__broadcast_init, <16 x i1> undef, <16 x i32> zeroinitializer
96 %"oldMask&test607" = and <16 x i1> %less_i_load605__broadcast, %b
97 %intmask.i894 = bitcast <16 x i1> %"oldMask&test607" to i16
98 %res.i895 = icmp eq i16 %intmask.i894, 0
99 br i1 %res.i895, label %for_exit600, label %for_loop599
101 for_exit600: ; preds = %for_loop599
105 define <4 x i32> @pcmpgt(<4 x i8> %x) {
108 ; AVX-NEXT: vpmovzxbd {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero
109 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
110 ; AVX-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
113 ; KNL-32-LABEL: pcmpgt:
115 ; KNL-32-NEXT: vpmovzxbd {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero
116 ; KNL-32-NEXT: vpxor %xmm1, %xmm1, %xmm1
117 ; KNL-32-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
119 %zext = zext <4 x i8> %x to <4 x i32>
120 %icmp = icmp ne <4 x i32> %zext, zeroinitializer
121 %sext = sext <4 x i1> %icmp to <4 x i32>