[Bug regression/78982] New: __builtin_lrintf() not an cvtss2si/vcvtss2si but cvttss2si/vcvttss2si since GCC 6.xx
anty_order at tlen dot pl
gcc-bugzilla@gcc.gnu.org
Wed Jan 4 03:48:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78982
Bug ID: 78982
Summary: __builtin_lrintf() not an cvtss2si/vcvtss2si but
cvttss2si/vcvttss2si since GCC 6.xx
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: regression
Assignee: unassigned at gcc dot gnu.org
Reporter: anty_order at tlen dot pl
Target Milestone: ---
It looks starting from GCC 6 bug reported and fixed earlier
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48139
reappeared.
Solution given in mentioned bug (adding -fno-math-errno or -ffast-math) works
as expected in all GCC versions below 6.x (tested with 4.8.x, 4.9.x, 5.x).
example code:
#include <iostream>
#include <tgmath.h>
int main(int argc, char **argv)
{
float someFloat = 10*argc;
long someInt = lrintf (someFloat);
std::cout << someInt << std::endl;
}
compile options:
-O2 -msse -ffast-math
same for -O3 and -mavx
up to GCC 5.4
lea eax, [rdi+rdi*4]
pxor xmm0, xmm0
sub rsp, 8
mov edi, OFFSET FLAT:std::cout
add eax, eax
cvtsi2ss xmm0, eax
cvtss2si rsi, xmm0
since GCC 6 (6.1-6.3 and 7)
lea eax, [rdi+rdi*4]
pxor xmm0, xmm0
sub rsp, 8
mov edi, OFFSET FLAT:std::cout
add eax, eax
cvtsi2ss xmm0, eax
cvttss2si rsi, xmm0
More information about the Gcc-bugs
mailing list