Fix libgfortran FMA3/FMA4 tests

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Sun May 28 18:56:00 GMT 2017


The recent libgfortran AVX128 patch broke bootstrap on Solaris/x86 with
the native assembler.  libgfortran compilation fails like this:

Assembler: matmulavx128_r8.c
        "/var/tmp//cc51E6lb.s", line 5811 : Illegal mnemonic
        Near line: "    vfmaddpd        %xmm0, (%edi), %xmm5, %xmm7"
        "/var/tmp//cc51E6lb.s", line 5811 : Syntax error
        Near line: "    vfmaddpd        %xmm0, (%edi), %xmm5, %xmm7"
[...]
Too many errors - Goodbye
make[3]: *** [Makefile:4663: matmulavx128_r8.lo] Error 1

and several more.

It turns out that the FMA3 and FMA4 tests in acinclude.m4 don't test
what they claim to:  if one compiles the test program

float
flt_mul_add (float a, float b, float c)
{
	return __builtin_fmaf (a, b, c);
}

with -O2 -mfma -mno-fma4 (FMA3) resp. -O2 -mfma4 -mno-fma (FMA4), both
boil done to

flt_mul_add:
        jmp     fmaf

so the test always succeeds.

The following patch fixes this by instead using the tests from
gcc.target/i386/i386.exp.  While the FMA3 test still passes with
/bin/as, the FMA4 one fails, avoiding the breakage.

Bootstrapped on i386-pc-solaris2.12 with both as and gas without
regressions.

Ok for mainline?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2017-05-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* acinclude.m4 (LIBGFOR_CHECK_FMA3): Use test from
	check_effective_target_fma in gcc.target/i386/i386.exp.
	(LIBGFOR_CHECK_FMA4): Use test from check_effective_target_fma4.
	* configure: Regenerate.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: solx86-libgfortran-fma34.patch
Type: text/x-patch
Size: 1524 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170528/e8193f6e/attachment.bin>


More information about the Gcc-patches mailing list