public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Correct libgcc complex multiply excess precision handling
@ 2016-09-07 23:00 Joseph Myers
  2016-09-07 23:01 ` Bernd Schmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2016-09-07 23:00 UTC (permalink / raw)
  To: gcc-patches

libgcc complex multiply is meant to eliminate excess
precision from certain internal values by forcing them to memory in
exactly those cases where the type has excess precision.  But in
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01894.html I
accidentally inverted the logic so that values get forced to memory in
exactly the cases where it's not needed.  (This is a pessimization in
the no-excess-precision case, in principle could lead to bad results
depending on code generation in the excess-precision case.  Note: I do
not have a test demonstrating bad results.)

Bootstrapped with no regressions on x86_64-pc-linux-gnu.  Code size
went down on x86_64 as expected; old sizes:

   text    data     bss     dec     hex filename
    887       0       0     887     377 _muldc3.o
    810       0       0     810     32a _mulsc3.o
   2032       0       0    2032     7f0 _multc3.o
    983       0       0     983     3d7 _mulxc3.o

New sizes:

    847       0       0     847     34f _muldc3.o
    770       0       0     770     302 _mulsc3.o
   2032       0       0    2032     7f0 _multc3.o
    951       0       0     951     3b7 _mulxc3.o

OK to commit?

2016-09-07  Joseph Myers  <joseph@codesourcery.com>

	PR libgcc/77519
	* libgcc2.c (NOTRUNC): Invert settings.

Index: libgcc/libgcc2.c
===================================================================
--- libgcc/libgcc2.c	(revision 240028)
+++ libgcc/libgcc2.c	(working copy)
@@ -1866,25 +1866,25 @@
 # define CTYPE	SCtype
 # define MODE	sc
 # define CEXT	__LIBGCC_SF_FUNC_EXT__
-# define NOTRUNC __LIBGCC_SF_EXCESS_PRECISION__
+# define NOTRUNC (!__LIBGCC_SF_EXCESS_PRECISION__)
 #elif defined(L_muldc3) || defined(L_divdc3)
 # define MTYPE	DFtype
 # define CTYPE	DCtype
 # define MODE	dc
 # define CEXT	__LIBGCC_DF_FUNC_EXT__
-# define NOTRUNC __LIBGCC_DF_EXCESS_PRECISION__
+# define NOTRUNC (!__LIBGCC_DF_EXCESS_PRECISION__)
 #elif defined(L_mulxc3) || defined(L_divxc3)
 # define MTYPE	XFtype
 # define CTYPE	XCtype
 # define MODE	xc
 # define CEXT	__LIBGCC_XF_FUNC_EXT__
-# define NOTRUNC __LIBGCC_XF_EXCESS_PRECISION__
+# define NOTRUNC (!__LIBGCC_XF_EXCESS_PRECISION__)
 #elif defined(L_multc3) || defined(L_divtc3)
 # define MTYPE	TFtype
 # define CTYPE	TCtype
 # define MODE	tc
 # define CEXT	__LIBGCC_TF_FUNC_EXT__
-# define NOTRUNC __LIBGCC_TF_EXCESS_PRECISION__
+# define NOTRUNC (!__LIBGCC_TF_EXCESS_PRECISION__)
 #else
 # error
 #endif

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Correct libgcc complex multiply excess precision handling
  2016-09-07 23:00 Correct libgcc complex multiply excess precision handling Joseph Myers
@ 2016-09-07 23:01 ` Bernd Schmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Bernd Schmidt @ 2016-09-07 23:01 UTC (permalink / raw)
  To: Joseph Myers, gcc-patches

On 09/07/2016 11:48 PM, Joseph Myers wrote:
> libgcc complex multiply is meant to eliminate excess
> precision from certain internal values by forcing them to memory in
> exactly those cases where the type has excess precision.  But in
> https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01894.html I
> accidentally inverted the logic so that values get forced to memory in
> exactly the cases where it's not needed.  (This is a pessimization in
> the no-excess-precision case, in principle could lead to bad results
> depending on code generation in the excess-precision case.  Note: I do
> not have a test demonstrating bad results.)

Ok.


Bernd

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-07 23:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07 23:00 Correct libgcc complex multiply excess precision handling Joseph Myers
2016-09-07 23:01 ` Bernd Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).