1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl --show-mc-encoding | FileCheck %s --check-prefix=AVX512 --check-prefix=AVX512-KNL
3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=skx --show-mc-encoding | FileCheck %s --check-prefix=AVX512 --check-prefix=AVX512-SKX
4 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx --show-mc-encoding | FileCheck %s --check-prefix=AVX
6 define float @test_fdiv(float %a, float %b) {
7 ; AVX512-LABEL: test_fdiv:
9 ; AVX512-NEXT: vdivss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x5e,0xc1]
10 ; AVX512-NEXT: retq ## encoding: [0xc3]
12 ; AVX-LABEL: test_fdiv:
14 ; AVX-NEXT: vdivss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x5e,0xc1]
15 ; AVX-NEXT: retq ## encoding: [0xc3]
16 %c = fdiv float %a, %b
20 define float @test_fsub(float %a, float %b) {
21 ; AVX512-LABEL: test_fsub:
23 ; AVX512-NEXT: vsubss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x5c,0xc1]
24 ; AVX512-NEXT: retq ## encoding: [0xc3]
26 ; AVX-LABEL: test_fsub:
28 ; AVX-NEXT: vsubss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x5c,0xc1]
29 ; AVX-NEXT: retq ## encoding: [0xc3]
30 %c = fsub float %a, %b
34 define double @test_fadd(double %a, double %b) {
35 ; AVX512-LABEL: test_fadd:
37 ; AVX512-NEXT: vaddsd %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfb,0x58,0xc1]
38 ; AVX512-NEXT: retq ## encoding: [0xc3]
40 ; AVX-LABEL: test_fadd:
42 ; AVX-NEXT: vaddsd %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfb,0x58,0xc1]
43 ; AVX-NEXT: retq ## encoding: [0xc3]
44 %c = fadd double %a, %b
48 declare float @llvm.trunc.f32(float %Val)
49 declare double @llvm.trunc.f64(double %Val)
50 declare float @llvm.rint.f32(float %Val)
51 declare double @llvm.rint.f64(double %Val)
52 declare double @llvm.sqrt.f64(double %Val)
53 declare float @llvm.sqrt.f32(float %Val)
55 define float @test_trunc(float %a) {
56 ; AVX512-LABEL: test_trunc:
58 ; AVX512-NEXT: vroundss $11, %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x0a,0xc0,0x0b]
59 ; AVX512-NEXT: retq ## encoding: [0xc3]
61 ; AVX-LABEL: test_trunc:
63 ; AVX-NEXT: vroundss $11, %xmm0, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0a,0xc0,0x0b]
64 ; AVX-NEXT: retq ## encoding: [0xc3]
65 %c = call float @llvm.trunc.f32(float %a)
69 define double @test_sqrt(double %a) {
70 ; AVX512-LABEL: test_sqrt:
72 ; AVX512-NEXT: vsqrtsd %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfb,0x51,0xc0]
73 ; AVX512-NEXT: retq ## encoding: [0xc3]
75 ; AVX-LABEL: test_sqrt:
77 ; AVX-NEXT: vsqrtsd %xmm0, %xmm0, %xmm0 ## encoding: [0xc5,0xfb,0x51,0xc0]
78 ; AVX-NEXT: retq ## encoding: [0xc3]
79 %c = call double @llvm.sqrt.f64(double %a)
83 define float @test_rint(float %a) {
84 ; AVX512-LABEL: test_rint:
86 ; AVX512-NEXT: vroundss $4, %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x0a,0xc0,0x04]
87 ; AVX512-NEXT: retq ## encoding: [0xc3]
89 ; AVX-LABEL: test_rint:
91 ; AVX-NEXT: vroundss $4, %xmm0, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0a,0xc0,0x04]
92 ; AVX-NEXT: retq ## encoding: [0xc3]
93 %c = call float @llvm.rint.f32(float %a)
97 define float @test_vmax(float %i, float %j) {
98 ; AVX512-LABEL: test_vmax:
100 ; AVX512-NEXT: vmaxss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x5f,0xc1]
101 ; AVX512-NEXT: retq ## encoding: [0xc3]
103 ; AVX-LABEL: test_vmax:
105 ; AVX-NEXT: vmaxss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x5f,0xc1]
106 ; AVX-NEXT: retq ## encoding: [0xc3]
107 %cmp_res = fcmp ogt float %i, %j
108 %max = select i1 %cmp_res, float %i, float %j
112 define float @test_mov(float %a, float %b, float %i, float %j) {
113 ; AVX512-LABEL: test_mov:
115 ; AVX512-NEXT: vcmpltss %xmm2, %xmm3, %k1 ## encoding: [0x62,0xf1,0x66,0x08,0xc2,0xca,0x01]
116 ; AVX512-NEXT: vmovss %xmm1, %xmm0, %xmm0 {%k1} ## encoding: [0x62,0xf1,0x7e,0x09,0x10,0xc1]
117 ; AVX512-NEXT: retq ## encoding: [0xc3]
119 ; AVX-LABEL: test_mov:
121 ; AVX-NEXT: vcmpltss %xmm2, %xmm3, %xmm2 ## encoding: [0xc5,0xe2,0xc2,0xd2,0x01]
122 ; AVX-NEXT: vblendvps %xmm2, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x4a,0xc1,0x20]
123 ; AVX-NEXT: retq ## encoding: [0xc3]
124 %cmp_res = fcmp ogt float %i, %j
125 %max = select i1 %cmp_res, float %b, float %a
129 define float @zero_float(float %a) {
130 ; AVX512-KNL-LABEL: zero_float:
131 ; AVX512-KNL: ## %bb.0:
132 ; AVX512-KNL-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
133 ; AVX512-KNL-NEXT: vaddss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x58,0xc1]
134 ; AVX512-KNL-NEXT: retq ## encoding: [0xc3]
136 ; AVX512-SKX-LABEL: zero_float:
137 ; AVX512-SKX: ## %bb.0:
138 ; AVX512-SKX-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9]
139 ; AVX512-SKX-NEXT: vaddss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x58,0xc1]
140 ; AVX512-SKX-NEXT: retq ## encoding: [0xc3]
142 ; AVX-LABEL: zero_float:
144 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
145 ; AVX-NEXT: vaddss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x58,0xc1]
146 ; AVX-NEXT: retq ## encoding: [0xc3]
147 %b = fadd float %a, 0.0
151 define double @zero_double(double %a) {
152 ; AVX512-KNL-LABEL: zero_double:
153 ; AVX512-KNL: ## %bb.0:
154 ; AVX512-KNL-NEXT: vxorpd %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf1,0x57,0xc9]
155 ; AVX512-KNL-NEXT: vaddsd %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfb,0x58,0xc1]
156 ; AVX512-KNL-NEXT: retq ## encoding: [0xc3]
158 ; AVX512-SKX-LABEL: zero_double:
159 ; AVX512-SKX: ## %bb.0:
160 ; AVX512-SKX-NEXT: vxorpd %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf1,0x57,0xc9]
161 ; AVX512-SKX-NEXT: vaddsd %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfb,0x58,0xc1]
162 ; AVX512-SKX-NEXT: retq ## encoding: [0xc3]
164 ; AVX-LABEL: zero_double:
166 ; AVX-NEXT: vxorpd %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf1,0x57,0xc9]
167 ; AVX-NEXT: vaddsd %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfb,0x58,0xc1]
168 ; AVX-NEXT: retq ## encoding: [0xc3]
169 %b = fadd double %a, 0.0