Bug 88265 - [9 Regression] gfortran.dg/simd-builtins-1.f90 fails when using --with-arch=...
Summary: [9 Regression] gfortran.dg/simd-builtins-1.f90 fails when using --with-arch=...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: 9.0
Assignee: Martin Liška
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-29 15:21 UTC by janus
Modified: 2018-11-30 10:50 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-11-29 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2018-11-29 15:21:16 UTC
When regtesting the current trunk on x86_64-linux-gnu, I see the following failures:

FAIL: gfortran.dg/simd-builtins-1.f90   -O   scan-assembler call.*_ZGVbN4v_sinf
FAIL: gfortran.dg/simd-builtins-6.f90   -O   scan-assembler call.*_ZGVbN4v_sinf

Both test cases expect the assembly to contain a call to "_ZGVbN4v_sinf", but what I see on my system is a call to "_ZGVdN8v_sinf".
Comment 1 janus 2018-11-29 15:26:58 UTC
The test case was added in (In reply to janus from comment #0)
> Both test cases expect the assembly to contain a call to "_ZGVbN4v_sinf",
> but what I see on my system is a call to "_ZGVdN8v_sinf".

Those tests were added in r266509. Martin, do you understand how this comes about?
Comment 2 janus 2018-11-29 16:04:19 UTC
(In reply to janus from comment #0)
> Both test cases expect the assembly to contain a call to "_ZGVbN4v_sinf",
> but what I see on my system is a call to "_ZGVdN8v_sinf".

That was on a haswell machine. On a skylake CPU I even see:

	call	_ZGVeN16v_sinf

So apparently I get broader vector calls than expected. Note that this seems to happen only when configuring with --with-arch=... (e.g. haswell or skylake-avx512 
).
Comment 3 Martin Liška 2018-11-29 17:38:45 UTC
Yes, you have wider vector. I'll add tomorrow -march=haswell that will force the expected width.
Comment 4 Martin Liška 2018-11-29 17:39:17 UTC
Mine.
Comment 5 Jakub Jelinek 2018-11-29 18:33:22 UTC
Instead of adding -march= please add instead say -mavx2 -mno-avx512f or whatever ISA set you want to pick, and probably also -mprefer-vector-width=256 or what you want.  Otherwise people can still override it with --target_board etc., say through -mtune= in there, or through -mISA options.
Comment 6 janus 2018-11-30 10:11:17 UTC
(In reply to Jakub Jelinek from comment #5)
> Instead of adding -march= please add instead say -mavx2 -mno-avx512f or
> whatever ISA set you want to pick, and probably also
> -mprefer-vector-width=256 or what you want.

I guess it might be a good idea to have different variants of the test case that check the correct vector widths for AVX, AVX2, AVX512, etc. Of course one would need to make sure that e.g. the AVX512 variant is only executed on AVX512 hardware (e.g. skylake CPU).
Comment 7 Martin Liška 2018-11-30 10:50:09 UTC
Author: marxin
Date: Fri Nov 30 10:48:51 2018
New Revision: 266660

URL: https://gcc.gnu.org/viewcvs?rev=266660&root=gcc&view=rev
Log:
Restrict vector extension to use 128bit vectors (PR testsuite/88265).

2018-11-30  Martin Liska  <mliska@suse.cz>

	PR testsuite/88265
	* gfortran.dg/simd-builtins-1.f90: Restrict to 128b vectors.
	* gfortran.dg/simd-builtins-6.f90: Likewise.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/simd-builtins-1.f90
    trunk/gcc/testsuite/gfortran.dg/simd-builtins-6.f90
Comment 8 Martin Liška 2018-11-30 10:50:22 UTC
Fixed.