Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / X86 / sse3-builtins.c
blob38f9710f071aec00bf2c53bc61aa070116fbebd1
1 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
2 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
5 #include <immintrin.h>
7 // NOTE: This should match the tests in llvm/test/CodeGen/X86/sse3-intrinsics-fast-isel.ll
9 __m128d test_mm_addsub_pd(__m128d A, __m128d B) {
10 // CHECK-LABEL: test_mm_addsub_pd
11 // CHECK: call <2 x double> @llvm.x86.sse3.addsub.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}})
12 return _mm_addsub_pd(A, B);
15 __m128 test_mm_addsub_ps(__m128 A, __m128 B) {
16 // CHECK-LABEL: test_mm_addsub_ps
17 // CHECK: call <4 x float> @llvm.x86.sse3.addsub.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}})
18 return _mm_addsub_ps(A, B);
21 __m128d test_mm_hadd_pd(__m128d A, __m128d B) {
22 // CHECK-LABEL: test_mm_hadd_pd
23 // CHECK: call <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}})
24 return _mm_hadd_pd(A, B);
27 __m128 test_mm_hadd_ps(__m128 A, __m128 B) {
28 // CHECK-LABEL: test_mm_hadd_ps
29 // CHECK: call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}})
30 return _mm_hadd_ps(A, B);
33 __m128d test_mm_hsub_pd(__m128d A, __m128d B) {
34 // CHECK-LABEL: test_mm_hsub_pd
35 // CHECK: call <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}})
36 return _mm_hsub_pd(A, B);
39 __m128 test_mm_hsub_ps(__m128 A, __m128 B) {
40 // CHECK-LABEL: test_mm_hsub_ps
41 // CHECK: call <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}})
42 return _mm_hsub_ps(A, B);
45 __m128i test_mm_lddqu_si128(__m128i const* P) {
46 // CHECK-LABEL: test_mm_lddqu_si128
47 // CHECK: call <16 x i8> @llvm.x86.sse3.ldu.dq(ptr %{{.*}})
48 return _mm_lddqu_si128(P);
51 __m128d test_mm_loaddup_pd(double const* P) {
52 // CHECK-LABEL: test_mm_loaddup_pd
53 // CHECK: load ptr
54 // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 0
55 // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 1
56 return _mm_loaddup_pd(P);
59 __m128d test_mm_movedup_pd(__m128d A) {
60 // CHECK-LABEL: test_mm_movedup_pd
61 // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> zeroinitializer
62 return _mm_movedup_pd(A);
65 __m128 test_mm_movehdup_ps(__m128 A) {
66 // CHECK-LABEL: test_mm_movehdup_ps
67 // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 1, i32 1, i32 3, i32 3>
68 return _mm_movehdup_ps(A);
71 __m128 test_mm_moveldup_ps(__m128 A) {
72 // CHECK-LABEL: test_mm_moveldup_ps
73 // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 0, i32 2, i32 2>
74 return _mm_moveldup_ps(A);