1 // RUN: %clang_cc1 %s -triple=x86_64-unknown-unknown -target-feature +3dnowa -emit-llvm -o - -Werror | FileCheck %s -check-prefix=GCC -check-prefix=CHECK
2 // RUN: %clang_cc1 %s -triple=x86_64-scei-ps4 -target-feature +3dnowa -emit-llvm -o - -Werror | FileCheck %s -check-prefix=PS4 -check-prefix=CHECK
3 
4 // Don't include mm_malloc.h, it's system specific.
5 #define __MM_MALLOC_H
6 
7 #include <x86intrin.h>
8 
test_m_pavgusb(__m64 m1,__m64 m2)9 __m64 test_m_pavgusb(__m64 m1, __m64 m2) {
10   // PS4-LABEL: define i64 @test_m_pavgusb
11   // GCC-LABEL: define double @test_m_pavgusb
12   // CHECK: @llvm.x86.3dnow.pavgusb
13   return _m_pavgusb(m1, m2);
14 }
15 
test_m_pf2id(__m64 m)16 __m64 test_m_pf2id(__m64 m) {
17   // PS4-LABEL: define i64 @test_m_pf2id
18   // GCC-LABEL: define double @test_m_pf2id
19   // CHECK: @llvm.x86.3dnow.pf2id
20   return _m_pf2id(m);
21 }
22 
test_m_pfacc(__m64 m1,__m64 m2)23 __m64 test_m_pfacc(__m64 m1, __m64 m2) {
24   // PS4-LABEL: define i64 @test_m_pfacc
25   // GCC-LABEL: define double @test_m_pfacc
26   // CHECK: @llvm.x86.3dnow.pfacc
27   return _m_pfacc(m1, m2);
28 }
29 
test_m_pfadd(__m64 m1,__m64 m2)30 __m64 test_m_pfadd(__m64 m1, __m64 m2) {
31   // PS4-LABEL: define i64 @test_m_pfadd
32   // GCC-LABEL: define double @test_m_pfadd
33   // CHECK: @llvm.x86.3dnow.pfadd
34   return _m_pfadd(m1, m2);
35 }
36 
test_m_pfcmpeq(__m64 m1,__m64 m2)37 __m64 test_m_pfcmpeq(__m64 m1, __m64 m2) {
38   // PS4-LABEL: define i64 @test_m_pfcmpeq
39   // GCC-LABEL: define double @test_m_pfcmpeq
40   // CHECK: @llvm.x86.3dnow.pfcmpeq
41   return _m_pfcmpeq(m1, m2);
42 }
43 
test_m_pfcmpge(__m64 m1,__m64 m2)44 __m64 test_m_pfcmpge(__m64 m1, __m64 m2) {
45   // PS4-LABEL: define i64 @test_m_pfcmpge
46   // GCC-LABEL: define double @test_m_pfcmpge
47   // CHECK: @llvm.x86.3dnow.pfcmpge
48   return _m_pfcmpge(m1, m2);
49 }
50 
test_m_pfcmpgt(__m64 m1,__m64 m2)51 __m64 test_m_pfcmpgt(__m64 m1, __m64 m2) {
52   // PS4-LABEL: define i64 @test_m_pfcmpgt
53   // GCC-LABEL: define double @test_m_pfcmpgt
54   // CHECK: @llvm.x86.3dnow.pfcmpgt
55   return _m_pfcmpgt(m1, m2);
56 }
57 
test_m_pfmax(__m64 m1,__m64 m2)58 __m64 test_m_pfmax(__m64 m1, __m64 m2) {
59   // PS4-LABEL: define i64 @test_m_pfmax
60   // GCC-LABEL: define double @test_m_pfmax
61   // CHECK: @llvm.x86.3dnow.pfmax
62   return _m_pfmax(m1, m2);
63 }
64 
test_m_pfmin(__m64 m1,__m64 m2)65 __m64 test_m_pfmin(__m64 m1, __m64 m2) {
66   // PS4-LABEL: define i64 @test_m_pfmin
67   // GCC-LABEL: define double @test_m_pfmin
68   // CHECK: @llvm.x86.3dnow.pfmin
69   return _m_pfmin(m1, m2);
70 }
71 
test_m_pfmul(__m64 m1,__m64 m2)72 __m64 test_m_pfmul(__m64 m1, __m64 m2) {
73   // PS4-LABEL: define i64 @test_m_pfmul
74   // GCC-LABEL: define double @test_m_pfmul
75   // CHECK: @llvm.x86.3dnow.pfmul
76   return _m_pfmul(m1, m2);
77 }
78 
test_m_pfrcp(__m64 m)79 __m64 test_m_pfrcp(__m64 m) {
80   // PS4-LABEL: define i64 @test_m_pfrcp
81   // GCC-LABEL: define double @test_m_pfrcp
82   // CHECK: @llvm.x86.3dnow.pfrcp
83   return _m_pfrcp(m);
84 }
85 
test_m_pfrcpit1(__m64 m1,__m64 m2)86 __m64 test_m_pfrcpit1(__m64 m1, __m64 m2) {
87   // PS4-LABEL: define i64 @test_m_pfrcpit1
88   // GCC-LABEL: define double @test_m_pfrcpit1
89   // CHECK: @llvm.x86.3dnow.pfrcpit1
90   return _m_pfrcpit1(m1, m2);
91 }
92 
test_m_pfrcpit2(__m64 m1,__m64 m2)93 __m64 test_m_pfrcpit2(__m64 m1, __m64 m2) {
94   // PS4-LABEL: define i64 @test_m_pfrcpit2
95   // GCC-LABEL: define double @test_m_pfrcpit2
96   // CHECK: @llvm.x86.3dnow.pfrcpit2
97   return _m_pfrcpit2(m1, m2);
98 }
99 
test_m_pfrsqrt(__m64 m)100 __m64 test_m_pfrsqrt(__m64 m) {
101   // PS4-LABEL: define i64 @test_m_pfrsqrt
102   // GCC-LABEL: define double @test_m_pfrsqrt
103   // CHECK: @llvm.x86.3dnow.pfrsqrt
104   return _m_pfrsqrt(m);
105 }
106 
test_m_pfrsqrtit1(__m64 m1,__m64 m2)107 __m64 test_m_pfrsqrtit1(__m64 m1, __m64 m2) {
108   // PS4-LABEL: define i64 @test_m_pfrsqrtit1
109   // GCC-LABEL: define double @test_m_pfrsqrtit1
110   // CHECK: @llvm.x86.3dnow.pfrsqit1
111   return _m_pfrsqrtit1(m1, m2);
112 }
113 
test_m_pfsub(__m64 m1,__m64 m2)114 __m64 test_m_pfsub(__m64 m1, __m64 m2) {
115   // PS4-LABEL: define i64 @test_m_pfsub
116   // GCC-LABEL: define double @test_m_pfsub
117   // CHECK: @llvm.x86.3dnow.pfsub
118   return _m_pfsub(m1, m2);
119 }
120 
test_m_pfsubr(__m64 m1,__m64 m2)121 __m64 test_m_pfsubr(__m64 m1, __m64 m2) {
122   // PS4-LABEL: define i64 @test_m_pfsubr
123   // GCC-LABEL: define double @test_m_pfsubr
124   // CHECK: @llvm.x86.3dnow.pfsubr
125   return _m_pfsubr(m1, m2);
126 }
127 
test_m_pi2fd(__m64 m)128 __m64 test_m_pi2fd(__m64 m) {
129   // PS4-LABEL: define i64 @test_m_pi2fd
130   // GCC-LABEL: define double @test_m_pi2fd
131   // CHECK: @llvm.x86.3dnow.pi2fd
132   return _m_pi2fd(m);
133 }
134 
test_m_pmulhrw(__m64 m1,__m64 m2)135 __m64 test_m_pmulhrw(__m64 m1, __m64 m2) {
136   // PS4-LABEL: define i64 @test_m_pmulhrw
137   // GCC-LABEL: define double @test_m_pmulhrw
138   // CHECK: @llvm.x86.3dnow.pmulhrw
139   return _m_pmulhrw(m1, m2);
140 }
141 
test_m_pf2iw(__m64 m)142 __m64 test_m_pf2iw(__m64 m) {
143   // PS4-LABEL: define i64 @test_m_pf2iw
144   // GCC-LABEL: define double @test_m_pf2iw
145   // CHECK: @llvm.x86.3dnowa.pf2iw
146   return _m_pf2iw(m);
147 }
148 
test_m_pfnacc(__m64 m1,__m64 m2)149 __m64 test_m_pfnacc(__m64 m1, __m64 m2) {
150   // PS4-LABEL: define i64 @test_m_pfnacc
151   // GCC-LABEL: define double @test_m_pfnacc
152   // CHECK: @llvm.x86.3dnowa.pfnacc
153   return _m_pfnacc(m1, m2);
154 }
155 
test_m_pfpnacc(__m64 m1,__m64 m2)156 __m64 test_m_pfpnacc(__m64 m1, __m64 m2) {
157   // PS4-LABEL: define i64 @test_m_pfpnacc
158   // GCC-LABEL: define double @test_m_pfpnacc
159   // CHECK: @llvm.x86.3dnowa.pfpnacc
160   return _m_pfpnacc(m1, m2);
161 }
162 
test_m_pi2fw(__m64 m)163 __m64 test_m_pi2fw(__m64 m) {
164   // PS4-LABEL: define i64 @test_m_pi2fw
165   // GCC-LABEL: define double @test_m_pi2fw
166   // CHECK: @llvm.x86.3dnowa.pi2fw
167   return _m_pi2fw(m);
168 }
169 
test_m_pswapdsf(__m64 m)170 __m64 test_m_pswapdsf(__m64 m) {
171   // PS4-LABEL: define i64 @test_m_pswapdsf
172   // GCC-LABEL: define double @test_m_pswapdsf
173   // CHECK: @llvm.x86.3dnowa.pswapd
174   return _m_pswapdsf(m);
175 }
176 
test_m_pswapdsi(__m64 m)177 __m64 test_m_pswapdsi(__m64 m) {
178   // PS4-LABEL: define i64 @test_m_pswapdsi
179   // GCC-LABEL: define double @test_m_pswapdsi
180   // CHECK: @llvm.x86.3dnowa.pswapd
181   return _m_pswapdsi(m);
182 }
183