[PATCH] docs: Document that __builtin_assoc_barrier also can be used for FMAs [PR115023]

2024-11-02 Thread Andrew Pinski
I noticed that __builtin_assoc_barrier makes a differnce for FMAs formation but it was not documented. This adds that documentation even with a small example. Build the HTML documents to make sure everything looks correct. gcc/ChangeLog: PR middle-end/115023 * doc/extend.texi (_

[PATCH 1/3] Write LF_BCLASS records in CodeView struct definitions

2024-11-02 Thread Mark Harmstone
When writing the CodeView type definition for a struct, translate DW_TAG_inheritance DIEs into LF_BCLASS records, to record which other structs this one inherits from. gcc/ * dwarf2codeview.cc (enum cv_leaf_type): Add LF_BCLASS. (struct codeview_subtype): Add lf_bclass to union.

[PATCH 3/3] Handle T_HRESULT types in CodeView records

2024-11-02 Thread Mark Harmstone
Follow MSVC in having a special type value, T_HRESULT, for (signed) longs that have been typedef'd with the name "HRESULT". This is so that the debugger can display user-friendly constant names when debugging COM code. gcc/ * dwarf2codeview.cc (get_type_num_typedef): New function.

[PATCH 2/3] Write LF_POINTER CodeView types for pointers to member functions or data

2024-11-02 Thread Mark Harmstone
Translate DW_TAG_ptr_to_member_type DIEs into special extended LF_POINTER CodeView types. gcc/ * dwarf2codeview.cc (struct codeview_custom_type): Add new fields to lf_pointer struct in union. (write_lf_pointer): Write containing_class and ptr_to_mem_type if applicab

[committed] testsuite: Require trampoline support for pr117245.c

2024-11-02 Thread Dimitar Dimitrov
Test case pr117245.c is using trampolines, so mark it as such. With this patch the test is now properly marked as unsupported for pru-unknown-elf. Test still passes for x86_64-pc-linux-gnu. Pushed to trunk as obvious. gcc/testsuite/ChangeLog: * gcc.dg/pr117245.c: Require effective targ

Re: [PATCH 6/7] Support Intel MOVRS

2024-11-02 Thread H.J. Lu
On Tue, Oct 22, 2024 at 2:34 PM Haochen Jiang wrote: > > From: "Hu, Lin1" > > gcc/ChangeLog: > > * common/config/i386/cpuinfo.h (get_available_features): Detect movrs. > * common/config/i386/i386-common.cc > (OPTION_MASK_ISA2_MOVRS_SET): New. > (OPTION_MASK_ISA2_MO

[committed] testsuite: Require fpic support for pr116887.c

2024-11-02 Thread Dimitar Dimitrov
Test case pr116887.c is passing -fpic, so mark it as such. With this patch the test is now properly marked as unsupported for pru-unknown-elf. Test still passes for x86_64-pc-linux-gnu. Pushed to trunk as obvious. gcc/testsuite/ChangeLog: * gcc.dg/pr116887.c: Require effective target f

Re: [COMMITTED 3/3] Update bitwise_or op_range.

2024-11-02 Thread Jakub Jelinek
On Sat, Nov 02, 2024 at 02:47:55PM -0400, Andrew MacLeod wrote: > Fresh extract and bootstrap, and I dont see those spurious failures I > mnetioned.  And everything is good with the port of these patches too on > GCC14.  so whenever seems reasonable. Let's commit the backport now then. Ja

Re: [COMMITTED 3/3] Update bitwise_or op_range.

2024-11-02 Thread Andrew MacLeod
Fresh extract and bootstrap, and I dont see those spurious failures I mnetioned.  And everything is good with the port of these patches too on GCC14.  so whenever seems reasonable. Andrew On 11/1/24 17:10, Andrew MacLeod wrote: It eas an existing branch.  I will get a scrtach branch and do ev

Re: [patch, Fortran] Introduce unsigned versions of MASKL and MASKR

2024-11-02 Thread Jerry D
On 11/2/24 8:44 AM, Thomas Koenig wrote: Ping **(5./7.) ? MASKR and MASKL are obvious candidates for unsigned, too; in the previous version of the doc patch, I had promised that these would take unsigned arguments in the future. What I had in mind was they could take an unsigned argument and re

Re: [PATCH] LoongArch: Add backward compatibility for signed vector arguments calling LSX/LASX vorn builtins

2024-11-02 Thread Xi Ruoyao
On Sat, 2024-11-02 at 16:38 +0800, Xi Ruoyao wrote: > The patch at [1] changes these builtins to accept unsigned vector > arguments to be consistent with other LSX/LASX bitwise builtins, but > there's some concern about the backward compatibility.  Make use of the > existing built-in function overl

Re: [patch, Fortran] Introduce unsigned versions of MASKL and MASKR

2024-11-02 Thread Thomas Koenig
Ping **(5./7.) ? MASKR and MASKL are obvious candidates for unsigned, too; in the previous version of the doc patch, I had promised that these would take unsigned arguments in the future. What I had in mind was they could take an unsigned argument and return an unsigned result. Thinking about t

[PATCH 2/4] VN: Handle `(a | b) !=/== 0` for predicates [PR117414]

2024-11-02 Thread Andrew Pinski
For `(a | b) == 0`, we can "assert" on the true edge that both `a == 0` and `b == 0` but nothing on the false edge. For `(a | b) != 0`, we can "assert" on the false edge that both `a == 0` and `b == 0` but nothing on the true edge. This adds that predicate and allows us to optimize f0, f1, and f2 i

[PATCH 4/4] VN: Lookup `val != 0` if we got back val when looking up the predicate for GIMPLE_COND [PR117414]

2024-11-02 Thread Andrew Pinski
Sometimes we get back a full ssa name when looking up the comparison of the GIMPLE_COND rather than a predicate. We then want to lookup the `val != 0` for the predicate. Note this might happen with other boolean assignments and COND_EXPR but I am not sure if it is as important; I have not found

[PATCH 3/4] VN: Handle `(A CMP B) !=/== 0` for predicates [PR117414]

2024-11-02 Thread Andrew Pinski
After the last patch, we also want to record `(A CMP B) != 0` as `(A CMP B)` and `(A CMP B) == 0` as `(A CMP B)` with the true/false edges swapped. This is enough to fix the original issue in `gcc.dg/tree-ssa/pr111456-1.c` and make sure we don't regress it when enhancing ifcombine. This adds that

[PATCH 1/4] VN: Factor out inserting predicates for conditional

2024-11-02 Thread Andrew Pinski
To make it easier to add more predicates in some cases, factor out the code. Plus it makes the code slightly more readable since it is not indented as much. Bootstrapped and tested on x86_64. gcc/ChangeLog: * tree-ssa-sccvn.cc (insert_predicates_for_cond): New function, factored out fro

Re: [PATCH] libstdc++: Fix up std::{, b}float16_t std::{ilogb, l{, l}r{ound, int}} [PR117406]

2024-11-02 Thread Jonathan Wakely
On Sat, 2 Nov 2024 at 07:11, Jakub Jelinek wrote: > > Hi! > > These overloads incorrectly cast the result of the float __builtin_* > to _Float or __gnu_cxx::__bfloat16_t. For std::ilogb that changes > behavior for the INT_MAX return because that isn't representable in > either of the floating poi

Re: Implement removal of malloc/free pairs with NULL check

2024-11-02 Thread Alexander Monakov
On Sat, 2 Nov 2024, Sam James wrote: > Some references to feed discussion which I had in my logs from > discussing it with someone the other week after that interaction we > had with alanc: > * https://github.com/llvm/llvm-project/issues/28790 (not very > insightful, other than to show it has a

[PATCH v3 4/8] vect: Add maskload else value support.

2024-11-02 Thread Robin Dapp
From: Robin Dapp This patch adds an else operand to vectorized masked load calls. The current implementation adds else-value arguments to the respective target-querying functions that is used to supply the vectorizer with the proper else value. We query the target for its supported else operand

[PATCH v3 7/8] i386: Add else operand to masked loads.

2024-11-02 Thread Robin Dapp
From: Robin Dapp This patch adds a zero else operand to masked loads, in particular the masked gather load builtins that are used for gather vectorization. gcc/ChangeLog: * config/i386/i386-expand.cc (ix86_expand_special_args_builtin): Add else-operand handling. (ix86_ex

[PATCH v3 5/8] aarch64: Add masked-load else operands.

2024-11-02 Thread Robin Dapp
From: Robin Dapp This adds zero else operands to masked loads and their intrinsics. I needed to adjust more than initially thought because we rely on combine for several instructions and a change in a "base" pattern needs to propagate to all those. gcc/ChangeLog: * config/aarch64/aarch6

[PATCH v3 8/8] RISC-V: Add else operand to masked loads [PR115336].

2024-11-02 Thread Robin Dapp
From: Robin Dapp This patch adds else operands to masked loads. Currently the default else operand predicate just accepts "undefined" (i.e. SCRATCH) values. PR middle-end/115336 PR middle-end/116059 gcc/ChangeLog: * config/riscv/autovec.md: Add else operand. *

[PATCH v3 3/8] tree-ifcvt: Add zero maskload else value.

2024-11-02 Thread Robin Dapp
From: Robin Dapp When predicating a load we implicitly assume that the else value is zero. This matters in case the loaded value is padded (like e.g. a Bool) and we must ensure that the padding bytes are zero on targets that don't implicitly zero inactive elements. A former version of this patc

[PATCH v3 6/8] gcn: Add else operand to masked loads.

2024-11-02 Thread Robin Dapp
From: Robin Dapp This patch adds an undefined else operand to the masked loads. gcc/ChangeLog: * config/gcn/predicates.md (maskload_else_operand): New predicate. * config/gcn/gcn-valu.md: Use new predicate. --- gcc/config/gcn/gcn-valu.md | 14 +- gcc/confi

[PATCH v3 1/8] docs: Document maskload else operand and behavior.

2024-11-02 Thread Robin Dapp
From: Robin Dapp This patch amends the documentation for masked loads (maskload, vec_mask_load_lanes, and mask_gather_load as well as their len counterparts) with an else operand. gcc/ChangeLog: * doc/md.texi: Document masked load else operand. --- gcc/doc/md.texi | 63

[PATCH v3 2/8] ifn: Add else-operand handling.

2024-11-02 Thread Robin Dapp
From: Robin Dapp This patch adds else-operand handling to the internal functions. gcc/ChangeLog: * internal-fn.cc (add_mask_and_len_args): Rename... (add_mask_else_and_len_args): ...to this and add else handling. (expand_partial_load_optab_fn): Use adjusted function.

[PATCH v3 0/8] Rebased: Add maskload else operand.

2024-11-02 Thread Robin Dapp
From: Robin Dapp No change apart from rebasing against the latest strided load addition so the CI can pick it up. Bootstrapped and regtested on x86, aarch64, and power10. Regtested on rv64gcv. Robin Dapp (8): docs: Document maskload else operand and behavior. ifn: Add else-operand handling.

Re: Implement removal of malloc/free pairs with NULL check

2024-11-02 Thread Martin Uecker
> > > > Please reconsider? Why to we need to match LLVM here?< > > Matching llvm is not really the goal. I implemented it since it is > useful optimization for code that builds small objects on heap and > compiler can optimize away their use. This is relatively common for > code with higer abstra

[FYI #5v2/7] extend ifcombine_replace_cond to handle noncontiguous ifcombine

2024-11-02 Thread Alexandre Oliva
Here's the adjusted patch that I'll push once #6/7 and #8/7++ are also approved. Retested along with them. Prepare to handle noncontiguous ifcombine, introducing logic to modify the outer condition when needed. There are two cases worth mentioning: - when blocks are noncontiguous, we have to

Re: [PATCH #3/7] introduce ifcombine_replace_cond

2024-11-02 Thread Alexandre Oliva
On Nov 2, 2024, Sam James wrote: > BTW, forgive the possibly silly question, but I don't see any testcases > for the series. They're in the original patch, upthread, that this series was split out of at reviewers' request. The tests all depended on a feature that was not to be included in this

[PATCH #8/7++] limit ifcombine stmt moving and adjust flow info (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-11-02 Thread Alexandre Oliva
It became apparent that conditions could be combined that had deep SSA dependency trees, that might thus require moving lots of statements. Set a hard upper bound for now, hopefully to be replaced by a dynamically computed bound, based on probabilities and costs. Also reset flow sensitive info a

Re: [PATCH] c++/modules: Fix recursive dependencies [PR116317]

2024-11-02 Thread Nathaniel Shead
On Fri, Nov 01, 2024 at 12:08:45PM -0400, Jason Merrill wrote: > On 10/31/24 6:09 AM, Nathaniel Shead wrote: > > Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? > > > > -- >8 -- > > > > In cases like the linked PR we sometimes get mutually recursive > > dependencies that both rel

Re: [PATCH] c++/modules: Merge default arguments [PR99274]

2024-11-02 Thread Nathaniel Shead
On Fri, Nov 01, 2024 at 11:23:41AM -0400, Jason Merrill wrote: > On 8/22/24 8:02 PM, Nathaniel Shead wrote: > > On Thu, Aug 22, 2024 at 02:20:14PM -0400, Patrick Palka wrote: > > > On Mon, 12 Aug 2024, Nathaniel Shead wrote: > > > > > > > Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for t

[PATCH] c: minor fixes related to arrays of unspecified size [PR116284,PR117391]

2024-11-02 Thread Martin Uecker
The recent patch to improve detection of variably modified types also fixed some issues related to unspecified sizes. https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=9eae9268e41463927c9383004e58708048ec379f There are some loose ends / possible cleanups which I missed and which are addressed by

Re: Pushed: [PATCH] LoongArch: testsuite: Add -O for jump-table-annotate.c

2024-11-02 Thread Xi Ruoyao
On Sat, 2024-11-02 at 09:52 +0800, Lulu Cheng wrote: > > 在 2024/11/2 上午1:36, Xi Ruoyao 写道: > > Without optimization, GCC does not emit a jump table for the test case. > > > > I'm not sure if the test case has been wrong in the first place or > > something has changed in these months... > > It wa

[PATCH] RISC-V: zero_extend(not) -> xor optimization [PR112398]

2024-11-02 Thread Alexey Merzlyakov
This patch adds optimization of the following patterns:   (zero_extend:M (subreg:N (not:O==M (X:Q==M ->   (xor:M (zero_extend:M (subreg:N (X:M)), 0x))     ... where mask takes 0x bits of N mode bitsize For the cases when X:M doesn't have any non-zero bits outside of mode N, (zero_e

Re: [RFC][PATCH] Adjust param_vect_max_version_for_alias_checks

2024-11-02 Thread Kugan Vivekanandarajah
> On 31 Oct 2024, at 7:29 pm, Jakub Jelinek wrote: > > External email: Use caution opening links or attachments > > > On Thu, Oct 31, 2024 at 08:21:09AM +, Kugan Vivekanandarajah wrote: >> >> >>> On 31 Oct 2024, at 6:18 pm, Jakub Jelinek wrote: >>> >>> External email: Use caution opening li

Re: [PATCH] LoongArch: Make __builtin_lsx_vorn_v and __builtin_lasx_xvorn_v arguments and return values unsigned

2024-11-02 Thread Xi Ruoyao
On Sat, 2024-11-02 at 14:26 +0800, Xi Ruoyao wrote: > On Sat, 2024-11-02 at 14:13 +0800, Lulu Cheng wrote: > > > > 在 2024/11/2 上午1:10, Xi Ruoyao 写道: > > > On Thu, 2024-10-31 at 23:58 +0800, Xi Ruoyao wrote: > > > > > > /* snip */ > > > > > > > --- > > > > > > > > Now running bootstrap & regtest

[PATCH] LoongArch: Add backward compatibility for signed vector arguments calling LSX/LASX vorn builtins

2024-11-02 Thread Xi Ruoyao
The patch at [1] changes these builtins to accept unsigned vector arguments to be consistent with other LSX/LASX bitwise builtins, but there's some concern about the backward compatibility. Make use of the existing built-in function overloading mechanism to provide the backward compatibility. Dep

Re: [PATCH #6/7] ifcombine across noncontiguous blocks

2024-11-02 Thread Alexandre Oliva
On Oct 30, 2024, Richard Biener wrote: > I think since you make the outer condition the short-circuiting one what's in > the inner block isn't executed when it wasn't before the transform? So in > fact you shouldn't need to process stmts in BB even? Only when the > outer condition is now uncond

[PATCH] LoongArch: Fix clerical errors in lasx_xvreplgr2vr_* and lsx_vreplgr2vr_*.

2024-11-02 Thread Lulu Cheng
[x]vldi.{b/h/w/d} is not implemented in LoongArch. Use the macro [x]vrepli.{b/h/w/d} to replace. gcc/ChangeLog: * config/loongarch/lasx.md: Fixed. * config/loongarch/lsx.md: Fixed. --- gcc/config/loongarch/lasx.md | 2 +- gcc/config/loongarch/lsx.md | 2 +- 2 files changed, 2 in

Re: [PATCH] gimplify: Fix up RAW_DATA_CST related ICE [PR117384]

2024-11-02 Thread Richard Biener
> Am 01.11.2024 um 11:13 schrieb Jakub Jelinek : > > Hi! > > Apparently tree_output_constant_def doesn't strictly guarantee that the > returned VAR_DECL will have the same or uselessly convertible type as > the type of the constant passed to it, compare_constants says: > /* For arrays, check

[PATCH] Allow limited extended asm at toplevel [PR41045]

2024-11-02 Thread Jakub Jelinek
Hi! Here is a new version of the toplevel asm PR41045 patch, not yet with the new constraints for symbol definitions (I intend to deal with that in a follow-up). Compared to the last patch, this one has some testcases added and some ICEs related to "m"/"=m" fixed; for LTO streaming I've added a so

[PATCH] libstdc++: Fix up std::{,b}float16_t std::{ilogb,l{,l}r{ound,int}} [PR117406]

2024-11-02 Thread Jakub Jelinek
Hi! These overloads incorrectly cast the result of the float __builtin_* to _Float or __gnu_cxx::__bfloat16_t. For std::ilogb that changes behavior for the INT_MAX return because that isn't representable in either of the floating point formats, for the others it is I think just a very inefficient