Date: Wed, 13 Mar 2019 11:16:23 -0700 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: Conrad Meyer <cem@freebsd.org> Cc: John Baldwin <jhb@freebsd.org>, "freebsd-toolchain@FreeBSD.org" <freebsd-toolchain@freebsd.org>, freebsd-current <freebsd-current@freebsd.org> Subject: Re: Optimization bug with floating-point? Message-ID: <20190313181623.GA36061@troutmask.apl.washington.edu> In-Reply-To: <CAG6CVpWjYP_0D2YU_=EzGcShW6Dz28mM%2B=h9R_cpf=emJetDSA@mail.gmail.com> References: <20190313024506.GA31746@troutmask.apl.washington.edu> <20190313151635.GA34757@troutmask.apl.washington.edu> <e290b68f-7a1d-2456-4a0c-9f7dfd303f55@FreeBSD.org> <20190313164039.GA35340@troutmask.apl.washington.edu> <e638e0bf-b8d0-9bd1-d034-8acc6eef872c@FreeBSD.org> <CAG6CVpWjYP_0D2YU_=EzGcShW6Dz28mM%2B=h9R_cpf=emJetDSA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 13, 2019 at 10:40:28AM -0700, Conrad Meyer wrote: > Hi John, > > On Wed, Mar 13, 2019 at 10:17 AM John Baldwin <jhb@freebsd.org> wrote: > > One issue I'm aware of is that clang does not have any support for the > > special arrangement FreeBSD/i386 uses where it uses different precision > > for registers vs in-memory for some of the floating point types (GCC has > > a special hack that is only used on FreeBSD for this but isn't used on > > any other OS's). I wonder if that could be a factor? Volatile probably > > forces a round trip between memory which might explain why this is the > > case. > > > > I wonder what your test program does on i386 Linux with GCC? > > $ uname -sr > Linux 4.20.4 > $ gcc --version > gcc (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6) > ... > $ rpm -qf /usr/lib/libm-2.27.so > glibc-2.27-37.fc28.i686 > > $ gcc -m32 -fno-builtin -o z kargl.c -lm && ./z > Max ULP: 1.959975 > Count: 0 > $ gcc -O -m32 -fno-builtin -o z kargl.c -lm && ./z > Max ULP: 1.959975 > Count: 0 > $ gcc -O1 -m32 -fno-builtin -o z kargl.c -lm && ./z > Max ULP: 1.959975 > Count: 0 > $ gcc -O2 -m32 -fno-builtin -o z kargl.c -lm && ./z > Max ULP: nan > Count: 0 > $ gcc -O3 -m32 -fno-builtin -o z kargl.c -lm && ./z > Max ULP: nan > Count: 0 > > Uh. > > kargl.c: In function ‘main’: > kargl.c:80:10: warning: ‘u’ may be used uninitialized in this function > [-Wmaybe-uninitialized] > if (ur > u) u = ur; > ^ Whoops. There are a number of variations on a theme named a.c. Initializing u to 0 doesn't change the outcome with clang on FreeBSD. -- Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190313181623.GA36061>