[flac-dev] About "attempt to fix differences between x86 FPU and SSE calculations"

lvqcl lvqcl.mail at gmail.com
Sat Mar 22 01:17:12 PDT 2014

Olivier Tristan <o.tristan at uvi.net> писал(а) в своём письме Fri, 21 Mar 2014 22:41:00 +0400:

> Check with -mfpmath=387 to be sure that x87 FPU code is used and not some
> SSE optim made by GCC

I added "XIPH_ADD_CFLAGS([-mfpmath=387])" into configure.ac
Still the result is different from SSE version.


MSVS adds two instructions to the generated code after the patch:

	fld	DWORD PTR [eax]
	inc	ecx
	fmul	ST(0), ST(1)
	add	eax, 4
	fstp	DWORD PTR tv2337[esp+20]    <- this: (copy from FP stack to tmp)
	fld	DWORD PTR tv2337[esp+20]    <- and this (copy from tmp to FP stack)
	fadd	DWORD PTR [ebx+ecx*4-4]
	fstp	DWORD PTR [ebx+ecx*4-4]

However GCC doesn't do this:

	lea	ecx, [eax+2]
	fld	DWORD PTR [edx+ecx*4]
	fmul	st, st(1)
	fadd	DWORD PTR [ebx+ecx*4]
	fstp	DWORD PTR [ebx+ecx*4]

Also MSVS doesn't add these instructions if Floating Point Model is set to Fast (/fp:fast).

More information about the flac-dev mailing list