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