]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
10 months agoDaily bump.
GCC Administrator [Sun, 8 Sep 2024 00:20:33 +0000 (00:20 +0000)] 
Daily bump.

10 months agoDaily bump.
GCC Administrator [Sat, 7 Sep 2024 00:18:42 +0000 (00:18 +0000)] 
Daily bump.

10 months agoDaily bump.
GCC Administrator [Fri, 6 Sep 2024 00:19:57 +0000 (00:19 +0000)] 
Daily bump.

10 months agoipa: Don't disable function parameter analysis for fat LTO
H.J. Lu [Tue, 27 Aug 2024 20:11:39 +0000 (13:11 -0700)] 
ipa: Don't disable function parameter analysis for fat LTO

Update analyze_parms not to disable function parameter analysis for
-ffat-lto-objects.  Tested on x86-64, there are no differences in zstd
with "-O2 -flto=auto" -g "vs -O2 -flto=auto -g -ffat-lto-objects".

PR ipa/116410
* ipa-modref.cc (analyze_parms): Always analyze function parameter
for LTO.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 2f1689ea8e631ebb4ff3720d56ef0362f5898ff6)

10 months agoDaily bump.
GCC Administrator [Thu, 5 Sep 2024 00:20:00 +0000 (00:20 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Wed, 4 Sep 2024 00:25:58 +0000 (00:25 +0000)] 
Daily bump.

11 months agoi386: Fix vfpclassph non-optimizied intrin
Haochen Jiang [Mon, 2 Sep 2024 07:00:22 +0000 (15:00 +0800)] 
i386: Fix vfpclassph non-optimizied intrin

The intrin for non-optimized got a typo in mask type, which will cause
the high bits of __mmask32 being unexpectedly zeroed.

The test does not fail under O0 with current 1b since the testcase is
wrong. We need to include avx512-mask-type.h after SIZE is defined, or
it will always be __mmask8. That problem also happened in AVX10.2 testcases.
I will write a seperate patch to fix that.

gcc/ChangeLog:

* config/i386/avx512fp16intrin.h
(_mm512_mask_fpclass_ph_mask): Correct mask type to __mmask32.
(_mm512_fpclass_ph_mask): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fp16-vfpclassph-1c.c: New test.

11 months agoDaily bump.
GCC Administrator [Tue, 3 Sep 2024 00:23:54 +0000 (00:23 +0000)] 
Daily bump.

11 months agoCheck avx upper register for parallel.
liuhongt [Thu, 29 Aug 2024 03:39:20 +0000 (11:39 +0800)] 
Check avx upper register for parallel.

For function arguments/return, when it's BLK mode, it's put in a
parallel with an expr_list, and the expr_list contains the real mode
and registers.
Current ix86_check_avx_upper_register only checked for SSE_REG_P, and
failed to handle that. The patch extend the handle to each subrtx.

gcc/ChangeLog:

PR target/116512
* config/i386/i386.cc (ix86_check_avx_upper_register): Iterate
subrtx to scan for avx upper register.
(ix86_check_avx_upper_stores): Inline old
ix86_check_avx_upper_register.
(ix86_avx_u128_mode_needed): Ditto, and replace
FOR_EACH_SUBRTX with call to new
ix86_check_avx_upper_register.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr116512.c: New test.

(cherry picked from commit ab214ef734bfc3dcffcf79ff9e1dd651c2b40566)

11 months agoDaily bump.
GCC Administrator [Mon, 2 Sep 2024 00:20:58 +0000 (00:20 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Sun, 1 Sep 2024 00:29:35 +0000 (00:29 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Sat, 31 Aug 2024 00:20:04 +0000 (00:20 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Fri, 30 Aug 2024 00:24:32 +0000 (00:24 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Thu, 29 Aug 2024 00:21:13 +0000 (00:21 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Wed, 28 Aug 2024 00:21:21 +0000 (00:21 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Mon, 26 Aug 2024 00:20:27 +0000 (00:20 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Sun, 25 Aug 2024 00:20:22 +0000 (00:20 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Sat, 24 Aug 2024 00:19:20 +0000 (00:19 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Fri, 23 Aug 2024 00:18:43 +0000 (00:18 +0000)] 
Daily bump.

11 months agoFix testcase failure.
liuhongt [Thu, 22 Aug 2024 06:31:40 +0000 (14:31 +0800)] 
Fix testcase failure.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pieces-memcpy-10.c: Use -mmove-max=256 and
-mstore-max=256.
* gcc.target/i386/pieces-memcpy-6.c: Ditto.
* gcc.target/i386/pieces-memset-38.c: Ditto.
* gcc.target/i386/pieces-memset-40.c: Ditto.
* gcc.target/i386/pieces-memset-41.c: Ditto.
* gcc.target/i386/pieces-memset-42.c: Ditto.
* gcc.target/i386/pieces-memset-43.c: Ditto.
* gcc.target/i386/pieces-strcpy-2.c: Ditto.

(cherry picked from commit ea9c508927ec032c6d67a24df59ffa429e4d3d95)

11 months agoAlign ix86_{move_max,store_max} with vectorizer.
liuhongt [Thu, 15 Aug 2024 04:54:07 +0000 (12:54 +0800)] 
Align ix86_{move_max,store_max} with vectorizer.

When none of mprefer-vector-width, avx256_optimal/avx128_optimal,
avx256_store_by_pieces/avx512_store_by_pieces is specified, GCC will
set ix86_{move_max,store_max} as max available vector length except
for AVX part.

      if (TARGET_AVX512F_P (opts->x_ix86_isa_flags)
  && TARGET_EVEX512_P (opts->x_ix86_isa_flags2))
opts->x_ix86_move_max = PVW_AVX512;
      else
opts->x_ix86_move_max = PVW_AVX128;

So for -mavx2, vectorizer will choose 256-bit for vectorization, but
128-bit is used for struct copy, there could be a potential STLF issue
due to this "misalign".

The patch fixes that.

gcc/ChangeLog:

* config/i386/i386-options.cc (ix86_option_override_internal):
set ix86_{move_max,store_max} to PVW_AVX256 when TARGET_AVX
instead of PVW_AVX128.

gcc/testsuite/ChangeLog:
* gcc.target/i386/pieces-memcpy-10.c: Add -mprefer-vector-width=128.
* gcc.target/i386/pieces-memcpy-6.c: Ditto.
* gcc.target/i386/pieces-memset-38.c: Ditto.
* gcc.target/i386/pieces-memset-40.c: Ditto.
* gcc.target/i386/pieces-memset-41.c: Ditto.
* gcc.target/i386/pieces-memset-42.c: Ditto.
* gcc.target/i386/pieces-memset-43.c: Ditto.
* gcc.target/i386/pieces-strcpy-2.c: Ditto.
* gcc.target/i386/pieces-memcpy-22.c: New test.
* gcc.target/i386/pieces-memset-51.c: New test.
* gcc.target/i386/pieces-strcpy-3.c: New test.

(cherry picked from commit aea374238cec1a1e53fb79575d2f998e16926999)

11 months agoDaily bump.
GCC Administrator [Thu, 22 Aug 2024 00:19:44 +0000 (00:19 +0000)] 
Daily bump.

11 months ago[testsuite] [arm] [vect] adjust mve-vshr test [PR113281]
Alexandre Oliva [Wed, 26 Jun 2024 05:08:18 +0000 (02:08 -0300)] 
[testsuite] [arm] [vect] adjust mve-vshr test [PR113281]

The test was too optimistic, alas.  We used to vectorize shifts by
clamping the shift counts below the bit width of the types (e.g. at 15
for 16-bit vector elements), but (uint16_t)32768 >> (uint16_t)16 is
well defined (because of promotion to 32-bit int) and must yield 0,
not 1 (as before the fix).

Unfortunately, in the gimple model of vector units, such large shift
counts wouldn't be well-defined, so we won't vectorize such shifts any
more, unless we can tell they're in range or undefined.

So the test that expected the vectorization we no longer performed
needs to be adjusted.  Instead of nobbling the test, Richard Earnshaw
suggested annotating the test with the expected ranges so as to enable
the optimization, and Christophe Lyon suggested a further
simplification.

Co-Authored-By: Richard Earnshaw <Richard.Earnshaw@arm.com>
for  gcc/testsuite/ChangeLog

PR tree-optimization/113281
* gcc.target/arm/simd/mve-vshr.c: Add expected ranges.

(cherry picked from commit 54d2339c9f87f702e02e571a5460e11c19e1c02f)

11 months agoDaily bump.
GCC Administrator [Wed, 21 Aug 2024 00:20:08 +0000 (00:20 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Tue, 20 Aug 2024 00:19:54 +0000 (00:19 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Mon, 19 Aug 2024 00:19:05 +0000 (00:19 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Sun, 18 Aug 2024 00:18:49 +0000 (00:18 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Sat, 17 Aug 2024 00:18:53 +0000 (00:18 +0000)] 
Daily bump.

11 months agoaarch64: Fix bogus cnot optimisation [PR114603]
Richard Sandiford [Fri, 16 Aug 2024 14:37:50 +0000 (15:37 +0100)] 
aarch64: Fix bogus cnot optimisation [PR114603]

aarch64-sve.md had a pattern that combined:

cmpeq pb.T, pa/z, zc.T, #0
mov zd.T, pb/z, #1

into:

cnot zd.T, pa/m, zc.T

But this is only valid if pa.T is a ptrue.  In other cases, the
original would set inactive elements of zd.T to 0, whereas the
combined form would copy elements from zc.T.

gcc/
PR target/114603
* config/aarch64/aarch64-sve.md (@aarch64_pred_cnot<mode>): Replace
with...
(@aarch64_ptrue_cnot<mode>): ...this, requiring operand 1 to be
a ptrue.
(*cnot<mode>): Require operand 1 to be a ptrue.
* config/aarch64/aarch64-sve-builtins-base.cc (svcnot_impl::expand):
Use aarch64_ptrue_cnot<mode> for _x operations that are predicated
with a ptrue.  Represent other _x operations as fully-defined _m
operations.

gcc/testsuite/
PR target/114603
* gcc.target/aarch64/sve/acle/general/cnot_1.c: New test.

(cherry picked from commit 67cbb1c638d6ab3a9cb77e674541e2b291fb67df)

11 months agoaarch64: Fix expansion of svsudot [PR114607]
Richard Sandiford [Fri, 16 Aug 2024 14:37:50 +0000 (15:37 +0100)] 
aarch64: Fix expansion of svsudot [PR114607]

Not sure how this happend, but: svsudot is supposed to be expanded
as USDOT with the operands swapped.  However, a thinko in the
expansion of svsudot meant that the arguments weren't in fact
swapped; the attempted swap was just a no-op.  And the testcases
blithely accepted that.

gcc/
PR target/114607
* config/aarch64/aarch64-sve-builtins-base.cc
(svusdot_impl::expand): Fix botched attempt to swap the operands
for svsudot.

gcc/testsuite/
PR target/114607
* gcc.target/aarch64/sve/acle/asm/sudot_s32.c: New test.

(cherry picked from commit 2c1c2485a4b1aca746ac693041e51ea6da5c64ca)

11 months agoDaily bump.
GCC Administrator [Fri, 16 Aug 2024 00:19:08 +0000 (00:19 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Thu, 15 Aug 2024 00:22:33 +0000 (00:22 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Wed, 14 Aug 2024 00:19:54 +0000 (00:19 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Tue, 13 Aug 2024 00:20:00 +0000 (00:20 +0000)] 
Daily bump.

11 months agoRefine constraint "Bk" to define_special_memory_constraint.
liuhongt [Wed, 24 Jul 2024 03:29:23 +0000 (11:29 +0800)] 
Refine constraint "Bk" to define_special_memory_constraint.

For below pattern, RA may still allocate r162 as v/k register, try to
reload for address with leaq __libc_tsd_CTYPE_B@gottpoff(%rip), %rsi
which result a linker error.

(set (reg:DI 162)
     (mem/u/c:DI
       (const:DI (unspec:DI
 [(symbol_ref:DI ("a") [flags 0x60]  <var_decl 0x7f621f6e1c60 a>)]
 UNSPEC_GOTNTPOFF))

Quote from H.J for why linker issue an error.
>What do these do:
>
>        leaq    __libc_tsd_CTYPE_B@gottpoff(%rip), %rax
>        vmovq   (%rax), %xmm0
>
>From x86-64 TLS psABI:
>
>The assembler generates for the x@gottpoff(%rip) expressions a R X86
>64 GOTTPOFF relocation for the symbol x which requests the linker to
>generate a GOT entry with a R X86 64 TPOFF64 relocation. The offset of
>the GOT entry relative to the end of the instruction is then used in
>the instruction. The R X86 64 TPOFF64 relocation is pro- cessed at
>program startup time by the dynamic linker by looking up the symbol x
>in the modules loaded at that point. The offset is written in the GOT
>entry and later loaded by the addq instruction.
>
>The above code sequence looks wrong to me.

gcc/ChangeLog:

PR target/116043
* config/i386/constraints.md (Bk): Refine to
define_special_memory_constraint.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr116043.c: New test.

(cherry picked from commit bc1fda00d5f20e2f3e77a50b2822562b6e0040b2)

11 months agoDaily bump.
GCC Administrator [Mon, 12 Aug 2024 00:20:04 +0000 (00:20 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Sun, 11 Aug 2024 00:19:37 +0000 (00:19 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Sat, 10 Aug 2024 00:20:01 +0000 (00:20 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Fri, 9 Aug 2024 00:20:31 +0000 (00:20 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Thu, 8 Aug 2024 00:20:19 +0000 (00:20 +0000)] 
Daily bump.

11 months agoDaily bump.
GCC Administrator [Wed, 7 Aug 2024 00:18:20 +0000 (00:18 +0000)] 
Daily bump.

11 months agohppa: Fix (plus (plus (mult (a) (mem_shadd_constant)) (b)) (c)) optimization
John David Anglin [Tue, 6 Aug 2024 17:40:26 +0000 (13:40 -0400)] 
hppa: Fix (plus (plus (mult (a) (mem_shadd_constant)) (b)) (c)) optimization

The constant C must be an integral multiple of the shift value in
the above optimization.  Non integral values can occur evaluating
IMAGPART_EXPR when the shadd constant is 8 and we have SFmode.

2024-08-06  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

PR target/113384
* config/pa/pa.cc (hppa_legitimize_address): Add check to
ensure constant is an integral multiple of shift the value.

11 months agosh: Don't call make_insn_raw in sh_recog_treg_set_expr [PR116189]
Andrew Pinski [Sat, 3 Aug 2024 16:30:57 +0000 (09:30 -0700)] 
sh: Don't call make_insn_raw in sh_recog_treg_set_expr [PR116189]

This was an interesting compare debug failure to debug. The first symptom
was in gcse which would produce different order of creating psedu-registers. This
was caused by a different order of a hashtable walk, due to the hash table having different
number of entries. Which in turn was due to the number of max insn being different between
the 2 runs. The place max insn uid comes from was in sh_recog_treg_set_expr which is called
via rtx_costs and fwprop would cause rtx_costs in some cases for debug insn related stuff.

Build and tested for sh4-linux-gnu.

PR target/116189

gcc/ChangeLog:

* config/sh/sh.cc (sh_recog_treg_set_expr): Don't call make_insn_raw,
make the insn with a fake uid.

gcc/testsuite/ChangeLog:

* c-c++-common/torture/pr116189-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
(cherry picked from commit 0355c943b9e954e8f59068971d934f1b91ecb729)

11 months agoDaily bump.
GCC Administrator [Tue, 6 Aug 2024 00:18:50 +0000 (00:18 +0000)] 
Daily bump.

11 months agolibgomp: Remove bogus warnings from privatized-ref-2.f90.
Paul Thomas [Fri, 19 Jul 2024 15:58:33 +0000 (16:58 +0100)] 
libgomp: Remove bogus warnings from privatized-ref-2.f90.

2024-07-19  Paul Thomas  <pault@gcc.gnu.org>

libgomp/ChangeLog

* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Cut
dg-note about 'a' and remove bogus warnings about its array
descriptor components being used uninitialized.

(cherry picked from commit 8d6994f33a98a168151a57a3d21395b19196cd9d)

11 months agoFortran: Suppress bogus used uninitialized warnings [PR108889].
Paul Thomas [Thu, 18 Jul 2024 07:51:35 +0000 (08:51 +0100)] 
Fortran: Suppress bogus used uninitialized warnings [PR108889].

2024-07-18  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/108889
* gfortran.h: Add bit field 'allocated_in_scope' to gfc_symbol.
* trans-array.cc (gfc_array_allocate): Set 'allocated_in_scope'
after allocation if not a component reference.
(gfc_alloc_allocatable_for_assignment): If 'allocated_in_scope'
not set, not a component ref and not allocated, set the array
bounds and offset to give zero length in all dimensions. Then
set allocated_in_scope.

gcc/testsuite/
PR fortran/108889
* gfortran.dg/pr108889.f90: New test.

(cherry picked from commit c3aa339ea50f050caf7ed2e497f5499ec2d7b9cc)

12 months agoDaily bump.
GCC Administrator [Mon, 5 Aug 2024 00:18:15 +0000 (00:18 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Sun, 4 Aug 2024 00:18:24 +0000 (00:18 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Sat, 3 Aug 2024 00:19:48 +0000 (00:19 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Fri, 2 Aug 2024 00:20:36 +0000 (00:20 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Thu, 1 Aug 2024 00:21:27 +0000 (00:21 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Wed, 31 Jul 2024 00:20:45 +0000 (00:20 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Tue, 30 Jul 2024 00:20:00 +0000 (00:20 +0000)] 
Daily bump.

12 months agoi386: Use _mm_setzero_ps/d instead of _mm_avx512_setzero_ps/d for GCC13/12
Haochen Jiang [Mon, 29 Jul 2024 06:10:49 +0000 (14:10 +0800)] 
i386: Use _mm_setzero_ps/d instead of _mm_avx512_setzero_ps/d for GCC13/12

In GCC13/12, there is no _mm_avx512_setzero_ps/d since it is introduced
in GCC14.

gcc/ChangeLog:

* config/i386/avx512dqintrin.h (_mm_reduce_round_sd): Use
_mm_setzero_pd instead of _mm_avx512_setzero_pd.
(_mm_reduce_round_ss): Use _mm_setzero_ps instead of
_mm_avx512_setzero_ps.

12 months agoi386: Fix AVX512 intrin macro typo
Haochen Jiang [Thu, 25 Jul 2024 08:12:20 +0000 (16:12 +0800)] 
i386: Fix AVX512 intrin macro typo

There are several typo in AVX512 intrins macro define. Correct them to solve
errors when compiled with -O0.

gcc/ChangeLog:

* config/i386/avx512dqintrin.h
(_mm_mask_fpclass_ss_mask): Correct operand order.
(_mm_mask_fpclass_sd_mask): Ditto.
(_mm256_maskz_reduce_round_ss): Use __builtin_ia32_reducess_mask_round
instead of __builtin_ia32_reducesd_mask_round.
(_mm_reduce_round_sd): Use -1 as mask since it is non-mask.
(_mm_reduce_round_ss): Ditto.
* config/i386/avx512vlbwintrin.h
(_mm256_mask_alignr_epi8): Correct operand usage.
(_mm_mask_alignr_epi8): Ditto.
* config/i386/avx512vlintrin.h (_mm_mask_alignr_epi64): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512bw-vpalignr-1b.c: New test.
* gcc.target/i386/avx512dq-vfpclasssd-1b.c: Ditto.
* gcc.target/i386/avx512dq-vfpclassss-1b.c: Ditto.
* gcc.target/i386/avx512dq-vreducesd-1b.c: Ditto.
* gcc.target/i386/avx512dq-vreducess-1b.c: Ditto.
* gcc.target/i386/avx512vl-valignq-1b.c: Ditto.

12 months agoDaily bump.
GCC Administrator [Mon, 29 Jul 2024 00:19:56 +0000 (00:19 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Sun, 28 Jul 2024 00:20:21 +0000 (00:20 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Sat, 27 Jul 2024 00:19:32 +0000 (00:19 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Fri, 26 Jul 2024 00:19:49 +0000 (00:19 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Thu, 25 Jul 2024 00:21:26 +0000 (00:21 +0000)] 
Daily bump.

12 months agors6000: Catch unsupported ABI errors when using -mrop-protect [PR114759,PR115988]
Peter Bergner [Thu, 18 Jul 2024 23:01:46 +0000 (18:01 -0500)] 
rs6000: Catch unsupported ABI errors when using -mrop-protect [PR114759,PR115988]

2024-07-18  Peter Bergner  <bergner@linux.ibm.com>

gcc/testsuite/
PR target/114759
PR target/115988
* gcc.target/powerpc/pr114759-3.c: Catch unsupported ABI errors.

(cherry picked from commit b2f47a5c1d5204131660ea0372a08e692df8844e)

12 months agors6000: Error on CPUs and ABIs that don't support the ROP protection insns [PR114759]
Peter Bergner [Mon, 15 Jul 2024 21:57:32 +0000 (16:57 -0500)] 
rs6000: Error on CPUs and ABIs that don't support the ROP protection insns [PR114759]

We currently silently ignore the -mrop-protect option for old CPUs we don't
support with the ROP hash insns, but we throw an error for unsupported ABIs.
This patch treats unsupported CPUs and ABIs similarly by throwing an error
both both.  This matches clang behavior and allows us to simplify our tests
in the code that generates our prologue and epilogue code.

2024-06-26  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/114759
* config/rs6000/rs6000.cc (rs6000_option_override_internal): Disallow
CPUs and ABIs that do no support the ROP protection insns.
* config/rs6000/rs6000-logue.cc (rs6000_stack_info): Remove now
unneeded tests.
(rs6000_emit_prologue): Likewise.
Remove unneeded gcc_assert.
(rs6000_emit_epilogue): Likewise.
* config/rs6000/rs6000.md: Likewise.

gcc/testsuite/
PR target/114759
* gcc.target/powerpc/pr114759-3.c: New test.

(cherry picked from commit 6f2bab9b5d1ce1914c748b7dcd8638dafaa98df7)

12 months agors6000: ROP - Emit hashst and hashchk insns on Power8 and later [PR114759]
Peter Bergner [Wed, 19 Jun 2024 21:07:29 +0000 (16:07 -0500)] 
rs6000: ROP - Emit hashst and hashchk insns on Power8 and later [PR114759]

We currently only emit the ROP-protect hash* insns for Power10, where the
insns were added to the architecture.  We want to emit them for earlier
cpus (where they operate as NOPs), so that if those older binaries are
ever executed on a Power10, then they'll be protected from ROP attacks.
Binutils accepts hashst and hashchk back to Power8, so change GCC to emit
them for Power8 and later.  This matches clang's behavior.

2024-06-19  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/114759
* config/rs6000/rs6000-logue.cc (rs6000_stack_info): Use TARGET_POWER8.
(rs6000_emit_prologue): Likewise.
* config/rs6000/rs6000.md (hashchk): Likewise.
(hashst): Likewise.
Fix whitespace.

gcc/testsuite/
PR target/114759
* gcc.target/powerpc/pr114759-2.c: New test.
* lib/target-supports.exp (rop_ok): Use
check_effective_target_has_arch_pwr8.

(cherry picked from commit a05c3d23d1e1c8d2971b123804fc7a61a3561adb)

12 months agors6000: Compute rop_hash_save_offset for non-Altivec compiles [PR115389]
Peter Bergner [Fri, 14 Jun 2024 19:36:20 +0000 (14:36 -0500)] 
rs6000: Compute rop_hash_save_offset for non-Altivec compiles [PR115389]

We currently only compute the offset for the ROP hash save location in
the stack frame for Altivec compiles.  For non-Altivec compiles when we
emit ROP mitigation instructions, we use a default offset of zero which
corresponds to the backchain save location which will get clobbered on
any call.  The fix is to compute the ROP hash save location for all
compiles.

2024-06-14  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/115389
* config/rs6000/rs6000-logue.cc (rs6000_stack_info): Compute
rop_hash_save_offset for non-Altivec compiles.

gcc/testsuite
PR target/115389
* gcc.target/powerpc/pr115389.c: New test.

(cherry picked from commit c70eea0dba5f223d49c80cfb3e80e87b74330aac)

12 months agors6000: Update ELFv2 stack frame comment showing the correct ROP save location
Peter Bergner [Fri, 7 Jun 2024 21:03:08 +0000 (16:03 -0500)] 
rs6000: Update ELFv2 stack frame comment showing the correct ROP save location

The ELFv2 stack frame layout comment in rs6000-logue.cc shows the ROP
hash save slot in the wrong location.  Update the comment to show the
correct ROP hash save location in the frame.

2024-06-07  Peter Bergner  <bergner@linux.ibm.com>

gcc/
* config/rs6000/rs6000-logue.cc (rs6000_stack_info): Update comment.

(cherry picked from commit e91cf26a954a5c1bf431e36f3a1e69f94e9fa4fe)

12 months agoDaily bump.
GCC Administrator [Wed, 24 Jul 2024 00:20:56 +0000 (00:20 +0000)] 
Daily bump.

12 months agoFixup unaligned load/store cost for znver4
Richard Biener [Mon, 15 Jul 2024 11:01:24 +0000 (13:01 +0200)] 
Fixup unaligned load/store cost for znver4

Currently unaligned YMM and ZMM load and store costs are cheaper than
aligned which causes the vectorizer to purposely mis-align accesses
by adding an alignment prologue.  It looks like the unaligned costs
were simply left untouched from znver3 where they equate the aligned
costs when tweaking aligned costs for znver4.  The following makes
the unaligned costs equal to the aligned costs.

This avoids the miscompile seen in PR115843 but it's of course not
a real fix for the issue uncovered there.  But it makes it qualify
as a regression fix.

PR tree-optimization/115843
* config/i386/x86-tune-costs.h (znver4_cost): Update unaligned
load and store cost from the aligned costs.

(cherry picked from commit 1e3aa9c9278db69d4bdb661a750a7268789188d6)

12 months ago[powerpc] [testsuite] reorder dg directives [PR106069]
Alexandre Oliva [Tue, 23 Jul 2024 05:19:55 +0000 (02:19 -0300)] 
[powerpc] [testsuite] reorder dg directives [PR106069]

The dg-do directive appears after dg-require-effective-target in
g++.target/powerpc/pr106069.C.  That doesn't work the way that was
presumably intended.  Both of these directives set dg-do-what, but
dg-do does so fully and unconditionally, overriding any decisions
recorded there by earlier directives.  Reorder the directives more
canonically, so that both take effect.

for  gcc/testsuite/ChangeLog

PR target/106069
* g++.target/powerpc/pr106069.C: Reorder dg directives.

(cherry picked from commit ad65caa332bc7600caff6b9b5b29175b40d91e67)

12 months agoDaily bump.
GCC Administrator [Tue, 23 Jul 2024 00:20:10 +0000 (00:20 +0000)] 
Daily bump.

12 months ago[PR115565] cse: Don't use a valid regno for non-register in comparison_qty
Maciej W. Rozycki [Sat, 29 Jun 2024 22:26:55 +0000 (23:26 +0100)] 
[PR115565] cse: Don't use a valid regno for non-register in comparison_qty

Use INT_MIN rather than -1 in `comparison_qty' where a comparison is not
with a register, because the value of -1 is actually a valid reference
to register 0 in the case where it has not been assigned a quantity.

Using -1 makes `REG_QTY (REGNO (folded_arg1)) == ent->comparison_qty'
comparison in `fold_rtx' to incorrectly trigger in rare circumstances
and return true for a memory reference, making CSE consider a comparison
operation to evaluate to a constant expression and consequently make the
resulting code incorrectly execute or fail to execute conditional
blocks.

This has caused a miscompilation of rwlock.c from LinuxThreads for the
`alpha-linux-gnu' target, where `rwlock->__rw_writer != thread_self ()'
expression (where `thread_self' returns the thread pointer via a PALcode
call) has been decided to be always true (with `ent->comparison_qty'
using -1 for a reference to to `rwlock->__rw_writer', while register 0
holding the thread pointer retrieved by `thread_self') and code for the
false case has been optimized away where it mustn't have, causing
program lockups.

The issue has been observed as a regression from commit 08a692679fb8
("Undefined cse.c behaviour causes 3.4 regression on HPUX"),
<https://gcc.gnu.org/ml/gcc-patches/2004-10/msg02027.html>, and up to
commit 932ad4d9b550 ("Make CSE path following use the CFG"),
<https://gcc.gnu.org/ml/gcc-patches/2006-12/msg00431.html>, where CSE
has been restructured sufficiently for the issue not to trigger with the
original reproducer anymore.  However the original bug remains and can
trigger, because `comparison_qty' will still be assigned -1 for a memory
reference and the `reg_qty' member of a `cse_reg_info_table' entry will
still be assigned -1 for register 0 where the entry has not been
assigned a quantity, e.g. at initialization.

Use INT_MIN then as noted above, so that the value remains negative, for
consistency with the REGNO_QTY_VALID_P macro (even though not used on
`comparison_qty'), and then so that it should not ever match a valid
negated register number, fixing the regression with commit 08a692679fb8.

gcc/
PR rtl-optimization/115565
* cse.cc (record_jump_cond): Use INT_MIN rather than -1 for
`comparison_qty' if !REG_P.

(cherry picked from commit 69bc5fb97dc3fada81869e00fa65d39f7def6acf)

12 months agoDaily bump.
GCC Administrator [Mon, 22 Jul 2024 00:20:00 +0000 (00:20 +0000)] 
Daily bump.

12 months agoFortran: character array constructor with >= 4 constant elements [PR103115]
Harald Anlauf [Thu, 18 Jul 2024 19:15:48 +0000 (21:15 +0200)] 
Fortran: character array constructor with >= 4 constant elements [PR103115]

gcc/fortran/ChangeLog:

PR fortran/103115
* trans-array.cc (gfc_trans_array_constructor_value): If the first
element of an array constructor is deferred-length character and
therefore does not have an element size known at compile time, do
not try to collect subsequent constant elements into a constructor
for optimization.

gcc/testsuite/ChangeLog:

PR fortran/103115
* gfortran.dg/string_array_constructor_4.f90: New test.

(cherry picked from commit c93be1606ecf8e0f65b96b67aa023fb456ceb3a3)

12 months agoDaily bump.
GCC Administrator [Sun, 21 Jul 2024 00:19:41 +0000 (00:19 +0000)] 
Daily bump.

12 months agoAvoid undefined behaviour in build_option_suggestions
Siddhesh Poyarekar [Fri, 19 Jul 2024 16:44:32 +0000 (12:44 -0400)] 
Avoid undefined behaviour in build_option_suggestions

The inner loop in build_option_suggestions uses OPTION to take the
address of OPTB and use it across iterations, which is undefined
behaviour since OPTB is defined within the loop.  Pull it outside the
loop to make this defined.

gcc/ChangeLog:

* opt-suggestions.cc
(option_proposer::build_option_suggestions): Pull OPTB
definition out of the innermost loop.

(cherry picked from commit e0d997e913f811ecf4b3e10891e6a4aab5b38a31)

12 months agors6000: Fix .machine cpu selection w/ altivec [PR97367]
René Rebe [Fri, 12 Jul 2024 21:17:08 +0000 (21:17 +0000)] 
rs6000: Fix .machine cpu selection w/ altivec [PR97367]

There are various non-IBM CPUs with altivec, so we cannot use that
flag to determine which .machine cpu to use, so ignore it.
Emit an additional ".machine altivec" if Altivec is enabled so
that the assembler doesn't require an explicit -maltivec option
to assemble any Altivec instructions for those targets where
the ".machine cpu" is insufficient to enable Altivec.  For example,
-mcpu=G5 emits a ".machine power4".

2024-07-18  René Rebe  <rene@exactcode.de>
    Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/97367
* config/rs6000/rs6000.cc (rs6000_machine_from_flags): Do not consider
OPTION_MASK_ALTIVEC.
(emit_asm_machine): For Altivec compiles, emit a ".machine altivec".

gcc/testsuite/
PR target/97367
* gcc.target/powerpc/pr97367.c: New test.

Signed-off-by: René Rebe <rene@exactcode.de>
(cherry picked from commit 6962835bca3e6bef0f6ceae84a7814138b08b8a5)

12 months agos390: Fix unresolved iterators bhfgq and xdee
Stefan Schulze Frielinghaus [Sat, 20 Jul 2024 15:13:03 +0000 (17:13 +0200)] 
s390: Fix unresolved iterators bhfgq and xdee

Code attribute bhfgq is missing a mapping for TF.  This results in
unresolved iterators in assembler templates for *bswaptf.

With the TF mapping added the base mnemonics vlbr and vstbr are not
"used" anymore but only the extended mnemonics (vlbr<bhfgq> was
interpreted as vlbr; likewise for vstbr).  Therefore, remove the base
mnemonics from the scheduling description, otherwise, genattrtab would
error about unknown mnemonics.

Likewise, for movtf_vr only the extended mnemonics for vrepi are used,
now, which means the base mnemonic is "unused" and has to be removed
from the scheduling description.

Similarly, we end up with unresolved iterators in assembler templates
for mulfprx23 since code attribute xdee is missing a mapping for FPRX2.

Note, this is basically a cherry pick of commit r15-2060-ga4abda934aa426
with the addition that vrepi is removed from the scheduling description,
too.

gcc/ChangeLog:

* config/s390/3931.md (vlbr, vstbr, vrepi): Remove.
* config/s390/s390.md (xdee): Add FPRX2 mapping.
* config/s390/vector.md (bhfgq): Add TF mapping.

12 months agoDaily bump.
GCC Administrator [Sat, 20 Jul 2024 00:19:45 +0000 (00:19 +0000)] 
Daily bump.

12 months agoDo not use caller-saved registers for COMDAT functions
LIU Hao [Mon, 15 Jul 2024 08:55:52 +0000 (16:55 +0800)] 
Do not use caller-saved registers for COMDAT functions

A reference to a COMDAT function may be resolved to another definition
outside the current translation unit, so it's not eligible for `-fipa-ra`.

In `decl_binds_to_current_def_p()` there is already a check for weak
symbols. This commit checks for COMDAT functions that are not implemented
as weak symbols, for example, on *-*-mingw32.

gcc/ChangeLog:

PR rtl-optimization/115049
* varasm.cc (decl_binds_to_current_def_p): Add a check for COMDAT
declarations too, like weak ones.

(cherry picked from commit 5080840d8fbf25a321dd27543a1462d393d338bc)

12 months agoDaily bump.
GCC Administrator [Fri, 19 Jul 2024 00:21:11 +0000 (00:21 +0000)] 
Daily bump.

12 months agoalpha: Fix duplicate !tlsgd!62 assemble error [PR115526]
Uros Bizjak [Wed, 17 Jul 2024 16:11:26 +0000 (18:11 +0200)] 
alpha: Fix duplicate !tlsgd!62 assemble error [PR115526]

Add missing "cannot_copy" attribute to instructions that have to
stay in 1-1 correspondence with another insn.

PR target/115526

gcc/ChangeLog:

* config/alpha/alpha.md (movdi_er_high_g): Add cannot_copy attribute.
(movdi_er_tlsgd): Ditto.
(movdi_er_tlsldm): Ditto.
(call_value_osf_<tls>): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/alpha/pr115526.c: New test.

(cherry picked from commit 0841fd4c42ab053be951b7418233f0478282d020)

12 months agoDaily bump.
GCC Administrator [Thu, 18 Jul 2024 00:21:44 +0000 (00:21 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Wed, 17 Jul 2024 00:21:57 +0000 (00:21 +0000)] 
Daily bump.

12 months agos390: Fix output template for movv1qi
Stefan Schulze Frielinghaus [Tue, 16 Jul 2024 12:01:58 +0000 (14:01 +0200)] 
s390: Fix output template for movv1qi

Although for instructions MVI and MVIY it does not make a difference
whether the immediate is interpreted as signed or unsigned, GAS expects
unsigned immediates for instruction format SI_URD.

gcc/ChangeLog:

* config/s390/vector.md (mov<mode>): Fix output template for
movv1qi.

(cherry picked from commit e6680d3f392f7f7cc2a1515276213e21e9eeab1c)

12 months agos390: Align *cjump_64 and *icjump_64
Stefan Schulze Frielinghaus [Tue, 16 Jul 2024 12:01:50 +0000 (14:01 +0200)] 
s390: Align *cjump_64 and *icjump_64

During machine reorg we optimize backward jumps and transform insns as
e.g.

(jump_insn 118 117 119 (set (pc)
        (if_then_else (ne (reg:CCRAW 33 %cc)
                (const_int 8 [0x8]))
            (label_ref 134)
            (pc))) "dec_math_1.f90":204:8 discrim 1 2161 {*cjump_64}
     (expr_list:REG_DEAD (reg:CCRAW 33 %cc)
        (int_list:REG_BR_PROB 719407028 (nil)))
 -> 134)

into

(jump_insn 118 117 432 (set (pc)
        (if_then_else (ne (reg:CCRAW 33 %cc)
                (const_int 8 [0x8]))
            (pc)
            (label_ref 433))) "dec_math_1.f90":204:8 discrim 1 -1
     (expr_list:REG_DEAD (reg:CCRAW 33 %cc)
        (int_list:REG_BR_PROB 719407028 (nil)))
 -> 433)

The latter is not recognized anymore since *icjump_64 only matches
CC_REGNUM against zero.  Fixed by aligning *cjump_64 and *icjump_64.

gcc/ChangeLog:

* config/s390/s390.md (*icjump_64): Allow raw CC comparisons,
i.e., any constant integer between 0 and 15 for CC comparisons.

(cherry picked from commit 56de68aba6cb9cf3022d9e303eec6c6cdb49ad4d)

12 months agoDaily bump.
GCC Administrator [Tue, 16 Jul 2024 00:23:24 +0000 (00:23 +0000)] 
Daily bump.

12 months agoFix SSA_NAME leak due to def_stmt is removed before use_stmt.
liuhongt [Fri, 12 Jul 2024 01:39:23 +0000 (09:39 +0800)] 
Fix SSA_NAME leak due to def_stmt is removed before use_stmt.

-  _5 = __atomic_fetch_or_8 (&set_work_pending_p, 1, 0);
-  # DEBUG old => (long int) _5
+  _6 = .ATOMIC_BIT_TEST_AND_SET (&set_work_pending_p, 0, 1, 0, __atomic_fetch_or_8);
+  # DEBUG old => NULL
   # DEBUG BEGIN_STMT
-  # DEBUG D#2 => _5 & 1
+  # DEBUG D#2 => NULL
...
-  _10 = ~_5;
-  _8 = (_Bool) _10;
-  # DEBUG ret => _8
+  _8 = _6 == 0;
+  # DEBUG ret => (_Bool) _10

confirmed.  convert_atomic_bit_not does this, it checks for single_use
and removes the def, failing to release the name (which would fix this up
IIRC).

Note the function removes stmts in "wrong" order (before uses of LHS
are removed), so it requires larger surgery.  And it leaks SSA names.

gcc/ChangeLog:

PR target/115872
* tree-ssa-ccp.cc (convert_atomic_bit_not): Remove use_stmt after use_nop_stmt is removed.
(optimize_atomic_bit_test_and): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr115872.c: New test.

(cherry picked from commit a8209237dc46dc4db7d9d8e3807e6c93734c64b5)

12 months agoDaily bump.
GCC Administrator [Mon, 15 Jul 2024 00:21:15 +0000 (00:21 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Sun, 14 Jul 2024 00:21:49 +0000 (00:21 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Sat, 13 Jul 2024 00:21:22 +0000 (00:21 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Fri, 12 Jul 2024 00:23:08 +0000 (00:23 +0000)] 
Daily bump.

12 months agomve: Fix vsetq_lane for 64-bit elements with lane 1 [PR 115611]
Andre Vieira [Thu, 11 Jul 2024 14:38:45 +0000 (15:38 +0100)] 
mve: Fix vsetq_lane for 64-bit elements with lane 1 [PR 115611]

This patch fixes the backend pattern that was printing the wrong input
scalar register pair when inserting into lane 1.

Added a new test to force float-abi=hard so we can use scan-assembler to check
correct codegen.

gcc/ChangeLog:

PR target/115611
* config/arm/mve.md (mve_vec_setv2di_internal): Fix printing of input
scalar register pair when lane = 1.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mve/intrinsics/vsetq_lane_su64.c: New test.

(cherry picked from commit 7c11fdd2cc11a7058e9643b6abf27831970ad2c9)

12 months agoDaily bump.
GCC Administrator [Thu, 11 Jul 2024 00:20:20 +0000 (00:20 +0000)] 
Daily bump.

12 months agomiddle-end: Fix stalled swapped condition code value [PR115836]
Uros Bizjak [Wed, 10 Jul 2024 07:27:27 +0000 (09:27 +0200)] 
middle-end: Fix stalled swapped condition code value [PR115836]

emit_store_flag_1 calculates scode (swapped condition code) at the
beginning of the function from the value of code variable.  However,
code variable may change before scode usage site, resulting in
invalid stalled scode value.

Move calculation of scode value just before its only usage site to
avoid stalled scode value.

PR middle-end/115836

gcc/ChangeLog:

* expmed.cc (emit_store_flag_1): Move calculation of
scode just before its only usage site.

(cherry picked from commit 44933fdeb338e00c972e42224b9a83d3f8f6a757)

12 months agoDaily bump.
GCC Administrator [Wed, 10 Jul 2024 00:21:12 +0000 (00:21 +0000)] 
Daily bump.

12 months agolibstdc++: Fix _Atomic(T) macro in <stdatomic.h> [PR115807]
Jonathan Wakely [Sun, 7 Jul 2024 11:22:42 +0000 (12:22 +0100)] 
libstdc++: Fix _Atomic(T) macro in <stdatomic.h> [PR115807]

The definition of the _Atomic(T) macro needs to refer to ::std::atomic,
not some other std::atomic relative to the current namespace.

libstdc++-v3/ChangeLog:

PR libstdc++/115807
* include/c_compatibility/stdatomic.h (_Atomic): Ensure it
refers to std::atomic in the global namespace.
* testsuite/29_atomics/headers/stdatomic.h/115807.cc: New test.

(cherry picked from commit 40d234dd6439e8c8cfbf3f375a61906aed35c80d)

12 months agoDaily bump.
GCC Administrator [Tue, 9 Jul 2024 00:20:40 +0000 (00:20 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Mon, 8 Jul 2024 00:20:02 +0000 (00:20 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Sun, 7 Jul 2024 00:19:56 +0000 (00:19 +0000)] 
Daily bump.

12 months agoDaily bump.
GCC Administrator [Sat, 6 Jul 2024 00:20:30 +0000 (00:20 +0000)] 
Daily bump.

13 months agoAArch64: Fix strict-align cpymem/setmem [PR103100]
Wilco Dijkstra [Wed, 25 Oct 2023 15:28:04 +0000 (16:28 +0100)] 
AArch64: Fix strict-align cpymem/setmem [PR103100]

The cpymemdi/setmemdi implementation doesn't fully support strict alignment.
Block the expansion if the alignment is less than 16 with STRICT_ALIGNMENT.
Clean up the condition when to use MOPS.

gcc/ChangeLog/
PR target/103100
* config/aarch64/aarch64.md (cpymemdi): Remove pattern condition.
(setmemdi): Likewise.
* config/aarch64/aarch64.cc (aarch64_expand_cpymem): Support
strict-align.  Cleanup condition for using MOPS.
(aarch64_expand_setmem): Likewise.

(cherry picked from commit 318f5232cfb3e0c9694889565e1f5424d0354463)