2020-01-23 10:13:16 +08:00
|
|
|
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
|
2015-09-06 22:45:13 +08:00
|
|
|
|
|
|
|
|
2018-05-24 15:09:08 +08:00
|
|
|
#include <immintrin.h>
|
2015-09-06 22:45:13 +08:00
|
|
|
|
2016-03-10 22:46:49 +08:00
|
|
|
// NOTE: This should match the tests in llvm/test/CodeGen/X86/sse3-intrinsics-fast-isel.ll
|
|
|
|
|
2015-09-06 22:45:13 +08:00
|
|
|
__m128d test_mm_addsub_pd(__m128d A, __m128d B) {
|
|
|
|
// CHECK-LABEL: test_mm_addsub_pd
|
2016-03-10 22:46:49 +08:00
|
|
|
// CHECK: call <2 x double> @llvm.x86.sse3.addsub.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}})
|
2015-09-06 22:45:13 +08:00
|
|
|
return _mm_addsub_pd(A, B);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128 test_mm_addsub_ps(__m128 A, __m128 B) {
|
|
|
|
// CHECK-LABEL: test_mm_addsub_ps
|
2016-03-10 22:46:49 +08:00
|
|
|
// CHECK: call <4 x float> @llvm.x86.sse3.addsub.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}})
|
2015-09-06 22:45:13 +08:00
|
|
|
return _mm_addsub_ps(A, B);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128d test_mm_hadd_pd(__m128d A, __m128d B) {
|
|
|
|
// CHECK-LABEL: test_mm_hadd_pd
|
2016-03-10 22:46:49 +08:00
|
|
|
// CHECK: call <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}})
|
2015-09-06 22:45:13 +08:00
|
|
|
return _mm_hadd_pd(A, B);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128 test_mm_hadd_ps(__m128 A, __m128 B) {
|
|
|
|
// CHECK-LABEL: test_mm_hadd_ps
|
2016-03-10 22:46:49 +08:00
|
|
|
// CHECK: call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}})
|
2015-09-06 22:45:13 +08:00
|
|
|
return _mm_hadd_ps(A, B);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128d test_mm_hsub_pd(__m128d A, __m128d B) {
|
|
|
|
// CHECK-LABEL: test_mm_hsub_pd
|
2016-03-10 22:46:49 +08:00
|
|
|
// CHECK: call <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}})
|
2015-09-06 22:45:13 +08:00
|
|
|
return _mm_hsub_pd(A, B);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128 test_mm_hsub_ps(__m128 A, __m128 B) {
|
|
|
|
// CHECK-LABEL: test_mm_hsub_ps
|
2016-03-10 22:46:49 +08:00
|
|
|
// CHECK: call <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}})
|
2015-09-06 22:45:13 +08:00
|
|
|
return _mm_hsub_ps(A, B);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128i test_mm_lddqu_si128(__m128i const* P) {
|
|
|
|
// CHECK-LABEL: test_mm_lddqu_si128
|
2016-03-10 22:46:49 +08:00
|
|
|
// CHECK: call <16 x i8> @llvm.x86.sse3.ldu.dq(i8* %{{.*}})
|
2015-09-06 22:45:13 +08:00
|
|
|
return _mm_lddqu_si128(P);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128d test_mm_loaddup_pd(double const* P) {
|
|
|
|
// CHECK-LABEL: test_mm_loaddup_pd
|
|
|
|
// CHECK: load double*
|
2016-05-18 21:17:39 +08:00
|
|
|
// CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 0
|
|
|
|
// CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 1
|
2015-09-06 22:45:13 +08:00
|
|
|
return _mm_loaddup_pd(P);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128d test_mm_movedup_pd(__m128d A) {
|
|
|
|
// CHECK-LABEL: test_mm_movedup_pd
|
|
|
|
// CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> zeroinitializer
|
|
|
|
return _mm_movedup_pd(A);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128 test_mm_movehdup_ps(__m128 A) {
|
|
|
|
// CHECK-LABEL: test_mm_movehdup_ps
|
|
|
|
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 1, i32 1, i32 3, i32 3>
|
|
|
|
return _mm_movehdup_ps(A);
|
|
|
|
}
|
|
|
|
|
2015-12-05 19:08:51 +08:00
|
|
|
__m128 test_mm_moveldup_ps(__m128 A) {
|
|
|
|
// CHECK-LABEL: test_mm_moveldup_ps
|
2015-09-06 22:45:13 +08:00
|
|
|
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 0, i32 2, i32 2>
|
|
|
|
return _mm_moveldup_ps(A);
|
|
|
|
}
|