1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +sse3 -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 // NOTE: This should match the tests in llvm/test/CodeGen/X86/sse3-intrinsics-fast-isel.ll 9 10 __m128d test_mm_addsub_pd(__m128d A, __m128d B) { 11 // CHECK-LABEL: test_mm_addsub_pd 12 // CHECK: call <2 x double> @llvm.x86.sse3.addsub.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}) 13 return _mm_addsub_pd(A, B); 14 } 15 16 __m128 test_mm_addsub_ps(__m128 A, __m128 B) { 17 // CHECK-LABEL: test_mm_addsub_ps 18 // CHECK: call <4 x float> @llvm.x86.sse3.addsub.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}}) 19 return _mm_addsub_ps(A, B); 20 } 21 22 __m128d test_mm_hadd_pd(__m128d A, __m128d B) { 23 // CHECK-LABEL: test_mm_hadd_pd 24 // CHECK: call <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}) 25 return _mm_hadd_pd(A, B); 26 } 27 28 __m128 test_mm_hadd_ps(__m128 A, __m128 B) { 29 // CHECK-LABEL: test_mm_hadd_ps 30 // CHECK: call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}}) 31 return _mm_hadd_ps(A, B); 32 } 33 34 __m128d test_mm_hsub_pd(__m128d A, __m128d B) { 35 // CHECK-LABEL: test_mm_hsub_pd 36 // CHECK: call <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}}) 37 return _mm_hsub_pd(A, B); 38 } 39 40 __m128 test_mm_hsub_ps(__m128 A, __m128 B) { 41 // CHECK-LABEL: test_mm_hsub_ps 42 // CHECK: call <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}}) 43 return _mm_hsub_ps(A, B); 44 } 45 46 __m128i test_mm_lddqu_si128(__m128i const* P) { 47 // CHECK-LABEL: test_mm_lddqu_si128 48 // CHECK: call <16 x i8> @llvm.x86.sse3.ldu.dq(i8* %{{.*}}) 49 return _mm_lddqu_si128(P); 50 } 51 52 __m128d test_mm_loaddup_pd(double const* P) { 53 // CHECK-LABEL: test_mm_loaddup_pd 54 // CHECK: load double* 55 // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 0 56 // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 1 57 return _mm_loaddup_pd(P); 58 } 59 60 __m128d test_mm_movedup_pd(__m128d A) { 61 // CHECK-LABEL: test_mm_movedup_pd 62 // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> zeroinitializer 63 return _mm_movedup_pd(A); 64 } 65 66 __m128 test_mm_movehdup_ps(__m128 A) { 67 // CHECK-LABEL: test_mm_movehdup_ps 68 // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 1, i32 1, i32 3, i32 3> 69 return _mm_movehdup_ps(A); 70 } 71 72 __m128 test_mm_moveldup_ps(__m128 A) { 73 // CHECK-LABEL: test_mm_moveldup_ps 74 // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 0, i32 2, i32 2> 75 return _mm_moveldup_ps(A); 76 } 77