Debian Codegraph @

arch/x86_64/fpu/round_i64_f32.h

raw
1 //
2 // arch/x86_64/fpu/round_i64_f32.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_round_i64_f32(const uint32_t *fs, uint64_t *fd) {
13 float fs_float;
14 __m128 fs_reg;
15
16 // Prevent aliasing.
17 memcpy(&fs_float, fs, sizeof(fs_float));
18
19 fs_reg = _mm_set_ss(fs_float);
20 fs_reg = _mm_round_ss(fs_reg, fs_reg, _MM_FROUND_TO_NEAREST_INT);
21 *fd = _mm_cvtss_si64(fs_reg);
22 }
23