Re: [PATCH v3] x86-64: Remove redundant TLS calls

2025-08-03 Thread Hongtao Liu
On Tue, Jul 29, 2025 at 9:28 AM H.J. Lu wrote: > > On Mon, Jul 28, 2025 at 01:53:08PM -0700, H.J. Lu wrote: > > On Mon, Jul 28, 2025 at 04:51:24PM +0800, Hongtao Liu wrote: > > > On Wed, Jul 23, 2025 at 8:07 AM H.J. Lu wrote: > > > > > > > > For TLS calls: > > > > > > > > 1. UNSPEC_TLS_GD: > > >

[COMMITED] [PATCH v2] invoke.texi: Update docs of -fdump-{rtl,tree}--

2025-08-03 Thread Filip Kastl
On Fri 2025-08-01 14:52:07, Gerald Pfeifer wrote: > On Tue, 29 Jul 2025, Filip Kastl wrote: > > okay to push? Confirmed that I didn't break anything by running `make > > html`. > > ...and `make pdf`? Ah, thanks. Also checked make pdf. > > This patch changes two things. Firstly, we document >

Re: [PATCH] libstdc++: Export std::byteswap from std.cc.in [PR121373]

2025-08-03 Thread Jonathan Wakely
On Sun, 3 Aug 2025, 19:29 hexne, wrote: > std::byteswap was added to the header file in c++23 and has been > implemented, but it was not exported in std.cc.in. Therefore, when > using import std, std::byteswap cannot be used. Exporting it in > std.cc.in can solve this problem. > > Tested on x86_

Re: [patch,avr] Remove remains of reload

2025-08-03 Thread Denis Chertykov
вс, 3 авг. 2025 г. в 14:57, Georg-Johann Lay : > > This patch removes remains of reload from the avr BE. > > No new regressions. Ok for trunk? Please apply. Denis

[PATCH v1 2/2] RISC-V: RISC-V: Add test for vec_duplicate + vmerge.vvm combine with GR2VR cost 0, 1 and 15

2025-08-03 Thread pan2 . li
From: Pan Li Add asm dump check and run test for vec_duplicate + vmerge.vvm combine to vmerge.vxm, with the GR2VR cost is 0, 2 and 15. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test helper macros. * gcc.target/riscv/rvv/autovec/vx_vf/

[PATCH v1 1/2] RISC-V: Combine vec_duplicate + vmerge.vv to vmerge.vx on GR2VR cost

2025-08-03 Thread pan2 . li
From: Pan Li This patch would like to combine the vec_duplicate + vaadd.vv to the vaadd.vx. From example as below code. The related pattern will depend on the cost of vec_duplicate from GR2VR. Then the late-combine will take action if the cost of GR2VR is zero, and reject the combination if th

[PATCH v1 0/2] RISC-V: Combine vec_duplicate + vmerge.vvm to vmerge.vxm on GR2VR cost

2025-08-03 Thread pan2 . li
From: Pan Li This patch would like to introduce the combine of vec_dup + vmerge.vv into vmerge.vx on the cost value of GR2VR. The late-combine will take place if the cost of GR2VR is zero, or reject the combine if non-zero like 1, 2, 15 in test. From: | ... | vmv.v.x | L1: | vaadd.vv

Re: [PATCH v4] x86-64: Remove redundant TLS calls

2025-08-03 Thread H.J. Lu
On Mon, Jul 28, 2025 at 6:25 PM H.J. Lu wrote: > > For TLS calls: > > 1. UNSPEC_TLS_GD: > > (parallel [ > (set (reg:DI 0 ax) > (call:DI (mem:QI (symbol_ref:DI ("__tls_get_addr"))) > (const_int 0 [0]))) > (unspec:DI [(symbol_ref:DI ("e") [flags 0x50]) >

[PATCH v5] x86-64: Remove redundant TLS calls

2025-08-03 Thread H.J. Lu
For TLS calls: 1. UNSPEC_TLS_GD: (parallel [ (set (reg:DI 0 ax) (call:DI (mem:QI (symbol_ref:DI ("__tls_get_addr"))) (const_int 0 [0]))) (unspec:DI [(symbol_ref:DI ("e") [flags 0x50]) (reg/f:DI 7 sp)] UNSPEC_TLS_GD) (clobber (reg:DI 5 di))]

RE: [PATCH v1] RISC-V: Fix scalar code-gen of unsigned SAT_MUL

2025-08-03 Thread Li, Pan2
Thanks Jeff. > OK. Any change we could get run test for this in addition to the scanners? I tried to add run test target this but seems happen to work here for mulhsu. Here we only cares the result(high bits of mul) has values or not, looks like mulhsu will not result in correctness problem. T

Re: [PATCH] x86: Don't hoist non all 0s/1s vector set outside of loop

2025-08-03 Thread Hongtao Liu
On Fri, Aug 1, 2025 at 8:10 PM H.J. Lu wrote: > > Don't hoist non all 0s/1s vector set outside of the loop to avoid extra > spills. The patch LGTM. > > gcc/ > > PR target/120941 > * config/i386/i386-features.cc (x86_cse_kind): Moved before > ix86_place_single_vector_set. >

Re: [PATCH v1] RISC-V: Fix scalar code-gen of unsigned SAT_MUL

2025-08-03 Thread Jeff Law
On 7/30/25 11:22 PM, pan2...@intel.com wrote: From: Pan Li The previous code-gen of scalar unsigned SAT_MUL, aka usmul. Leverage the mulhs by mistake, it should be mulhu for the hight bit result of mul. Thus, this patch would like to make it correct. gcc/ChangeLog: * config/riscv/

Re: [PATCH v9 0/9] AArch64: CMPBR support

2025-08-03 Thread Andrew Pinski
On Thu, Jul 3, 2025 at 4:50 AM Richard Sandiford wrote: > > Karl Meakin writes: > > This patch series adds support for the CMPBR extension. It includes the > > new `+cmpbr` option and rules to generate the new instructions when > > lowering conditional branches. > > Thanks for the update, LGTM.

[PATCH] gcc: Make aarch64-mingw32 target install wrap stdint.h

2025-08-03 Thread Jason Xu
Wrapped stdint.h for AArch64 MinGW32 is useful for bare-matal PE target e.g. UEFI, as those platform does not provide a system stdint.h, this would align with x86_64 mingw32 target which provides a wrapped stdint.h I have tested this by compiling a AArch64 UEFI Application using gcc's stdint.h, w

[PATCH v2 7/8] libstdc++: Improve extents::operator==.

2025-08-03 Thread Luc Grosheintz
An interesting case to consider is: bool same11(const std::extents& e1, const std::extents& e2) { return e1 == e2; } Which has the following properties: - There's no mismatching static extents, preventing any short-circuiting. - There's a comparison between dynamic and

[PATCH v2 8/8] libstdc++: Replace numeric_limit with __int_traits in mdspan.

2025-08-03 Thread Luc Grosheintz
Using __int_traits avoids the need to include from . This in turn should reduce the size of the pre-compiled . Similar refactoring was carried out for PR92546. Unfortunately, ./gcc/xgcc -std=c++23 -P -E -x c++ - -include mdspan | wc -l shows a decrease by 1(!) line. This is due to bits/max_siz

[PATCH v2 5/8] libstdc++: Improve nearly fully dynamic extents in mdspan.

2025-08-03 Thread Luc Grosheintz
One previous commit optimized fully dynamic extents; and another refactored __size such that __fwd_prod is valid for __r = 0, ..., rank (exclusive). Therefore, by noticing that __rev_prod (and __fwd_prod) never accesses the first (or last) extent, one can avoid pre-computing partial products of st

[PATCH v2 1/8] libstdc++: Reduce template instantiations in .

2025-08-03 Thread Luc Grosheintz
In mdspan related code involving static extents, often the IndexType is part of the template parameters, even though it's not needed. This commit extracts the parts of _ExtentsStorage not related to IndexType into a separate class _StaticExtents. It also prefers passing the array of static extent

[PATCH v2 4/8] libstdc++: Improve fully dynamic extents in mdspan.

2025-08-03 Thread Luc Grosheintz
In mdspan related code, for extents with no static extents, i.e. only dynamic extents, the following simplifications can be made: - The array of dynamic extents has size rank. - The two arrays dynamic-index and dynamic-index-inv become trivial, e.g. k[i] == i. - All elements of the arrays

[PATCH v2 3/8] libstdc++: Improve low-rank layout_{left, right}::stride.

2025-08-03 Thread Luc Grosheintz
The methods layout_{left,right}::mapping::stride are defined as \prod_{i = 0}^r E[i] \prod_{i = r+1}^n E[i] This is computed as the product of a precomputed static product and the product of the required dynamic extents. Disassembly shows that even for low-rank extents, i.e. rank == 1 and ra

[PATCH v2 6/8] libstdc++: Reduce indirection in extents::extent.

2025-08-03 Thread Luc Grosheintz
In both fully static and dynamic extents the comparison static_extent(i) == dynamic_extent is known at compile time. As a result, extents::extent doesn't need to perform the check at runtime. An illustrative example is: using E = std::extents; int required_span_size(const typename Layout::m

[PATCH v2 2/8] libstdc++: Precompute products of static extents.

2025-08-03 Thread Luc Grosheintz
Let E denote an multi-dimensional extent; n the rank of E; r = 0, ..., n; E[i] the i-th extent; and D[k] be the (possibly empty) array of dynamic extents. The two partial products for r = 0, ..., n: \prod_{i = 0}^r E[i] (fwd) \prod_{i = r+1}^n E[i] (rev) can be computed as the product

[PATCH v2 0/8] libstdc++: Sequence of improvements to .

2025-08-03 Thread Luc Grosheintz
The combined effect of this sequence of change is: * a reduction in the number of template instantiations, by - avoiding needless dependency of IndexType, - special formulas for low-rank extents, - special formulas for (nearly) fully dynamic extents. * improved code quality, by

Re: [Patch, fortran] PR121182 - F2018 GENERIC statement is missing

2025-08-03 Thread Steve Kargl
On Sun, Aug 03, 2025 at 12:20:24PM +0100, Paul Richard Thomas wrote: First, the easy one: > + /* Match the binding name; depending on type (operator / generic) format > + it for future error messages into bind_name. */ This comment looks muddled. > + if (op_type == INTERFACE_GENERIC

[PATCH] libstdc++: Export std::byteswap from std.cc.in [PR121373]

2025-08-03 Thread hexne
std::byteswap was added to the header file in c++23 and has been implemented, but it was not exported in std.cc.in. Therefore, when using import std, std::byteswap cannot be used. Exporting it in std.cc.in can solve this problem. Tested on x86_64-linux. Signed-off-by: hexne diff --git a/libstdc+

Re: [PATCH] c++: constexpr evaluation of abi::__dynamic_cast [PR120620]

2025-08-03 Thread Patrick Palka
On Sun, 3 Aug 2025, Jason Merrill wrote: > On 8/1/25 11:16 AM, Patrick Palka wrote: > > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK > > for trunk and 15/14 after 15.2 is released? > > > > -- >8 -- > > > > r13-3299 changed our internal declaration of __dynamic_cast to res

Re: [PATCH] c++: Add stringification testcase for CWG1709 [PR120778]

2025-08-03 Thread Jason Merrill
On 8/1/25 12:52 PM, Jakub Jelinek wrote: Hi! The CWG1709 just codifies existing GCC (and clang) behavior, so this just adds a testcase for that. Tested on x86_64-linux, ok for trunk? OK. 2025-08-01 Jakub Jelinek PR preprocessor/120778 * g++.dg/DRs/dr1709.C: New test. --

Re: [PATCH] libcpp: Fix up cpp_maybe_module_directive [PR120845]

2025-08-03 Thread Jason Merrill
On 7/31/25 1:58 PM, Jakub Jelinek wrote: On Thu, Jul 31, 2025 at 11:04:56AM -0400, Jason Merrill wrote: If the current backup handling is doing the wrong thing in this case, it seems better to fix it rather than add more earlier in the function. Would it be enough to move the existing CPP_PRAGMA

Re: [PATCH] c++: constexpr evaluation of abi::__dynamic_cast [PR120620]

2025-08-03 Thread Jason Merrill
On 8/1/25 11:16 AM, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk and 15/14 after 15.2 is released? -- >8 -- r13-3299 changed our internal declaration of __dynamic_cast to reside inside the abi / __cxxabiv1 namespace instead of the global na

Re: [PATCH] fortran: implement conditional expression for fortran 2023

2025-08-03 Thread Yuao Ma
Hi Paul, On 7/31/2025 6:02 AM, Paul Richard Thomas wrote: That's exactly how I had a mind to do it. You beat me to it :-( Just get on, polish the patch and add more tests. I've updated the patch with improvements to both the functionality and test cases. It should now work well for simple sc

Re: [PATCH] libgfortran: add fallback for trigonometric pi-based functions

2025-08-03 Thread Yuao Ma
On 7/31/2025 1:45 AM, Joseph Myers wrote: On Sun, 6 Jul 2025, Yuao Ma wrote: +#ifndef HAVE_COSPI +#define HAVE_COSPI 1 +double cospi (double); + +double +cospi (double x) +{ + return cos (x * pihi_d + x * pilo_d); For reasonable results for large x you should first reduce mod 2 to the ran

[PATCH] c++: Quoting in -fmodules-mapper

2025-08-03 Thread Nicolas Werner
Users might be using a space in their build directory path. To allow specifying such a root for the module mapper started by GCC, we need the command to allow quotes. Previously quoting a path passed to the module mapper was not possible, so replace the custom argv parsing with the argv parsing log

Re: [PATCH 0/3] fortran: Use existing setters and getters to access array descriptors

2025-08-03 Thread Paul Richard Thomas
Hi Mikael, All three patches are OK for mainline. About half of the chunks I recognise and blames should point to me :-( Thanks for the patch. Paul On Sun, 3 Aug 2025 at 14:30, Mikael Morin wrote: > From: Mikael Morin > > The fortran frontend has getter and setter functions to generate code

[PATCH 3/3] fortran: Use array descriptor offset setter when possible

2025-08-03 Thread Mikael Morin
From: Mikael Morin Regression-tested on x86_64-pc-linux-gnu. OK for master? -- >8 -- In some places, a write to an array descriptor offset field was generated simply by adding a modification of a reference to it that was already available. This change uses the existing setter f

[PATCH 0/3] fortran: Use existing setters and getters to access array descriptors

2025-08-03 Thread Mikael Morin
From: Mikael Morin The fortran frontend has getter and setter functions to generate code either to read array descriptor fields or to write to them. In some places, those functions are not used, and the access to the field is generated manually. The following patches replace those direct accesse

[PATCH 2/3] fortran: Remove array descriptor data address accessor function

2025-08-03 Thread Mikael Morin
From: Mikael Morin Regression-tested on x86_64-pc-linux-gnu. OK for master? -- >8 -- The function gfc_conv_descriptor_data_addr generates an address to the data field of an array descriptor. It is only used once, and in the single place where it is used, the address is immediately dereferenced

[PATCH 1/3] fortran: Use array descriptor data setter when possible

2025-08-03 Thread Mikael Morin
From: Mikael Morin Regression-tested on x86_64-pc-linux-gnu. OK for master? -- >8 -- In some places, a write to an array descriptor data field was generated simply by adding a modification of a reference to it that was already available. This change uses the existing setter function instead in

Re: [PATCH 4/4] c: implement the defer keyword

2025-08-03 Thread Martin Uecker
Hi Anna, thanks for your patch! I did not have to time look at this (and I can't approve it), but here is something I noticed. You have an error for jumping into a defer block > > @@ -4244,10 +4274,29 @@ check_earlier_gotos (tree label, struct c_label_vars* > label_vars) > >if (

Re: [committed] libstdc++: Fix recent changes to __glibcxx_assert [PR112882]

2025-08-03 Thread Jonathan Wakely
On Sun, 3 Aug 2025, 14:54 Jonathan Wakely, wrote: > > > On Sun, 3 Aug 2025, 01:55 Andrew Pinski, wrote: > >> On Thu, Dec 7, 2023 at 2:07 PM Jonathan Wakely >> wrote: >> > >> > Tested x86_64-linux. Pushed to trunk. >> > >> > -- >8 -- >> > >> > The changes in r14-6198-g5e8a30d8b8f4d7 were broken,

Re: [committed] libstdc++: Fix recent changes to __glibcxx_assert [PR112882]

2025-08-03 Thread Jonathan Wakely
On Sun, 3 Aug 2025, 01:55 Andrew Pinski, wrote: > On Thu, Dec 7, 2023 at 2:07 PM Jonathan Wakely wrote: > > > > Tested x86_64-linux. Pushed to trunk. > > > > -- >8 -- > > > > The changes in r14-6198-g5e8a30d8b8f4d7 were broken, as I used > > _GLIBCXX17_CONSTEXPR for the 'if _GLIBCXX17_CONSTEXPR

Re: [pushed] wwwdocs: gcc-16: Fix markup and activate IA-32/x86-64 section

2025-08-03 Thread H.J. Lu
On Sat, Aug 2, 2025 at 5:12 PM Gerald Pfeifer wrote: > > H.J., I assume you also wanted to activate the respective section? > Yes. Thanks. > Pushed. > > Gerald > --- > htdocs/gcc-16/changes.html | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/htdocs/gcc-16/changes.h

Re: [PATCH] libstdc++: Export std::owner_equal and std::owner_hash from std.cc

2025-08-03 Thread Jonathan Wakely
On Sat, 2 Aug 2025, 21:06 Jakub Jelinek, wrote: > Hi! > > I've tried compiling > #include > with -std=c++26 -fdump-lang-all > and > for i in `grep ^Class.std::[^_] *.C.001l.class | sed 's/^Class //;s/[< > ].*$//' | sort -u | grep -v ::.*::`; do grep -q $i > /usr/src/gcc/libstdc++-v3/src/c++23/st

Re: [PATCH] x86: Add *one_cmplqi_ext_2

2025-08-03 Thread H.J. Lu
On Sun, Aug 3, 2025 at 12:45 AM Uros Bizjak wrote: > > On Sat, Aug 2, 2025 at 8:56 PM H.J. Lu wrote: > > > > On Fri, Aug 1, 2025 at 10:32 PM Uros Bizjak wrote: > > > > > > On Sat, Aug 2, 2025 at 3:22 AM H.J. Lu wrote: > > > > > > > > After > > > > > > > > commit 965564eafb721f813a3112f1bba8

Re: [Patch, fortran] PR121182 - F2018 GENERIC statement is missing

2025-08-03 Thread Paul Richard Thomas
Hi Harald, Please find attached an updated patch for the generic statement. The module attribute in real module function realg is required by all other brands. gfortran compiles happily with it and so I have added it to the testcase. This is now PR121379. I have also posted a submodule meta-bug P

[patch,avr] Remove remains of reload

2025-08-03 Thread Georg-Johann Lay
This patch removes remains of reload from the avr BE. No new regressions. Ok for trunk? Johann -- AVR: target/121359: Remove -mlra and remains of reload. PR target/121359 gcc/ * config/avr/avr.h: Remove -mlra and remains of reload. * config/avr/avr.cc: Same. *

[PATCH 2/3][v3] Remove most of the epilogue vinfo fixup

2025-08-03 Thread Richard Biener
The following removes the fixup we apply to pattern stmt operands before code generating vector epilogues. This isn't necessary anymore since the SLP graph now exclusively records the data flow. Similarly fixing up of SSA references inside DR_REF of gather/scatter isn't necessary since we now rec

[PATCH 3/3][v3] Enable gather/scatter for epilogues of vector epilogues

2025-08-03 Thread Richard Biener
The restriction no longer applies, so remove it. Re-bootstrap and regtest running on x86_64-unknown-linux-gnu. * tree-vect-data-refs.cc (vect_check_gather_scatter): Remove restriction on epilogue of epilogue vectorization. --- gcc/tree-vect-data-refs.cc | 7 --- 1 file change

[PATCH 1/3][v3] Record get_load_store_info results from analysis

2025-08-03 Thread Richard Biener
The following is a prototype-quality patch to make us record the get_load_store_info results from load/store analysis and re-use them during transform. In particular this moves where SLP_TREE_MEMORY_ACCESS_TYPE is stored. Rather than mass-replacing references to variables I've kept the locals but

Re: [PATCH] x86: Add *one_cmplqi_ext_2

2025-08-03 Thread Uros Bizjak
On Sat, Aug 2, 2025 at 8:56 PM H.J. Lu wrote: > > On Fri, Aug 1, 2025 at 10:32 PM Uros Bizjak wrote: > > > > On Sat, Aug 2, 2025 at 3:22 AM H.J. Lu wrote: > > > > > > After > > > > > > commit 965564eafb721f813a3112f1bba8d8fae32b > > > Author: Richard Sandiford > > > Date: Tue Jul 29 15:58

Re: [PATCH] x86: Don't hoist non all 0s/1s vector set outside of loop

2025-08-03 Thread Richard Biener
On Sun, Aug 3, 2025 at 7:31 AM Andi Kleen wrote: > > "H.J. Lu" writes: > > > Don't hoist non all 0s/1s vector set outside of the loop to avoid extra > > spills. > > It seems this could be a loss if there are actually enough registers. > So you need to make it depend on the register pressure? IMO

Re: [patch,avr] Don't repeat patterns in define_insn_and_split

2025-08-03 Thread Denis Chertykov
пт, 1 авг. 2025 г. в 18:07, Georg-Johann Lay : > > There are many post-reload define_insn_and_split's that just append > a (clobber (reg:CC REG_CC)) to the pattern. Instead of repeating > the original patterns, avr_add_ccclobber (curr_insn) is used to do > that job. > > This avoids repeating pat