Bug 106344 - A few x86_64 tests fail with -march=x86-64-v2
Summary: A few x86_64 tests fail with -march=x86-64-v2
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: testsuite-fail
Depends on:
Blocks:
 
Reported: 2022-07-18 16:29 UTC by Marek Polacek
Modified: 2024-08-20 20:32 UTC (History)
2 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2022-07-18 16:29:02 UTC
The following tests fail when -march=x86-64-v2 is the default:

gcc.dg/vect/bb-slp-57.c
gcc.dg/vect/slp-21.c
gcc.dg/vect/slp-perm-9.c
gcc.target/i386/minmax-9.c
gcc.target/i386/sse2-mmx-21.c
g++.target/i386/pr98218-1.C

Can be reproduced with:
$ make check-gcc RUNTESTFLAGS='--target_board=unix\{,-march=x86-64-v2\} vect.exp=bb-slp-57.c'
$ make check-gcc RUNTESTFLAGS='--target_board=unix\{,-march=x86-64-v2\} vect.exp=slp-21.c'
$ make check-gcc RUNTESTFLAGS='--target_board=unix\{,-march=x86-64-v2\} vect.exp=slp-perm-9.c'
$ make check-gcc RUNTESTFLAGS='--target_board=unix\{,-march=x86-64-v2\} i386.exp=minmax-9.c'
$ make check-gcc RUNTESTFLAGS='--target_board=unix\{,-march=x86-64-v2\} i386.exp=sse2-mmx-21.c'
$ make check-g++ RUNTESTFLAGS='--target_board=unix\{,-march=x86-64-v2\} i386.exp=pr98218-1.C'

Would there be a way to amend the tests so that they don't fail with -march=x86-64-v2?
Comment 1 Marek Polacek 2024-08-20 17:57:06 UTC
More:

FAIL: gcc.dg/tree-ssa/pr92834.c scan-tree-dump-times optimized "MAX_EXPR <" 8
FAIL: gcc.dg/tree-ssa/pr94786.c scan-tree-dump-times optimized "MAX_EXPR <" 4

These pass with -march=x86-64.
Comment 2 Marek Polacek 2024-08-20 17:59:44 UTC
This too works with -march=x86-64 but not -march=x86-64-v2.

FAIL: gcc.dg/tree-ssa/slsr-31.c scan-tree-dump-times optimized " \\* 2" 1
Comment 3 Andrew Pinski 2024-08-20 18:03:36 UTC
(In reply to Marek Polacek from comment #1)
> More:
> 
> FAIL: gcc.dg/tree-ssa/pr92834.c scan-tree-dump-times optimized "MAX_EXPR <" 8

This is .REDUC_MAX vs MAX_EXPR .

> FAIL: gcc.dg/tree-ssa/pr94786.c scan-tree-dump-times optimized "MAX_EXPR <" 4

Likewise. Simple fix add -fno-tree-vectorize .
Comment 4 Andrew Pinski 2024-08-20 18:04:51 UTC
(In reply to Marek Polacek from comment #2)
> This too works with -march=x86-64 but not -march=x86-64-v2.
> 
> FAIL: gcc.dg/tree-ssa/slsr-31.c scan-tree-dump-times optimized " \\* 2" 1

Simple fix -fno-tree-vectorize. Since we got .REDUC_PLUS here.
Comment 5 Marek Polacek 2024-08-20 18:14:13 UTC
These too:

FAIL: gcc.target/i386/vect-double-2.c scan-tree-dump-times vect "Vectorized loops: 1" 1
FAIL: gcc.target/i386/xorsign.c scan-tree-dump-times vect "vectorized 2 loops" 1

with -march=x86-64-v2 we're able to vectorize more loops.
Comment 6 Marek Polacek 2024-08-20 19:16:58 UTC
$ make check-c RUNTESTFLAGS="--target_board=unix\{-march=x86-64-v3\} vect.exp"

shows more problematic tests:

FAIL: gcc.dg/vect/vect-92.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
FAIL: gcc.dg/vect/vect-92.c scan-tree-dump-times vect "Alignment of access forced using peeling" 3
FAIL: gcc.dg/vect/vect-cselim-1.c scan-tree-dump-times vect "vectorized 2 loops" 1
FAIL: gcc.dg/vect/vect-multitypes-1.c scan-tree-dump-times vect "Alignment of access forced using peeling" 2
FAIL: gcc.dg/vect/vect-nb-iter-ub-3.c scan-tree-dump-not cunroll "loop turned into non-loop; it never loops"
FAIL: gcc.dg/vect/vect-peel-3.c scan-tree-dump-times vect "Vectorizing an unaligned access" 1
FAIL: gcc.dg/vect/vect-peel-3.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
FAIL: gcc.dg/vect/vect-simd-clone-20.c scan-tree-dump-times vect "[\\n\\r] [^\\n]* = foo\\.simdclone" 4
FAIL: gcc.dg/vect/slp-multitypes-11-big-array.c scan-tree-dump-times vect "vectorizing stmts using SLP" 1
FAIL: gcc.dg/vect/slp-3-big-array.c scan-tree-dump-times vect "vectorizing stmts using SLP" 4
FAIL: gcc.dg/vect/slp-reduc-1.c scan-tree-dump-times vect "vectorizing stmts using SLP" 1
FAIL: gcc.dg/vect/bb-slp-cond-1.c scan-tree-dump-times vect "loop vectorized" 1
FAIL: gcc.dg/vect/bb-slp-subgroups-3.c scan-tree-dump-times slp2 "optimized: basic block" 2
FAIL: gcc.dg/vect/vect-92.c -flto -ffat-lto-objects  scan-tree-dump-times vect "Vectorizing an unaligned access" 0
FAIL: gcc.dg/vect/vect-92.c -flto -ffat-lto-objects  scan-tree-dump-times vect "Alignment of access forced using peeling" 3
XPASS: gcc.dg/vect/tsvc/vect-tsvc-vif.c scan-tree-dump vect "vectorized 1 loops"
FAIL: gcc.dg/vect/vect-cselim-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "vectorized 2 loops" 1
FAIL: gcc.dg/vect/vect-multitypes-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "Alignment of access forced using peeling" 2
FAIL: gcc.dg/vect/vect-nb-iter-ub-3.c -flto -ffat-lto-objects  scan-tree-dump-not cunroll "loop turned into non-loop; it never loops"
FAIL: gcc.dg/vect/vect-peel-3.c -flto -ffat-lto-objects  scan-tree-dump-times vect "Vectorizing an unaligned access" 1
FAIL: gcc.dg/vect/vect-peel-3.c -flto -ffat-lto-objects  scan-tree-dump-times vect "Alignment of access forced using peeling" 1
FAIL: gcc.dg/vect/slp-3-big-array.c -flto -ffat-lto-objects  scan-tree-dump-times vect "vectorizing stmts using SLP" 4
FAIL: gcc.dg/vect/slp-reduc-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "vectorizing stmts using SLP" 1
FAIL: gcc.dg/vect/slp-multitypes-11-big-array.c -flto -ffat-lto-objects  scan-tree-dump-times vect "vectorizing stmts using SLP" 1
FAIL: gcc.dg/vect/bb-slp-cond-1.c -flto -ffat-lto-objects  scan-tree-dump-times vect "loop vectorized" 1
FAIL: gcc.dg/vect/bb-slp-subgroups-3.c -flto -ffat-lto-objects  scan-tree-dump-times slp2 "optimized: basic block" 2
FAIL: gcc.dg/vect/no-section-anchors-vect-31.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
FAIL: gcc.dg/vect/no-section-anchors-vect-31.c scan-tree-dump-times vect "Alignment of access forced using peeling" 2
FAIL: gcc.dg/vect/no-section-anchors-vect-64.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
FAIL: gcc.dg/vect/no-section-anchors-vect-64.c scan-tree-dump-times vect "Alignment of access forced using peeling" 2