[babl/wip/msvc: 20/20] build: Enable F16C intrinsics on Visual Studio
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl/wip/msvc: 20/20] build: Enable F16C intrinsics on Visual Studio
- Date: Wed, 22 Jan 2020 08:11:14 +0000 (UTC)
commit ddef9c4f035c69a0f3b71888e5a0abc35196672d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Tue Jan 21 18:18:11 2020 +0800
build: Enable F16C intrinsics on Visual Studio
The Visual Studio versions that we support is capab;e of building F16C
intrinsics, so enable the build to build such support. Also update the
code so that we avoid using GCC-specific intrinsics implementations
extensions/sse-half.c | 16 ++++++++--------
meson.build | 4 ++++
2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/extensions/sse-half.c b/extensions/sse-half.c
index cee397555..dc9e39f0f 100644
--- a/extensions/sse-half.c
+++ b/extensions/sse-half.c
@@ -36,17 +36,17 @@ conv_yHalf_yF (const Babl *conversion,
long samples)
{
const uint64_t *s_vec;
- __v4sf *d_vec;
+ __m128 *d_vec;
long n = samples;
s_vec = (const uint64_t *)src;
- d_vec = (__v4sf *)dst;
+ d_vec = (__m128 *)dst;
while (n >= 4)
{
- __m128i in_val = _mm_insert_epi64((__m128i)_mm_setzero_ps(), *s_vec++, 0);
- __v4sf out_val = (__v4sf)_mm_cvtph_ps(in_val);
+ __m128i in_val = _mm_insert_epi64(_mm_castps_si128(_mm_setzero_ps()), *s_vec++, 0);
+ __m128 out_val = _mm_cvtph_ps(in_val);
_mm_storeu_ps((float *)d_vec++, out_val);
n -= 4;
}
@@ -56,8 +56,8 @@ conv_yHalf_yF (const Babl *conversion,
while (n)
{
- __m128i in_val = _mm_insert_epi16((__m128i)_mm_setzero_ps(), *src++, 0);
- __v4sf out_val = (__v4sf)_mm_cvtph_ps(in_val);
+ __m128i in_val = _mm_insert_epi16(_mm_castps_si128(_mm_setzero_ps()), *src++, 0);
+ __m128 out_val = _mm_cvtph_ps(in_val);
_mm_store_ss(dst++, out_val);
n -= 1;
}
@@ -96,12 +96,12 @@ conv_yF_yHalf (const Babl *conversion,
uint16_t *dst,
long samples)
{
- const __v4sf *s_vec;
+ const __m128 *s_vec;
uint64_t *d_vec;
long n = samples;
- s_vec = (const __v4sf *)src;
+ s_vec = (const __m128 *)src;
d_vec = (uint64_t *)dst;
while (n >= 4)
diff --git a/meson.build b/meson.build
index 50585ac28..8d7ba3360 100644
--- a/meson.build
+++ b/meson.build
@@ -307,6 +307,10 @@ if cc.get_id() == 'msvc' and have_x86
endif
endif
endif
+ if get_option('enable-f16c')
+ conf.set('USE_F16C', 1, description:
+ 'Define to 1 if f16c intrinsics are available.')
+ endif
endif
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]