From 12ff721ec1cb52a3328c3c88d81040485fa62c64 Mon Sep 17 00:00:00 2001 From: Vsevolod Livinskiy Date: Thu, 14 May 2015 16:13:08 +0300 Subject: [PATCH] Add roundings for varying double in knc.h and knl.h --- examples/intrinsics/knc.h | 21 +++++++++++++++++++++ examples/intrinsics/knl.h | 18 ++++++++++++++++++ tests/test-149.ispc | 12 ++++++++++++ tests/test-150.ispc | 12 ++++++++++++ tests/test-151.ispc | 12 ++++++++++++ tests/test-152.ispc | 12 ++++++++++++ tests/test-153.ispc | 12 ++++++++++++ 7 files changed, 99 insertions(+) create mode 100644 tests/test-149.ispc create mode 100644 tests/test-150.ispc create mode 100644 tests/test-151.ispc create mode 100644 tests/test-152.ispc create mode 100644 tests/test-153.ispc diff --git a/examples/intrinsics/knc.h b/examples/intrinsics/knc.h index 3a097ce6..dc2a3a19 100644 --- a/examples/intrinsics/knc.h +++ b/examples/intrinsics/knc.h @@ -2675,6 +2675,27 @@ static FORCEINLINE __vec16_f __ceil_varying_float(__vec16_f v) { return _mm512_ceil_ps(v); } +static FORCEINLINE __vec16_d __round_varying_double(__vec16_d v) { + double tmp [16]; + for (int i = 0; i < 16; i++) + tmp [i] = round(v [i]); + return __vec16_d (tmp [8], tmp [9], tmp [10], tmp [11], + tmp [12], tmp [13], tmp [14], tmp [15], + tmp [0], tmp [1], tmp [2], tmp [3], + tmp [4], tmp [5], tmp [6], tmp [7]); +} + +static FORCEINLINE __vec16_d __floor_varying_double(__vec16_d v) { + __m512d tmp1 = _mm512_floor_pd(v.v1); + __m512d tmp2 = _mm512_floor_pd(v.v2); + return __vec16_d (tmp1, tmp2); +} + +static FORCEINLINE __vec16_d __ceil_varying_double(__vec16_d v) { + __m512d tmp1 = _mm512_ceil_pd(v.v1); + __m512d tmp2 = _mm512_ceil_pd(v.v2); + return __vec16_d (tmp1, tmp2); +} // min/max static FORCEINLINE float __min_uniform_float(float a, float b) { return (a