On Thu, Dec 15, 2022 at 12:49:27PM -0600, Segher Boessenkool wrote: > On Thu, Dec 15, 2022 at 06:28:19PM +0000, Joseph Myers wrote: > > On Thu, 15 Dec 2022, Kewen.Lin via Gcc-patches wrote: > > > By investigating the exposed NaN failures, I found it's due to that it > > > wants > > > to convert _Float128 type constant to long double type constant, it goes > > > through function real_convert which clears the signalling bit in the > > > context > > > of !HONOR_SNANS (arg). > > > > > > if (r->cl == rvc_nan) > > > r->signalling = 0; > > > > > > The test cases don't have the explicit option -fsignaling-nans, I'm > > > inclined > > > to believe it's intentional since there is only a sNaN generation. If so, > > > we don't want this kind of conversion which is useless and can clear > > > signalling > > > bit unexpectedly, one shortcut is to just copy the corresponding > > > REAL_VALUE_TYPE > > > and rebuild with the given type if the modes are the same. > > > > I think this approach - treating floating-point conversions to a type with > > the same mode consistently as a copy rather than a convertFormat operation > > - is reasonable. > > Certainly. But different types with the same mode having different > precision is not so very reasonable, and will likely cause other > problems as well. > > We cannot use precision to order modes or types, that is the core > problem. A conversion from IEEE QP to double-double (or vice versa) is > neither widening nor narrowing.
Sure. For optabs, I bet we don't necessarily need to care that much, if precision is the same, we can ask for widening and narrowing conversion and expect only one to be implemented or both doing the same thing between such modes. But when using libcalls, which library function we use is quite important because not all of them might be actually implemented in the library (better keep doing what we've done before). Jakub