Hello. The f128 suffix worked. Based on all the corrections you all pointed out, I have created another patch. I think I took most of the things under consideration but please mention if I missed anything. The following test cases were inspected with this patch. I am not sure if the second test case is supposed to be carried out like I did. Thanks, -Tejas /* { dg-do link } */ extern int link_error (int); #define TEST(FN, VALUE, RESULT) \ if (__builtin_##FN (VALUE) != RESULT) link_error (__LINE__); int main (void) { TEST(roundeven, 0, 0); TEST(roundeven, 0.5, 0); TEST(roundeven, -0.5, 0); TEST(roundeven, 6, 6); TEST(roundeven, -8, -8); TEST(roundeven, 2.5, 2); TEST(roundeven, 3.5, 4); TEST(roundeven, -1.5, -2); TEST(roundeven, 3.499, 3); TEST(roundeven, 3.501, 4); return 0; } second test case : /* { dg-do link } */ /* { dg-add-options float128 } */ /* { dg-require-effective-target float128 } */ extern int link_error (int); #define TEST(FN, VALUE, RESULT) \ if (__builtin_##FN (VALUE) != RESULT) link_error (__LINE__); int main (void) { TEST(roundevenf128, (0x1p64+0.5), (0x1p64)); return 0; } On Fri, 31 May 2019 at 15:41, Martin Jambor wrote: > > On Thu, May 30 2019, Segher Boessenkool wrote: > > On Thu, May 30, 2019 at 07:08:45PM +0200, Martin Jambor wrote: > >> Interesting, I was also puzzled for a moment. But notice that: > >> > >> int main () > >> { > >> _Float128 x = 18446744073709551617.5f128; > >> _Float128 y = __builtin_roundf128 (x); > >> } > >> > >> behaves as expected... the difference is of course the suffix pegged to > >> the literal constant (see > >> https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Floating-Types.html). > >> > >> I would also expect GCC to use a larger type if a constant does not fit > >> into a double, but apparently that does not happen. I would have to > >> check but it is probably the right behavior according to the standard. > > > > 6.4.4.2/4: "An unsuffixed floating constant has type double." I don't > > think your suggestion would be okay? > > Sorry if I was not clear but I was definitely not suggesting that we > change this (or anything). I wrote that I was also surprised but > believed that GCC was doing the correct thing. > > Thanks for pointing out where exactly the standard says what has to be > done though. > > Martin