| 1 |
// |
| 2 |
// arch/x86_64/fpu/ceil_i64_f64.h |
| 3 |
// |
| 4 |
// This file is subject to the terms and conditions defined in |
| 5 |
// 'LICENSE', which is part of this source code package. |
| 6 |
// |
| 7 |
|
| 8 |
#include "common.h" |
| 9 |
#include <smmintrin.h> |
| 10 |
#include <string.h> |
| 11 |
|
| 12 |
static inline void fpu_ceil_i64_f64(const uint64_t *fs, uint64_t *fd) { |
| 13 |
double fs_double; |
| 14 |
__m128d fs_reg; |
| 15 |
|
| 16 |
// Prevent aliasing. |
| 17 |
memcpy(&fs_double, fs, sizeof(fs_double)); |
| 18 |
|
| 19 |
fs_reg = _mm_set_sd(fs_double); |
| 20 |
fs_reg = _mm_ceil_sd(fs_reg, fs_reg); |
| 21 |
*fd = _mm_cvtsd_si64(fs_reg); |
| 22 |
} |
| 23 |
|