1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck %s
4 define <4 x float> @select_mask_add_ss(<4 x float> %w, i8 zeroext %u, <4 x float> %a, <4 x float> %b) {
5 ; CHECK-LABEL: select_mask_add_ss:
6 ; CHECK: ## %bb.0: ## %entry
7 ; CHECK-NEXT: kmovw %edi, %k1
8 ; CHECK-NEXT: vaddss %xmm2, %xmm1, %xmm0 {%k1}
11 %0 = extractelement <4 x float> %b, i32 0
12 %1 = extractelement <4 x float> %a, i32 0
13 %2 = fadd float %1, %0
16 %5 = extractelement <4 x float> %w, i32 0
17 %6 = select i1 %4, float %5, float %2
18 %7 = insertelement <4 x float> %a, float %6, i32 0
22 define <4 x float> @select_maskz_add_ss(i8 zeroext %u, <4 x float> %a, <4 x float> %b) {
23 ; CHECK-LABEL: select_maskz_add_ss:
24 ; CHECK: ## %bb.0: ## %entry
25 ; CHECK-NEXT: kmovw %edi, %k1
26 ; CHECK-NEXT: vaddss %xmm1, %xmm0, %xmm0 {%k1} {z}
29 %0 = extractelement <4 x float> %b, i32 0
30 %1 = extractelement <4 x float> %a, i32 0
31 %2 = fadd float %1, %0
34 %5 = select i1 %4, float 0.000000e+00, float %2
35 %6 = insertelement <4 x float> %a, float %5, i32 0
39 define <4 x float> @select_mask_sub_ss(<4 x float> %w, i8 zeroext %u, <4 x float> %a, <4 x float> %b) {
40 ; CHECK-LABEL: select_mask_sub_ss:
41 ; CHECK: ## %bb.0: ## %entry
42 ; CHECK-NEXT: kmovw %edi, %k1
43 ; CHECK-NEXT: vsubss %xmm2, %xmm1, %xmm0 {%k1}
46 %0 = extractelement <4 x float> %b, i32 0
47 %1 = extractelement <4 x float> %a, i32 0
48 %2 = fsub float %1, %0
51 %5 = extractelement <4 x float> %w, i32 0
52 %6 = select i1 %4, float %5, float %2
53 %7 = insertelement <4 x float> %a, float %6, i32 0
57 define <4 x float> @select_maskz_sub_ss(i8 zeroext %u, <4 x float> %a, <4 x float> %b) {
58 ; CHECK-LABEL: select_maskz_sub_ss:
59 ; CHECK: ## %bb.0: ## %entry
60 ; CHECK-NEXT: kmovw %edi, %k1
61 ; CHECK-NEXT: vsubss %xmm1, %xmm0, %xmm0 {%k1} {z}
64 %0 = extractelement <4 x float> %b, i32 0
65 %1 = extractelement <4 x float> %a, i32 0
66 %2 = fsub float %1, %0
69 %5 = select i1 %4, float 0.000000e+00, float %2
70 %6 = insertelement <4 x float> %a, float %5, i32 0
74 define <4 x float> @select_mask_mul_ss(<4 x float> %w, i8 zeroext %u, <4 x float> %a, <4 x float> %b) {
75 ; CHECK-LABEL: select_mask_mul_ss:
76 ; CHECK: ## %bb.0: ## %entry
77 ; CHECK-NEXT: kmovw %edi, %k1
78 ; CHECK-NEXT: vmulss %xmm2, %xmm1, %xmm0 {%k1}
81 %0 = extractelement <4 x float> %b, i32 0
82 %1 = extractelement <4 x float> %a, i32 0
83 %2 = fmul float %1, %0
86 %5 = extractelement <4 x float> %w, i32 0
87 %6 = select i1 %4, float %5, float %2
88 %7 = insertelement <4 x float> %a, float %6, i32 0
92 define <4 x float> @select_maskz_mul_ss(i8 zeroext %u, <4 x float> %a, <4 x float> %b) {
93 ; CHECK-LABEL: select_maskz_mul_ss:
94 ; CHECK: ## %bb.0: ## %entry
95 ; CHECK-NEXT: kmovw %edi, %k1
96 ; CHECK-NEXT: vmulss %xmm1, %xmm0, %xmm0 {%k1} {z}
99 %0 = extractelement <4 x float> %b, i32 0
100 %1 = extractelement <4 x float> %a, i32 0
101 %2 = fmul float %1, %0
103 %4 = icmp eq i8 %3, 0
104 %5 = select i1 %4, float 0.000000e+00, float %2
105 %6 = insertelement <4 x float> %a, float %5, i32 0
109 ; Make sure we don't crash trying to truncate the and instruction i4->i8. We need to extend instead.
110 define <4 x float> @select_mask_add_ss_small_mask_type(<4 x float> %w, i4 %u, <4 x float> %a, <4 x float> %b) {
111 ; CHECK-LABEL: select_mask_add_ss_small_mask_type:
112 ; CHECK: ## %bb.0: ## %entry
113 ; CHECK-NEXT: kmovw %edi, %k1
114 ; CHECK-NEXT: vaddss %xmm2, %xmm1, %xmm0 {%k1}
117 %0 = extractelement <4 x float> %b, i32 0
118 %1 = extractelement <4 x float> %a, i32 0
119 %2 = fadd float %1, %0
121 %4 = icmp eq i4 %3, 0
122 %5 = extractelement <4 x float> %w, i32 0
123 %6 = select i1 %4, float %5, float %2
124 %7 = insertelement <4 x float> %a, float %6, i32 0