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