[Bug target/88530] [8 Regression] AArch64 Unsupported options passed to assemblers when it doesn't need to.

2019-03-06 Thread tnfchris at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88530

Tamar Christina  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Tamar Christina  ---
Backport committed.

[Bug target/88530] [8 Regression] AArch64 Unsupported options passed to assemblers when it doesn't need to.

2019-03-06 Thread tnfchris at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88530

--- Comment #9 from Tamar Christina  ---
Author: tnfchris
Date: Wed Mar  6 09:49:00 2019
New Revision: 269413

URL: https://gcc.gnu.org/viewcvs?rev=269413=gcc=rev
Log:
AArch64: Fix command line options canonicalization version.

Commandline options on AArch64 don't get canonicalized into the smallest
possible set before output to the assembler. This means that overlapping
feature
sets are emitted with superfluous parts.

Normally this isn't an issue, but in the case of crypto we have retro-actively
split it into aes and sha2. We need to emit only +crypto to the assembler
so old assemblers continue to work.

Because of how -mcpu=native and -march=native work they end up enabling all
feature bits. Instead we need to get the smallest possible set, which would
also
fix the problem with older the assemblers and the retro-active split.

The function that handles this is called quite often.  It is called for any
push/pop options or attribute that changes arch, cpu etc.  In order to not make
this search for the smallest set too expensive we sort the options based on the
number of features (bits) they enable.  This allows us to process the list
linearly instead of quadratically (Once we have enabled a feature, we know that
anything else that enables it can be ignored.  By sorting we'll get the biggest
groups first and thus the smallest combination of commandline flags).

The Option handling structures have been extended to have a boolean to indicate
whether the option is synthetic, with that I mean if the option flag itself
enables a new feature.

e.g. +crypto isn't an actual feature, it just enables other features, but
others
like +rdma enable multiple dependent features but is itself also a feature.

There are two ways to solve this.

1) Either have the options that are feature bits also turn themselves on, e.g.
   change rdma to turn on FP, SIMD and RDMA as dependency bits.

2) Make a distinction between these two different type of features and have the
   framework handle it correctly.

Even though it's more code I went for the second approach, as it's the one
that'll be less fragile (people can't forget it) and gives the least surprises.

Effectively this patch changes the following:

The values before the => are the old compiler and after the => the new code.

-march=armv8.2-a+crypto+sha2 => -march=armv8.2-a+crypto
-march=armv8.2-a+sha2+aes => -march=armv8.2-a+crypto

The remaining behaviors stay the same.

gcc/ChangeLog:

Backport from trunk.
2019-02-25  Tamar Christina  

PR target/88530
* common/config/aarch64/aarch64-common.c
(struct aarch64_option_extension): Add is_synthetic.
(all_extensions): Use it.
(TARGET_OPTION_INIT_STRUCT): Define hook.
(struct gcc_targetm_common): Moved to end.
(all_extensions_by_on): New.
(opt_ext_cmp, typedef opt_ext): New.
(aarch64_option_init_struct): New.
(aarch64_contains_opt): New.
(aarch64_get_extension_string_for_isa_flags): Output smallest set.
* config/aarch64/aarch64-option-extensions.def
(AARCH64_OPT_EXTENSION): Explicitly include AES and SHA2 in crypto.
(fp, simd, crc, lse, fp16, rcpc, rdma, dotprod, aes, sha2, sha3,
sm4, fp16fml, sve):
Set is_synthetic to false.
(crypto): Set is_synthetic to true.
* config/aarch64/driver-aarch64.c (AARCH64_OPT_EXTENSION): Add
SYNTHETIC.

gcc/testsuite/ChangeLog:

Backport from trunk.
2019-02-25  Tamar Christina  

PR target/88530
* gcc.target/aarch64/options_set_1.c: New test.
* gcc.target/aarch64/options_set_2.c: New test.
* gcc.target/aarch64/options_set_3.c: New test.
* gcc.target/aarch64/options_set_4.c: New test.
* gcc.target/aarch64/options_set_5.c: New test.
* gcc.target/aarch64/options_set_6.c: New test.
* gcc.target/aarch64/options_set_7.c: New test.
* gcc.target/aarch64/options_set_8.c: New test.
* gcc.target/aarch64/options_set_9.c: New test.


Added:
branches/gcc-8-branch/gcc/testsuite/gcc.target/aarch64/options_set_1.c
branches/gcc-8-branch/gcc/testsuite/gcc.target/aarch64/options_set_2.c
branches/gcc-8-branch/gcc/testsuite/gcc.target/aarch64/options_set_3.c
branches/gcc-8-branch/gcc/testsuite/gcc.target/aarch64/options_set_4.c
branches/gcc-8-branch/gcc/testsuite/gcc.target/aarch64/options_set_5.c
branches/gcc-8-branch/gcc/testsuite/gcc.target/aarch64/options_set_6.c
branches/gcc-8-branch/gcc/testsuite/gcc.target/aarch64/options_set_7.c
branches/gcc-8-branch/gcc/testsuite/gcc.target/aarch64/options_set_8.c
branches/gcc-8-branch/gcc/testsuite/gcc.target/aarch64/options_set_9.c
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/common/config/aarch64/aarch64-common.c
branches/gcc-8-branch/gcc/config/aarch64/aarch64-option-extensions.def

[Bug target/88530] [8 Regression] AArch64 Unsupported options passed to assemblers when it doesn't need to.

2019-03-06 Thread tnfchris at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88530

--- Comment #8 from Tamar Christina  ---
Author: tnfchris
Date: Wed Mar  6 09:34:04 2019
New Revision: 269412

URL: https://gcc.gnu.org/viewcvs?rev=269412=gcc=rev
Log:
AArch64: Have empty HWCAPs string ignored during native feature detection.

This patch makes the feature detection code for AArch64 GCC not add features
automatically when the feature had no hwcaps string to match against.

This means that -mcpu=native no longer adds feature flags such as +profile.
The behavior wasn't noticed before because at the time +profile was added a bug
was preventing any feature bits from being added by native detections.

The loop has also been changed as Jakub specified in order to avoid a memory
leak that was present in the existing code and to be slightly more efficient.

gcc/ChangeLog:

Backport from trunk.
2019-02-28  Tamar Christina  

PR target/88530
* config/aarch64/aarch64-option-extensions.def: Document it.
* config/aarch64/driver-aarch64.c (host_detect_local_cpu): Skip feature
if empty hwcaps.

gcc/testsuite/ChangeLog:

Backport from trunk.
2019-02-28  Tamar Christina  

PR target/88530
* gcc.target/aarch64/options_set_10.c: New test.


Added:
branches/gcc-8-branch/gcc/testsuite/gcc.target/aarch64/options_set_10.c
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/config/aarch64/aarch64-option-extensions.def
branches/gcc-8-branch/gcc/config/aarch64/driver-aarch64.c
branches/gcc-8-branch/gcc/testsuite/ChangeLog

[Bug target/88530] [8 Regression] AArch64 Unsupported options passed to assemblers when it doesn't need to.

2019-03-04 Thread tnfchris at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88530

--- Comment #7 from Tamar Christina  ---
Author: tnfchris
Date: Mon Mar  4 15:48:49 2019
New Revision: 269366

URL: https://gcc.gnu.org/viewcvs?rev=269366=gcc=rev
Log:
AArch64: Make test options_set_10.c not run on native.

The test options_set_10.c shouldn't run when cross compiled.
In addition to gating it on linux I'm also gating it on native now.

gcc/testsuite/ChangeLog:

PR target/88530
* gcc.target/aarch64/options_set_10.c:


Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.target/aarch64/options_set_10.c

[Bug target/88530] [8 Regression] AArch64 Unsupported options passed to assemblers when it doesn't need to.

2019-02-28 Thread tnfchris at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88530

Tamar Christina  changed:

   What|Removed |Added

Summary|[8/9 Regression] AArch64|[8 Regression] AArch64
   |Unsupported options passed  |Unsupported options passed
   |to assemblers when it   |to assemblers when it
   |doesn't need to.|doesn't need to.

--- Comment #6 from Tamar Christina  ---
Fixed In trunk.