• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl  | FileCheck %s
2
3; CHECK-LABEL: select00
4; CHECK: vmovaps
5; CHECK-NEXT: LBB
6define <16 x i32> @select00(i32 %a, <16 x i32> %b) nounwind {
7  %cmpres = icmp eq i32 %a, 255
8  %selres = select i1 %cmpres, <16 x i32> zeroinitializer, <16 x i32> %b
9  %res = xor <16 x i32> %b, %selres
10  ret <16 x i32> %res
11}
12
13; CHECK-LABEL: select01
14; CHECK: vmovaps
15; CHECK-NEXT: LBB
16define <8 x i64> @select01(i32 %a, <8 x i64> %b) nounwind {
17  %cmpres = icmp eq i32 %a, 255
18  %selres = select i1 %cmpres, <8 x i64> zeroinitializer, <8 x i64> %b
19  %res = xor <8 x i64> %b, %selres
20  ret <8 x i64> %res
21}
22
23; CHECK-LABEL: @select02
24; CHECK: cmpless %xmm0, %xmm3, %k1
25; CHECK-NEXT: vmovss  %xmm2, {{.*}}%xmm1 {%k1}
26; CHECK: ret
27define float @select02(float %a, float %b, float %c, float %eps) {
28  %cmp = fcmp oge float %a, %eps
29  %cond = select i1 %cmp, float %c, float %b
30  ret float %cond
31}
32
33; CHECK-LABEL: @select03
34; CHECK: cmplesd %xmm0, %xmm3, %k1
35; CHECK-NEXT: vmovsd  %xmm2, {{.*}}%xmm1 {%k1}
36; CHECK: ret
37define double @select03(double %a, double %b, double %c, double %eps) {
38  %cmp = fcmp oge double %a, %eps
39  %cond = select i1 %cmp, double %c, double %b
40  ret double %cond
41}
42
43; CHECK-LABEL: @select04
44; CHECK: vmovaps %zmm3, %zmm1
45; CHECK-NEXT: ret
46; PR20677
47define <16 x double> @select04(<16 x double> %a, <16 x double> %b) {
48  %sel = select <16 x i1> <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false>, <16 x double> %a, <16 x double> %b
49  ret <16 x double> %sel
50}
51
52; CHECK-LABEL: select05
53; CHECK: kmovw   %esi, %k0
54; CHECK-NEXT: kmovw   %edi, %k1
55; CHECK-NEXT: korw    %k1, %k0, %k0
56; CHECK-NEXT: kmovw   %k0, %eax
57define i8 @select05(i8 %a.0, i8 %m) {
58  %mask = bitcast i8 %m to <8 x i1>
59  %a = bitcast i8 %a.0 to <8 x i1>
60  %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
61  %res = bitcast <8 x i1> %r to i8
62  ret i8 %res;
63}
64
65; CHECK-LABEL: select06
66; CHECK: kmovw   %esi, %k0
67; CHECK-NEXT: kmovw   %edi, %k1
68; CHECK-NEXT: kandw    %k1, %k0, %k0
69; CHECK-NEXT: kmovw   %k0, %eax
70define i8 @select06(i8 %a.0, i8 %m) {
71  %mask = bitcast i8 %m to <8 x i1>
72  %a = bitcast i8 %a.0 to <8 x i1>
73  %r = select <8 x i1> %mask, <8 x i1> %a, <8 x i1> zeroinitializer
74  %res = bitcast <8 x i1> %r to i8
75  ret i8 %res;
76}
77
78; CHECK-LABEL: select07
79; CHECK-DAG:  kmovw   %edx, %k0
80; CHECK-DAG:  kmovw   %edi, %k1
81; CHECK-DAG:  kmovw   %esi, %k2
82; CHECK: kandw %k0, %k1, %k1
83; CHECK-NEXT: knotw    %k0, %k0
84; CHECK-NEXT: kandw    %k0, %k2, %k0
85; CHECK-NEXT: korw %k0, %k1, %k0
86; CHECK-NEXT: kmovw   %k0, %eax
87define i8 @select07(i8 %a.0, i8 %b.0, i8 %m) {
88  %mask = bitcast i8 %m to <8 x i1>
89  %a = bitcast i8 %a.0 to <8 x i1>
90  %b = bitcast i8 %b.0 to <8 x i1>
91  %r = select <8 x i1> %mask, <8 x i1> %a, <8 x i1> %b
92  %res = bitcast <8 x i1> %r to i8
93  ret i8 %res;
94}
95