1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +fma4 -emit-llvm -o - -Werror | FileCheck %s
2
3// Don't include mm_malloc.h, it's system specific.
4#define __MM_MALLOC_H
5
6#include <x86intrin.h>
7
8__m128 test_mm_macc_ps(__m128 a, __m128 b, __m128 c) {
9  // CHECK-LABEL: test_mm_macc_ps
10  // CHECK: @llvm.x86.fma.vfmadd.ps
11  return _mm_macc_ps(a, b, c);
12}
13
14__m128d test_mm_macc_pd(__m128d a, __m128d b, __m128d c) {
15  // CHECK-LABEL: test_mm_macc_pd
16  // CHECK: @llvm.x86.fma.vfmadd.pd
17  return _mm_macc_pd(a, b, c);
18}
19
20__m128 test_mm_macc_ss(__m128 a, __m128 b, __m128 c) {
21  // CHECK-LABEL: test_mm_macc_ss
22  // CHECK: @llvm.x86.fma.vfmadd.ss
23  return _mm_macc_ss(a, b, c);
24}
25
26__m128d test_mm_macc_sd(__m128d a, __m128d b, __m128d c) {
27  // CHECK-LABEL: test_mm_macc_sd
28  // CHECK: @llvm.x86.fma.vfmadd.sd
29  return _mm_macc_sd(a, b, c);
30}
31
32__m128 test_mm_msub_ps(__m128 a, __m128 b, __m128 c) {
33  // CHECK-LABEL: test_mm_msub_ps
34  // CHECK: @llvm.x86.fma.vfmsub.ps
35  return _mm_msub_ps(a, b, c);
36}
37
38__m128d test_mm_msub_pd(__m128d a, __m128d b, __m128d c) {
39  // CHECK-LABEL: test_mm_msub_pd
40  // CHECK: @llvm.x86.fma.vfmsub.pd
41  return _mm_msub_pd(a, b, c);
42}
43
44__m128 test_mm_msub_ss(__m128 a, __m128 b, __m128 c) {
45  // CHECK-LABEL: test_mm_msub_ss
46  // CHECK: @llvm.x86.fma.vfmsub.ss
47  return _mm_msub_ss(a, b, c);
48}
49
50__m128d test_mm_msub_sd(__m128d a, __m128d b, __m128d c) {
51  // CHECK-LABEL: test_mm_msub_sd
52  // CHECK: @llvm.x86.fma.vfmsub.sd
53  return _mm_msub_sd(a, b, c);
54}
55
56__m128 test_mm_nmacc_ps(__m128 a, __m128 b, __m128 c) {
57  // CHECK-LABEL: test_mm_nmacc_ps
58  // CHECK: @llvm.x86.fma.vfnmadd.ps
59  return _mm_nmacc_ps(a, b, c);
60}
61
62__m128d test_mm_nmacc_pd(__m128d a, __m128d b, __m128d c) {
63  // CHECK-LABEL: test_mm_nmacc_pd
64  // CHECK: @llvm.x86.fma.vfnmadd.pd
65  return _mm_nmacc_pd(a, b, c);
66}
67
68__m128 test_mm_nmacc_ss(__m128 a, __m128 b, __m128 c) {
69  // CHECK-LABEL: test_mm_nmacc_ss
70  // CHECK: @llvm.x86.fma.vfnmadd.ss
71  return _mm_nmacc_ss(a, b, c);
72}
73
74__m128d test_mm_nmacc_sd(__m128d a, __m128d b, __m128d c) {
75  // CHECK-LABEL: test_mm_nmacc_sd
76  // CHECK: @llvm.x86.fma.vfnmadd.sd
77  return _mm_nmacc_sd(a, b, c);
78}
79
80__m128 test_mm_nmsub_ps(__m128 a, __m128 b, __m128 c) {
81  // CHECK-LABEL: test_mm_nmsub_ps
82  // CHECK: @llvm.x86.fma.vfnmsub.ps
83  return _mm_nmsub_ps(a, b, c);
84}
85
86__m128d test_mm_nmsub_pd(__m128d a, __m128d b, __m128d c) {
87  // CHECK-LABEL: test_mm_nmsub_pd
88  // CHECK: @llvm.x86.fma.vfnmsub.pd
89  return _mm_nmsub_pd(a, b, c);
90}
91
92__m128 test_mm_nmsub_ss(__m128 a, __m128 b, __m128 c) {
93  // CHECK-LABEL: test_mm_nmsub_ss
94  // CHECK: @llvm.x86.fma.vfnmsub.ss
95  return _mm_nmsub_ss(a, b, c);
96}
97
98__m128d test_mm_nmsub_sd(__m128d a, __m128d b, __m128d c) {
99  // CHECK-LABEL: test_mm_nmsub_sd
100  // CHECK: @llvm.x86.fma.vfnmsub.sd
101  return _mm_nmsub_sd(a, b, c);
102}
103
104__m128 test_mm_maddsub_ps(__m128 a, __m128 b, __m128 c) {
105  // CHECK-LABEL: test_mm_maddsub_ps
106  // CHECK: @llvm.x86.fma.vfmaddsub.ps
107  return _mm_maddsub_ps(a, b, c);
108}
109
110__m128d test_mm_maddsub_pd(__m128d a, __m128d b, __m128d c) {
111  // CHECK-LABEL: test_mm_maddsub_pd
112  // CHECK: @llvm.x86.fma.vfmaddsub.pd
113  return _mm_maddsub_pd(a, b, c);
114}
115
116__m128 test_mm_msubadd_ps(__m128 a, __m128 b, __m128 c) {
117  // CHECK-LABEL: test_mm_msubadd_ps
118  // CHECK: @llvm.x86.fma.vfmsubadd.ps
119  return _mm_msubadd_ps(a, b, c);
120}
121
122__m128d test_mm_msubadd_pd(__m128d a, __m128d b, __m128d c) {
123  // CHECK-LABEL: test_mm_msubadd_pd
124  // CHECK: @llvm.x86.fma.vfmsubadd.pd
125  return _mm_msubadd_pd(a, b, c);
126}
127
128__m256 test_mm256_macc_ps(__m256 a, __m256 b, __m256 c) {
129  // CHECK-LABEL: test_mm256_macc_ps
130  // CHECK: @llvm.x86.fma.vfmadd.ps.256
131  return _mm256_macc_ps(a, b, c);
132}
133
134__m256d test_mm256_macc_pd(__m256d a, __m256d b, __m256d c) {
135  // CHECK-LABEL: test_mm256_macc_pd
136  // CHECK: @llvm.x86.fma.vfmadd.pd.256
137  return _mm256_macc_pd(a, b, c);
138}
139
140__m256 test_mm256_msub_ps(__m256 a, __m256 b, __m256 c) {
141  // CHECK-LABEL: test_mm256_msub_ps
142  // CHECK: @llvm.x86.fma.vfmsub.ps.256
143  return _mm256_msub_ps(a, b, c);
144}
145
146__m256d test_mm256_msub_pd(__m256d a, __m256d b, __m256d c) {
147  // CHECK-LABEL: test_mm256_msub_pd
148  // CHECK: @llvm.x86.fma.vfmsub.pd.256
149  return _mm256_msub_pd(a, b, c);
150}
151
152__m256 test_mm256_nmacc_ps(__m256 a, __m256 b, __m256 c) {
153  // CHECK-LABEL: test_mm256_nmacc_ps
154  // CHECK: @llvm.x86.fma.vfnmadd.ps.256
155  return _mm256_nmacc_ps(a, b, c);
156}
157
158__m256d test_mm256_nmacc_pd(__m256d a, __m256d b, __m256d c) {
159  // CHECK-LABEL: test_mm256_nmacc_pd
160  // CHECK: @llvm.x86.fma.vfnmadd.pd.256
161  return _mm256_nmacc_pd(a, b, c);
162}
163
164__m256 test_mm256_nmsub_ps(__m256 a, __m256 b, __m256 c) {
165  // CHECK-LABEL: test_mm256_nmsub_ps
166  // CHECK: @llvm.x86.fma.vfnmsub.ps.256
167  return _mm256_nmsub_ps(a, b, c);
168}
169
170__m256d test_mm256_nmsub_pd(__m256d a, __m256d b, __m256d c) {
171  // CHECK-LABEL: test_mm256_nmsub_pd
172  // CHECK: @llvm.x86.fma.vfnmsub.pd.256
173  return _mm256_nmsub_pd(a, b, c);
174}
175
176__m256 test_mm256_maddsub_ps(__m256 a, __m256 b, __m256 c) {
177  // CHECK-LABEL: test_mm256_maddsub_ps
178  // CHECK: @llvm.x86.fma.vfmaddsub.ps.256
179  return _mm256_maddsub_ps(a, b, c);
180}
181
182__m256d test_mm256_maddsub_pd(__m256d a, __m256d b, __m256d c) {
183  // CHECK-LABEL: test_mm256_maddsub_pd
184  // CHECK: @llvm.x86.fma.vfmaddsub.pd.256
185  return _mm256_maddsub_pd(a, b, c);
186}
187
188__m256 test_mm256_msubadd_ps(__m256 a, __m256 b, __m256 c) {
189  // CHECK-LABEL: test_mm256_msubadd_ps
190  // CHECK: @llvm.x86.fma.vfmsubadd.ps.256
191  return _mm256_msubadd_ps(a, b, c);
192}
193
194__m256d test_mm256_msubadd_pd(__m256d a, __m256d b, __m256d c) {
195  // CHECK-LABEL: test_mm256_msubadd_pd
196  // CHECK: @llvm.x86.fma.vfmsubadd.pd.256
197  return _mm256_msubadd_pd(a, b, c);
198}
199