1// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +fma -emit-llvm -o - | FileCheck %s
2
3// Don't include mm_malloc.h, it's system specific.
4#define __MM_MALLOC_H
5
6#include <immintrin.h>
7
8__m128 test_mm_fmadd_ps(__m128 a, __m128 b, __m128 c) {
9  // CHECK: @llvm.x86.fma.vfmadd.ps
10  return _mm_fmadd_ps(a, b, c);
11}
12
13__m128d test_mm_fmadd_pd(__m128d a, __m128d b, __m128d c) {
14  // CHECK: @llvm.x86.fma.vfmadd.pd
15  return _mm_fmadd_pd(a, b, c);
16}
17
18__m128 test_mm_fmadd_ss(__m128 a, __m128 b, __m128 c) {
19  // CHECK: @llvm.x86.fma.vfmadd.ss
20  return _mm_fmadd_ss(a, b, c);
21}
22
23__m128d test_mm_fmadd_sd(__m128d a, __m128d b, __m128d c) {
24  // CHECK: @llvm.x86.fma.vfmadd.sd
25  return _mm_fmadd_sd(a, b, c);
26}
27
28__m128 test_mm_fmsub_ps(__m128 a, __m128 b, __m128 c) {
29  // CHECK: @llvm.x86.fma.vfmsub.ps
30  return _mm_fmsub_ps(a, b, c);
31}
32
33__m128d test_mm_fmsub_pd(__m128d a, __m128d b, __m128d c) {
34  // CHECK: @llvm.x86.fma.vfmsub.pd
35  return _mm_fmsub_pd(a, b, c);
36}
37
38__m128 test_mm_fmsub_ss(__m128 a, __m128 b, __m128 c) {
39  // CHECK: @llvm.x86.fma.vfmsub.ss
40  return _mm_fmsub_ss(a, b, c);
41}
42
43__m128d test_mm_fmsub_sd(__m128d a, __m128d b, __m128d c) {
44  // CHECK: @llvm.x86.fma.vfmsub.sd
45  return _mm_fmsub_sd(a, b, c);
46}
47
48__m128 test_mm_fnmadd_ps(__m128 a, __m128 b, __m128 c) {
49  // CHECK: @llvm.x86.fma.vfnmadd.ps
50  return _mm_fnmadd_ps(a, b, c);
51}
52
53__m128d test_mm_fnmadd_pd(__m128d a, __m128d b, __m128d c) {
54  // CHECK: @llvm.x86.fma.vfnmadd.pd
55  return _mm_fnmadd_pd(a, b, c);
56}
57
58__m128 test_mm_fnmadd_ss(__m128 a, __m128 b, __m128 c) {
59  // CHECK: @llvm.x86.fma.vfnmadd.ss
60  return _mm_fnmadd_ss(a, b, c);
61}
62
63__m128d test_mm_fnmadd_sd(__m128d a, __m128d b, __m128d c) {
64  // CHECK: @llvm.x86.fma.vfnmadd.sd
65  return _mm_fnmadd_sd(a, b, c);
66}
67
68__m128 test_mm_fnmsub_ps(__m128 a, __m128 b, __m128 c) {
69  // CHECK: @llvm.x86.fma.vfnmsub.ps
70  return _mm_fnmsub_ps(a, b, c);
71}
72
73__m128d test_mm_fnmsub_pd(__m128d a, __m128d b, __m128d c) {
74  // CHECK: @llvm.x86.fma.vfnmsub.pd
75  return _mm_fnmsub_pd(a, b, c);
76}
77
78__m128 test_mm_fnmsub_ss(__m128 a, __m128 b, __m128 c) {
79  // CHECK: @llvm.x86.fma.vfnmsub.ss
80  return _mm_fnmsub_ss(a, b, c);
81}
82
83__m128d test_mm_fnmsub_sd(__m128d a, __m128d b, __m128d c) {
84  // CHECK: @llvm.x86.fma.vfnmsub.sd
85  return _mm_fnmsub_sd(a, b, c);
86}
87
88__m128 test_mm_fmaddsub_ps(__m128 a, __m128 b, __m128 c) {
89  // CHECK: @llvm.x86.fma.vfmaddsub.ps
90  return _mm_fmaddsub_ps(a, b, c);
91}
92
93__m128d test_mm_fmaddsub_pd(__m128d a, __m128d b, __m128d c) {
94  // CHECK: @llvm.x86.fma.vfmaddsub.pd
95  return _mm_fmaddsub_pd(a, b, c);
96}
97
98__m128 test_mm_fmsubadd_ps(__m128 a, __m128 b, __m128 c) {
99  // CHECK: @llvm.x86.fma.vfmsubadd.ps
100  return _mm_fmsubadd_ps(a, b, c);
101}
102
103__m128d test_mm_fmsubadd_pd(__m128d a, __m128d b, __m128d c) {
104  // CHECK: @llvm.x86.fma.vfmsubadd.pd
105  return _mm_fmsubadd_pd(a, b, c);
106}
107
108__m256 test_mm256_fmadd_ps(__m256 a, __m256 b, __m256 c) {
109  // CHECK: @llvm.x86.fma.vfmadd.ps.256
110  return _mm256_fmadd_ps(a, b, c);
111}
112
113__m256d test_mm256_fmadd_pd(__m256d a, __m256d b, __m256d c) {
114  // CHECK: @llvm.x86.fma.vfmadd.pd.256
115  return _mm256_fmadd_pd(a, b, c);
116}
117
118__m256 test_mm256_fmsub_ps(__m256 a, __m256 b, __m256 c) {
119  // CHECK: @llvm.x86.fma.vfmsub.ps.256
120  return _mm256_fmsub_ps(a, b, c);
121}
122
123__m256d test_mm256_fmsub_pd(__m256d a, __m256d b, __m256d c) {
124  // CHECK: @llvm.x86.fma.vfmsub.pd.256
125  return _mm256_fmsub_pd(a, b, c);
126}
127
128__m256 test_mm256_fnmadd_ps(__m256 a, __m256 b, __m256 c) {
129  // CHECK: @llvm.x86.fma.vfnmadd.ps.256
130  return _mm256_fnmadd_ps(a, b, c);
131}
132
133__m256d test_mm256_fnmadd_pd(__m256d a, __m256d b, __m256d c) {
134  // CHECK: @llvm.x86.fma.vfnmadd.pd.256
135  return _mm256_fnmadd_pd(a, b, c);
136}
137
138__m256 test_mm256_fnmsub_ps(__m256 a, __m256 b, __m256 c) {
139  // CHECK: @llvm.x86.fma.vfnmsub.ps.256
140  return _mm256_fnmsub_ps(a, b, c);
141}
142
143__m256d test_mm256_fnmsub_pd(__m256d a, __m256d b, __m256d c) {
144  // CHECK: @llvm.x86.fma.vfnmsub.pd.256
145  return _mm256_fnmsub_pd(a, b, c);
146}
147
148__m256 test_mm256_fmaddsub_ps(__m256 a, __m256 b, __m256 c) {
149  // CHECK: @llvm.x86.fma.vfmaddsub.ps.256
150  return _mm256_fmaddsub_ps(a, b, c);
151}
152
153__m256d test_mm256_fmaddsub_pd(__m256d a, __m256d b, __m256d c) {
154  // CHECK: @llvm.x86.fma.vfmaddsub.pd.256
155  return _mm256_fmaddsub_pd(a, b, c);
156}
157
158__m256 test_mm256_fmsubadd_ps(__m256 a, __m256 b, __m256 c) {
159  // CHECK: @llvm.x86.fma.vfmsubadd.ps.256
160  return _mm256_fmsubadd_ps(a, b, c);
161}
162
163__m256d test_mm256_fmsubadd_pd(__m256d a, __m256d b, __m256d c) {
164  // CHECK: @llvm.x86.fma.vfmsubadd.pd.256
165  return _mm256_fmsubadd_pd(a, b, c);
166}
167