1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck %s --check-prefix=KNL
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=skx | FileCheck %s --check-prefix=SKX
3 ; RUN: llc < %s -mtriple=i686-apple-darwin -mcpu=knl | FileCheck %s --check-prefix=KNL_X32
7 define <16 x i1> @test1() {
8 ret <16 x i1> zeroinitializer
21 define <16 x i1> @test2(<16 x i1>%a, <16 x i1>%b) {
22 %c = and <16 x i1>%a, %b
31 define <8 x i1> @test3(<8 x i1>%a, <8 x i1>%b) {
32 %c = and <8 x i1>%a, %b
41 define <4 x i1> @test4(<4 x i1>%a, <4 x i1>%b) {
42 %c = and <4 x i1>%a, %b
51 declare <8 x i1> @func8xi1(<8 x i1> %a)
52 define <8 x i32> @test5(<8 x i32>%a, <8 x i32>%b) {
53 %cmpRes = icmp sgt <8 x i32>%a, %b
54 %resi = call <8 x i1> @func8xi1(<8 x i1> %cmpRes)
55 %res = sext <8 x i1>%resi to <8 x i32>
59 declare <16 x i1> @func16xi1(<16 x i1> %a)
66 ; KNL: vpslld $31, %zmm
67 ; KNL: vpsrad $31, %zmm
68 define <16 x i32> @test6(<16 x i32>%a, <16 x i32>%b) {
69 %cmpRes = icmp sgt <16 x i32>%a, %b
70 %resi = call <16 x i1> @func16xi1(<16 x i1> %cmpRes)
71 %res = sext <16 x i1>%resi to <16 x i32>
75 declare <4 x i1> @func4xi1(<4 x i1> %a)
79 ; SKX: vpslld $31, %xmm
80 ; SKX: vpsrad $31, %xmm
82 define <4 x i32> @test7(<4 x i32>%a, <4 x i32>%b) {
83 %cmpRes = icmp sgt <4 x i32>%a, %b
84 %resi = call <4 x i1> @func4xi1(<4 x i1> %cmpRes)
85 %res = sext <4 x i1>%resi to <4 x i32>
91 ; SKX: vpmovw2m %xmm0, %k0
93 define <8 x i1> @test7a(<8 x i32>%a, <8 x i32>%b) {
94 %cmpRes = icmp sgt <8 x i32>%a, %b
95 %resi = call <8 x i1> @func8xi1(<8 x i1> %cmpRes)
96 %res = and <8 x i1>%resi, <i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false>
101 ; KNL_X32-LABEL: test8
102 ; KNL_X32: testb $1, 4(%esp)
106 ; KNL: testb $1, %dil
109 define <16 x i8> @test8(<16 x i8> %a1, <16 x i8> %a2, i1 %cond) {
110 %res = select i1 %cond, <16 x i8> %a1, <16 x i8> %a2
117 define i1 @test9(double %a, double %b) {
118 %c = fcmp ugt double %a, %b
122 ; KNL_X32-LABEL: test10
123 ; KNL_X32: testb $1, 12(%esp)
129 define i32 @test10(i32 %a, i32 %b, i1 %cond) {
130 %c = select i1 %cond, i32 %a, i32 %b
137 define i1 @test11(i32 %a, i32 %b) {
138 %c = icmp sgt i32 %a, %b
144 ;; return value in %al
145 ; KNL: movzbl %al, %ebx
149 define i32 @test12(i32 %a1, i32 %a2, i32 %b1) {
150 %cond = call i1 @test11(i32 %a1, i32 %b1)
151 %res = call i32 @test10(i32 %a1, i32 %a2, i1 %cond)
152 %res1 = select i1 %cond, i32 %res, i32 0