llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[AVX512] FP_TO_SINT truncating conversion intrinsics don't seem to round towards zero

Open RKSimon opened this issue 10 years ago • 3 comments

Bugzilla Link 27951
Resolution INVALID
Resolved on Jul 06, 2016 01:27
Version trunk
OS Windows NT
CC @delena,@hfinkel

Extended Description

According to the intel documentation I can find the 'mm_cvtt**' truncation intrinsics should round towards zero, but the implementations in avx512fintrin.h appear to use the MXCSR.RC value:

e.g.

static inline int __DEFAULT_FN_ATTRS _mm_cvttsd_i32 (__m128d __A) { return (int) __builtin_ia32_vcvttsd2si32 ((__v2df) __A, _MM_FROUND_CUR_DIRECTION); }

shouldn't this be:

static inline int __DEFAULT_FN_ATTRS _mm_cvttsd_i32 (__m128d __A) { return (int) __builtin_ia32_vcvttsd2si32 ((__v2df) __A, _MM_FROUND_TO_ZERO); }

etc. ?

RKSimon avatar May 31 '16 20:05 RKSimon

Close it - by the looks it we can't convert these to __builtin_convertvector or implicit truncation like the other _mm_cvtt* intrinsics.

RKSimon avatar Jul 05 '16 23:07 RKSimon

Hi Simon,

Do you have any comments on this? I want to close the report.

delena avatar Jul 05 '16 11:07 delena

the integer value here is not a rounding mode, it is SAE - suppress all exceptions. CVTT instruction "knows" how to round.

delena avatar May 31 '16 20:05 delena