Re: [PATCH][stage1] middle-end/80342 - genmatch optimize outer conversions

2025-01-31 Thread Andrew Pinski
On Fri, Jan 31, 2025 at 4:44 AM Richard Biener wrote: > > The following improves genmatch generated code so we avoid more > spurious SSA assignments to be pushed to the GIMPLE sequence or > simplifications rejected when we're not supposed to produce any > for outer and intermediate conversions. A

Re: [PATCH v2] x86: Handle -mindirect-branch-register for -fno-plt

2025-01-31 Thread H.J. Lu
On Fri, Jan 31, 2025 at 10:09 PM Uros Bizjak wrote: > > On Fri, Jan 31, 2025 at 2:54 PM Uros Bizjak wrote: > > > > On Fri, Jan 31, 2025 at 2:36 PM H.J. Lu wrote: > > > > > > -fno-plt forces external call to indirect call via GOT memory. But > > > -mindirect-branch-register requires indirect cal

[committed][PR tree-optimization/114277] Fix missed optimization for multiplication against boolean value

2025-01-31 Thread Jeff Law
Andrew, Raphael and I have all poked at it in various ways over the last year or so. I think when Raphael and I first looked at it I sent us down a bit of rathole. In particular it's odd that we're using a multiply to implement a select and it seemed like recognizing the idiom and rewriting i

[PATCH] OpenMP: Improve Fortran metadirective diagnostics [PR107067]

2025-01-31 Thread Sandra Loosemore
The Fortran front end was giving an ICE instead of a user-friendly diagnostic when variants of a metadirective variant had different statement associations. The particular test case reported in the issue also involved invalid placement of the "omp end metadirective" which was not being diagnosed e

Re: [PATCH] Fix PR 118541, do not generate unordered fp cmoves for IEEE compares.

2025-01-31 Thread Michael Meissner
On Fri, Jan 31, 2025 at 08:04:53AM +0100, Richard Biener wrote: > On Fri, Jan 31, 2025 at 3:55 AM Michael Meissner > wrote: > > > > Fix PR 118541, do not generate unordered fp cmoves for IEEE compares. > > > > In bug PR target/118541 on power9, power10, and power11 systems, for the > > function:

[PATCH v2] c++: auto in trailing-return-type in parameter [PR117778]

2025-01-31 Thread Marek Polacek
On Fri, Jan 31, 2025 at 09:34:52AM -0500, Jason Merrill wrote: > On 1/30/25 5:24 PM, Marek Polacek wrote: > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/14? > > > > -- >8 -- > > This PR describes a few issues, both ICE and rejects-valid, but > > ultimately the problem is that we d

[PATCH] c++: bogus -Wvexing-parse with trailing-return-type [PR118718]

2025-01-31 Thread Marek Polacek
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- This warning should not warn for auto f1 () -> auto; because that cannot be confused with initializing a variable. PR c++/118718 gcc/cp/ChangeLog: * parser.cc (warn_about_ambiguous_parse): Don't warn when

Re: [patch, libfortran] PR114618 Version 2 Format produces incorrect output when contains 1x, ok when uses " "

2025-01-31 Thread Jerry D
On 1/31/25 11:30 AM, Harald Anlauf wrote: Hi Jerry, Am 30.01.25 um 21:50 schrieb Jerry D: On 1/29/25 10:30 AM, Jerry D wrote: Follow-up: On 1/28/25 1:33 PM, Harald Anlauf wrote: Jerry, while I haven't read your actual patch yet, I think the testcase is slightly incorrect. In fact, Intel, NA

Re: [PATCH] Fortran: host association issue with symbol in COMMON block [PR108454]

2025-01-31 Thread Harald Anlauf
Am 31.01.25 um 18:37 schrieb Jerry D: On 1/30/25 1:44 PM, Harald Anlauf wrote: Dear all, analyzing the the PR (by Gerhard) turned out to two slightly related issues.  The first one, where a variable in a COMMON block is falsely resolved to a derived type declared in the host, leads to a false f

Re: [patch, libfortran] PR114618 Version 2 Format produces incorrect output when contains 1x, ok when uses " "

2025-01-31 Thread Harald Anlauf
Hi Jerry, Am 30.01.25 um 21:50 schrieb Jerry D: On 1/29/25 10:30 AM, Jerry D wrote: Follow-up: On 1/28/25 1:33 PM, Harald Anlauf wrote: Jerry, while I haven't read your actual patch yet, I think the testcase is slightly incorrect. In fact, Intel, NAG, Nvidia and AMD flang disagree with it.

Re: [PATCH 1/2] libstdc++: Fix return value of vector::insert_range

2025-01-31 Thread Jonathan Wakely
On Fri, 31 Jan 2025 at 18:37, Patrick Palka wrote: > > In some cases we're wrongly returning an iterator pointing to (one past) > the last element inserted instead of to the first element inserted. Oops! Did I get it right in the linked lists? OK for trunk (with the .out removed). > > libstdc++

Re: [PATCH 2/2] libstdc++: Fix flat_foo::insert_range for non-common ranges [PR118156]

2025-01-31 Thread Jonathan Wakely
On Fri, 31 Jan 2025 at 18:29, Patrick Palka wrote: > > This fixes flat_map/multimap::insert_range by simply generalizing the > ::insert implementation to handle heterogenous iterator/sentinel pair. > I'm not sure we can do better than this, e.g. we can't implement it > in terms of the adapted cont

[PATCH/GCC16 v2 1/1] AArch64: Emit half-precision FCMP/FCMPE

2025-01-31 Thread Spencer Abson
Enable a target with FEAT_FP16 to emit the half-precision variants of FCMP/FCMPE. gcc/ChangeLog: * config/aarch64/aarch64.md: Update cbranch, cstore, fcmp and fcmpe to use the GPF_F16 iterator for floating-point modes. gcc/testsuite/ChangeLog: * gcc.target/aarch6

[PATCH/GCC16 v2 0/1] AArch64: Emit half-precision FCMP/FCMPE

2025-01-31 Thread Spencer Abson
Applied the fixups suggested in the previous review, cheers. This patch allows the AArch64 back end to emit the half-precision variants of FCMP and FCMPE, given the target supports FEAT_FP16. Previously, such comparisons would be unnecessarily promoted to single-precision. The latest documentat

[PATCH 45/61] Test float32-basic.c fails with -mabi=64 -EB

2025-01-31 Thread Aleksandar Rakic
From: "dragan.mladjenovic" Unlike float, the _Float32 value is passed w/o promotion when used as varargs parameter. On N32/64, the callee side expects it to be at offset 0 inside of 8-byte slot, which matches float behavior when passed on stack as named argument. Because of this, we need to make

[PATCH 54/61] fmadd.w should be restricted to mipsr6

2025-01-31 Thread Aleksandar Rakic
From: "dragan.mladjenovic" This patch prevents middle-end from using MSA fma on pre-r6 targets in order to avoid subtle inconsistencies with auto-vectorized code that might mix MSA fma with unfused scalar multiply-add. There might be Loongson targets that support MSA while having scalar multiply

[PATCH 53/61] Inefficient scattered double precision load in MSA

2025-01-31 Thread Aleksandar Rakic
From: Mihailo Stojanovic gcc/ * config/mips/mips.cc (mips_legitimate_combined_insn): New function. Cherry-picked 092a39db956a418e7e020107b062c170ed976841 from https://github.com/MIPS/gcc Signed-off-by: Mihailo Stojanovic Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksanda

[PATCH 60/61] Check anti-dependence between 0 and 3 for loads

2025-01-31 Thread Aleksandar Rakic
From: Chao-ying Fu gcc/ * config/mips/mips.md (join2_load_store): Check operand 0 and 3. Assert other two operands do not overlap after they are reordered. (*join2_loadhi): Same. Cherry-picked 63175687761e51dfe2f75dfab7b4de7f44bb4abe from https://github.com/MIPS/g

[PATCH 52/61] Fix register spill issue for soft-float glibc 2.29

2025-01-31 Thread Aleksandar Rakic
From: "dragan.mladjenovic" Adding the float-agnostic reproducer as test-case. gcc/testsuite/ * gcc.target/mips/tls-1.c: New file. Cherry-picked fa3b6a1347154973324d264e6ad2dbd66d3f0028 from https://github.com/MIPS/gcc Signed-off-by: Dragan Mladjenovic Signed-off-by: Faraz Shahb

Re: [PATCH] Fortran: host association issue with symbol in COMMON block [PR108454]

2025-01-31 Thread Jerry D
On 1/30/25 1:44 PM, Harald Anlauf wrote: Dear all, analyzing the the PR (by Gerhard) turned out to two slightly related issues.  The first one, where a variable in a COMMON block is falsely resolved to a derived type declared in the host, leads to a false freeing of the symbol, resulting in memo

[PATCH 42/61] Remove redundant moves

2025-01-31 Thread Aleksandar Rakic
From: Robert Suchanek Add peepholes to remove silly moves. These reloads happens because of different modes making elimination non-trivial. Cherry-picked 85462a9dbf8d659bfb0417d354a0a4f9cd4b8e07 from https://github.com/MIPS/gcc Signed-off-by: Robert Suchanek Signed-off-by: Faraz Shahbazker Si

Re: [PATCH 1/2] libstdc++: Fix return value of vector::insert_range

2025-01-31 Thread Patrick Palka
On Fri, 31 Jan 2025, Patrick Palka wrote: > In some cases we're wrongly returning an iterator pointing to (one past) > the last element inserted instead of to the first element inserted. > > libstdc++-v3/ChangeLog: > > * include/bits/stl_bvector.h (vector::insert_range): > Consistent

[PATCH 2/2] libstdc++: Fix flat_foo::insert_range for non-common ranges [PR118156]

2025-01-31 Thread Patrick Palka
This fixes flat_map/multimap::insert_range by simply generalizing the ::insert implementation to handle heterogenous iterator/sentinel pair. I'm not sure we can do better than this, e.g. we can't implement it in terms of the adapted containers' insert_range because that'd require two passes over th

[PATCH 48/61] Performance degradation for iDCT-4M example

2025-01-31 Thread Aleksandar Rakic
From: "dragan.mladjenovic" This workaround adds mfuse-vect-init option which causes the back-end to emit a single load for the vect_init if all the init elements come from the consecutive memory locations and are in the right order. gcc/ * config/mips/mips.cc (mips_fuse_vect_init_p): New

[PATCH 39/61] Frame barrier fix

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune Ensure the frame barrier prevents reordering of stack pointer changes. It is possible for a load/store accessing the stack via a copy of the stack pointer to be moved across the epilogue meaning that it accesses stack that is no longer allocated. This leads to a situation w

[PATCH 61/61] Fix pr54240

2025-01-31 Thread Aleksandar Rakic
From: Chao-ying Fu gcc/testsuite/ * gcc.target/mips/pr54240.c: Scan phiopt2. Cherry-picked 02dd052d4822ca187af075f1fb5301c954844144 from https://github.com/MIPS/gcc Signed-off-by: Chao-ying Fu Signed-off-by: Aleksandar Rakic --- gcc/testsuite/gcc.target/mips/pr54240.c | 2 +- 1 file

[PATCH 1/2] libstdc++: Fix return value of vector::insert_range

2025-01-31 Thread Patrick Palka
In some cases we're wrongly returning an iterator pointing to (one past) the last element inserted instead of to the first element inserted. libstdc++-v3/ChangeLog: * include/bits/stl_bvector.h (vector::insert_range): Consistently return an iterator pointing to the first element

[PATCH 57/61] Implement synthesised conditional xor/or

2025-01-31 Thread Aleksandar Rakic
From: Mihailo Stojanovic Create an additional case for if-conversion which expands the following sequence: "if (test) x ^= C;" as a = 0; if (test) a = C; x ^= a; This reduces the number of necessary conditional moves on some targets (most notably MIPS). gcc/ * config/mips/mips.cc (mip

[PATCH 49/61] Make rtl if-conversion more common

2025-01-31 Thread Aleksandar Rakic
From: "dragan.mladjenovic" Tune ifcvt parameters, so that we get if-conversion in more cases. gcc/ * config/mips/mips.cc (mips_rtx_costs): Reduce cost of if_then_else pattern. (mips_max_noce_ifcvt_seq_cost): New function. Decrease maximum permissible cost for the

[PATCH 41/61] Lightweight fix for shrink-wrapping inhibition

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune This should be solved using the various PIC related macros such as PIC_OFFSET_TABLE_REGNUM and pic_offset_table_rtx but changing these is too dangerous without investigation. The lightweight fix for shrink-wrapping being inhibited by -mgpopt just clears the global pointer f

[PATCH 55/61] Performance drop in mips-img-linux-gnu-gcc 7.x

2025-01-31 Thread Aleksandar Rakic
From: Mihailo Stojanovic gcc/ * config/mips/mips.cc (mips_rtx_costs): Reduce branch cost of conditional branches. (mips_prune_insertions_deletions): Target hook which checks whether a basic block is possibly if-convertible. Adjusts the insertion and deletio

[PATCH 47/61] Add -mmxu and -mno-mxu driver pass through

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune Cherry-picked 9acbf0b0efdfcc27e30b1db7a707dbe9cc6b64eb from https://github.com/MIPS/gcc Signed-off-by: Matthew Fortune Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- gcc/config/mips/mips.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/conf

[PATCH 50/61] Fix MSA SUBREG moves on big-endian targets

2025-01-31 Thread Aleksandar Rakic
From: Mihailo Stojanovic This fixes the MSA implementation on big-endian targets which is essentially broken for things like SUBREG handling and calling convention for vector types. It borrows heavily from [1] as Aarch64 has the same problem with SVE vectors. Conceptually, register bitconverts s

[PATCH 35/61] Testsuite: Use HAS_LDC instead of a specific ISA

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune The call-clobbered-1.c test has both reasons to be above a certain ISA and below a certain ISA level. The option based ISA min/max code only triggers if there is no isa level request. gcc/testsuite/ * gcc.target/mips/call-clobbered-1.c: Use HAS_LDC ghost op

[PATCH 44/61] Autovectorization failures on BE targets

2025-01-31 Thread Aleksandar Rakic
From: "dragan.mladjenovic" GCC assumes that taking a vector mode B SUBREG of vector mode A register allows it to interpret its memory layout as if in A vector mode. We currently allow this mode change to be no-op on MSA registers. This works on little-endian because MSA register layout matches t

[PATCH 51/61] Test solution on dspmac builtins

2025-01-31 Thread Aleksandar Rakic
From: Mihailo Stojanovic gcc/ * config/mips/mips.cc (mips_expand_builtin_insn): During expansion of DSP mac builtins, force the operands which correspond to the same inout register to have the same pseudo assigned. gcc/testsuite * gcc.target/mips/mac_zero_reload.c: New testcase

[PATCH 28/61] Fix wrong instruction in the delay slot

2025-01-31 Thread Aleksandar Rakic
From: Robert Suchanek The problematic test case shows that the use of __builtin_unreachable () has a branch not optimised away causing confusion in the eager delay slot filler if the "unreachable" is moved elsewhere by the block reordering pass. It appears that a series of unfortunate events cau

[PATCH 27/61] MIPSR6: Define new R6 FPU instructions

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune gcc/ * config/mips/mips.h (ISA_HAS_FCLASS): New macro. (ISA_HAS_RINT): Likewise. * config/mips/mips.md (unspec): Add UNSPEC_FCLASS and UNSPEC_FRINT. (type) Add fclass and frint. (fnma4): Enable for ISA_HAS_FUSED_MADDF.

[PATCH 38/61] MIPSR6: Mark R6 unaligned access

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune gcc/ * config/mips/mips.cc (mips_output_move): Mark unaligned load and store with a comment. Cherry-picked 42be7aa50f3b04a88768e08c000cfe7923f22b0f from https://github.com/MIPS/gcc Signed-off-by: Matthew Fortune Signed-off-by: Faraz Shahbazker Signed-off-

[PATCH 59/61] Add uclibc support

2025-01-31 Thread Aleksandar Rakic
From: Jean Lee Disable stack unwind and fix page size for uclibc on mips target. Fix "ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD." Disable SANITIZER_INTERCEPT_GLOB. Resolve libsanitizer bui

[PATCH 58/61] Add EHB after last load if branch within 16 inst.

2025-01-31 Thread Aleksandar Rakic
From: "dragan.mladjenovic" This workaround adds -mfix-i6400 and -mfix-i6500. If any of those two options are active, it will add an EHB after the last load instruction in sequence if there is a branch within 16 instructions following it. Options have no effect on pre-R6 or compressed ISA targets

[PATCH 26/61] Load/store bonding improvements

2025-01-31 Thread Aleksandar Rakic
From: Robert Suchanek gcc/ChangeLog: * config/mips/mips-protos.h (mips_load_store_bonding_p): New prototype. * config/mips/mips.cc (mips_load_store_bond_insns): New static function. (mips_block_move_straight): Bond insns where possible. (mips_for_e

[PATCH 36/61] Testsuite: Disable the time-profiler-2.c test

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune gcc/testsuite/ * gcc.dg/tree-prof/time-profiler-2.c: Skip for mips* triples as it is unstable in simulation. Cherry-picked 7c5a494a31c72ee3285ffae9fda738aa875869b9 from https://github.com/MIPS/gcc Signed-off-by: Matthew Fortune Signed-off-by: Faraz Shahbaz

[PATCH 37/61] Testsuite: Skip tests making calls to variables

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune The compressed MIPS ISAs (microMIPS and MIPS16) require the LSB of an address to indicate which ISA to execute. The non-conformant patterns used in these tests cannot set the ISA mode bit and may attempt to directly call the variable which triggers an error from the assembl

[PATCH 43/61] Disable ssa-dom-cse-2.c for MIPS lp64

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune The optimisation to reduce the result to constant 28 still happens but only much later in combine. gcc/testsuite/ * gcc.dg/tree-ssa/ssa-dom-cse-2.c: Do not check output for MIPS lp64 abi. Cherry-picked 7a9286a94817badb312e3bb2b4a7a83b8b3fa28a from https://g

[PATCH 46/61] nanoMIPS: unnecessary AND following an EXT

2025-01-31 Thread Aleksandar Rakic
From: "dragan.mladjenovic" The fwprop1 introduces a new use of Y by replacing the (subreg:QI (reg:SI X)) with (reg:QI Y) preventing the optimization of zero_extend later during the combine. This patch prevents this replacement in two new cases. A: (set (subreg:SI (reg:QI Y)) (z

[PATCH 56/61] Inefficient 64-bit signed modulo by powers of two

2025-01-31 Thread Aleksandar Rakic
From: Mihailo Stojanovic This adds the custom MIPS-specific modulo by power of two expander, which uses a modified algorithm, tailored to MIPS instruction set. gcc/ * config/mips/mips-protos.h (mips_expand_mod_pow2): New prototype. * config/mips/mips.cc (mips_rtx_costs): Don't force pow

[PATCH 33/61] Testsuite: Fix insn-*.c tests from trunk

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune Ensure micromips test does not get confused about library support. Ensure insn-casesi.c and insn-tablejump.c can be executed. Move the micromips/mips16 selection into the file as per function attributes so that there is no requirement on having a full micromips or mips16 ru

[PATCH 24/61] P5600: Option -msched-weight added

2025-01-31 Thread Aleksandar Rakic
From: Jaydeep Patil Cherry-picked 0cf2542b41d8102800af180f0b6da1fe55a9d76b from https://github.com/MIPS/gcc Signed-off-by: Prachi Godbole Signed-off-by: Jaydeep Patil Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- gcc/config/mips/mips.cc | 242 +

[PATCH 30/61] MSA: Make MSA and microMIPS R5 unsupported

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune There are no platforms nor simulators for MSA and microMIPS R5 so turning off this support for now. gcc/ChangeLog: * config/mips/mips.cc (mips_option_override): Error out for -mmicromips -mmsa. Cherry-picked 1009d6ff7a8d3b56e0224a6b193c5a7b3c29aa5f from ht

[PATCH 40/61] MIPSR6: Fix ICE occurred in R6 target

2025-01-31 Thread Aleksandar Rakic
From: Jaydeep Patil Fix ICE occurred in R6 target due to a clobber-list introduced in MADD/MSUB during combine pass. Cherry-picked 180f74c8ebdf13ddac806695d0333af7b924c402 from https://github.com/MIPS/gcc Signed-off-by: Jaydeep Patil Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar R

[PATCH 10/61] Add -mgrow-frame-downwards

2025-01-31 Thread Aleksandar Rakic
From: mfortune Grow the local frame down instead of up for mips16 code size. By growing the frame downwards we get spill slots created at the lowest address rather than highest address in a local frame. The benefit being that when the frame is large the spill slots can still be accessed using a

[PATCH 12/61] Add microMIPS R6 support

2025-01-31 Thread Aleksandar Rakic
From: Andrew Bennett Squashed commits: - Add umipsr6 compact branch support. - Multilib - microMIPS R6. - Don't think short micromips instructions are barriers. Some micromips insns have length of 2, but unfortuantely 2/4 returns 0, so the routine incorrectly thinks that the instruction is a b

[PATCH 23/61] Add offset shrinking pass (-mshrink-offsets)

2025-01-31 Thread Aleksandar Rakic
From: mfortune This is derived from code produced by Steve Ellcey. This approach is slightly diverged from the original concept. It tries to adjust the base pointer to a common value and keep the costing lower than original by trying to find the best common value to trigger more 16-bit instruct

[PATCH 25/61] Fix negative offset memory addressing

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune Unconditionally set DONT_BREAK_DEPENDENCIES in scheduling flags. The code to break dependencies does not appear to provide a win under any circumstance and is often harmful. Disable it completely pending further investigation. gcc/ * config/mips/mips.cc (mips

[PATCH 22/61] Add -minline-intermix to ignore mips16/nomips16

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune Add a CLI option and an inline_intermix function attribute to ignore ISA differences between a caller and a callee. The format of this attribute is __attribute__((inline_intermix(yes|no))). gcc/ * doc/extend.texi: Document inline_intermix. * config/mips/mips

[PATCH 13/61] MIPS: Only split shifts if using -mdebugd

2025-01-31 Thread Aleksandar Rakic
From: Andrew Bennett Enable -mdebugd by default. Cherry-picked adb95984114b7636ee15f2ba79f94b028c8b35b2 from https://github.com/MIPS/gcc Signed-off-by: Andrew Bennett Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- gcc/config/mips/mips.md | 1 + gcc/config/mips/mips.opt

[PATCH 34/61] Testsuite: Adjust tests to cope with -mips16

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune Cherry-picked 38288a0fd125d70a7876763d7165f858d902 from https://github.com/MIPS/gcc Signed-off-by: Matthew Fortune Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- .../gcc.target/mips/call-clobbered-2.c| 3 +- .../gcc.target/mips/call-cl

[PATCH 20/61] Add -march=interaptiv-mr2 with MIPS16E2

2025-01-31 Thread Aleksandar Rakic
From: Robert Suchanek - Bugfix [MIPS16E2]: split of moves of negative constants should exclude zero const. - Add support for every style of ZEB/ZEH support that has been tried: An earlier attempt to improve generation of ZEB/ZEH led to a chaotic effect of sometimes generating the instructions a

[PATCH 32/61] Account for LWL/LWR in store_by_pieces_p

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune Cherry-picked 53d838794ad3379fdd8d1f3a812aa8f2dff56399 from https://github.com/MIPS/gcc Signed-off-by: Matthew Fortune Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- gcc/config/mips/mips.cc | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-)

[PATCH 18/61] Add -mfunc-opt-list=

2025-01-31 Thread Aleksandar Rakic
From: Simon Dardis New option for MIPS -mfunc-opt-list=FILE. This option takes a file which has one function per line followed by a whitespace (space/tab) followed by one or more attributes. Supported attributes are O2, Os, code-read=pcrel, always_inline, noinline, mips16, nomips16, epi, longcall

[PATCH 21/61] Testsuite: Modify the gcc.dg/memcpy-4.c test

2025-01-31 Thread Aleksandar Rakic
From: Andrew Bennett Firstly, remove the MIPS specific bit of the test. Secondly, create a MIPS specific version in the gcc.target/mips. This will only execute for a MIPS ISA less than R6. Cherry-picked c8b051cdbb1d5b166293513b0360d3d67cf31eb9 from https://github.com/MIPS/gcc Signed-off-by: And

[PATCH 31/61] Improve aligned straight line memcpy

2025-01-31 Thread Aleksandar Rakic
From: Robert Suchanek Cherry-picked 4194c529fade9b3106d118cac63b71bc8b13f7be from https://github.com/MIPS/gcc Signed-off-by: Robert Suchanek Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- gcc/config/mips/mips.cc | 8 +++- gcc/config/mips/mips.h | 5 + 2 files ch

[PATCH 29/61] Prevent FP values being spilled to GPRs

2025-01-31 Thread Aleksandar Rakic
From: Simon Dardis gcc/ * config/mips/mips.cc (mips_ira_change_pseudo_allocno_class): Prevent FP modes being reloaded to GPRs. Don't force integer mode pseudos into GR_REGS (and likewise for float mode pseudos and FP_REGS) if both the allocno class and best cost cl

[PATCH 05/61] Hazard barrier return support

2025-01-31 Thread Aleksandar Rakic
From: Chao-ying Fu gcc/ * config/mips/mips.cc (mips_use_hazard_barrier_return_p): New static function. (mips_function_attr_inlinable_p): Likewise. (mips_compute_frame_info): Set use_hazard_barrier_return_p. Emit error for unsupported architecture choice.

[PATCH 11/61] Fix unsafe comparison against stack_pointer_rtx

2025-01-31 Thread Aleksandar Rakic
From: Andrew Bennett GCC can modify a rtx which was created using stack_pointer_rtx. This means that just doing a straight address comparision of a rtx against stack_pointer_rtx to see whether it is the stack pointer register will not be correct in all cases. This patch rewrites these comparison

[PATCH 15/61] Possible inlining improvements with -Os

2025-01-31 Thread Aleksandar Rakic
From: Robert Suchanek --param early-inlining-insns-cold=NUMBER --param max-inline-insns-small-and-cold=NUMBER Analysis shows that the main difference between -O2 and -Os goes down to inlining of cold or unlikely functions. The new parameters (defaulted to 0) mean to disable these limitations wit

[PATCH 17/61] Add -munique-sections feature

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune gcc/ * config/mips/mips.cc (mips_unique_sections_list): New global variable. (mips_read_list): Update prototype and error message. (ultimate_transparent_alias_target): New function. Copied from varasm.c. (mips_asm_unique_secti

[PATCH 16/61] Add -msdata-num and -msdata-opt-list support

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune Cherry-picked 2403e09c3a08b797e22e30f70f762ed1eadbd783 and f76b493c090cfc2f9270528e84ef0f04fb463c3f from https://github.com/MIPS/gcc Signed-off-by: Matthew Fortune Signed-off-by: Dragan Mladjenovic Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- gcc

[PATCH 19/61] Add support for a limit for inlining memcpy

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune Expose it with an option: -mblockmov-limit. A memcpy strictly less than this value will be considered for inlining. gcc/ChangeLog: * config/mips/mips.cc (mips_expand_block_move): Add support to control size of inlined memcpy. * config/mips/mips.opt

[PATCH 02/61] Add shadow-map for n32 ABI

2025-01-31 Thread Aleksandar Rakic
From: Faraz Shahbazker libsanitizer: * asan/asan_mapping.h (ASAN_SHADOW_OFFSET_CONST): Set correct offset for n32 ABI. Cherry-picked 12ec4fc5c3a19e6304b58775db1820892942efbc from https://github.com/MIPS/gcc Signed-off-by: Faraz Shahbazker Signed-off-by: Chao-ying Fu Signed-off

[PATCH 09/61] Ensure _UNDER_TEST executables are target based

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune This fixes an issue where some G++ tests need to use a C compiler as well as C++ to build an LTO test. contrib/ * test_installed: Use target to select default gcc/g++ etc. under test. Cherry-picked fc330482ef0a8f93d44b9ff4c458691d7785cc77 from https://githu

[PATCH 04/61] Enable LSAN and TSAN for mips with the 64-bit abi

2025-01-31 Thread Aleksandar Rakic
From: Chao-ying Fu Cherry-picked b9fd138826394dd188936c8031dec676e2d16b47 from https://github.com/MIPS/gcc Signed-off-by: Chao-ying Fu Signed-off-by: Aleksandar Rakic --- libsanitizer/configure.tgt | 5 + 1 file changed, 5 insertions(+) diff --git a/libsanitizer/configure.tgt b/libsaniti

[PATCH 07/61] Testsuite: Fix tests properly for compact-branches

2025-01-31 Thread Aleksandar Rakic
From: abennett Cherry-picked 4420f953c31daf1991011d306a56ab74c39b44ee and 83c13cb19cb1e87a25326024943b95930a17e86b from https://github.com/MIPS/gcc Signed-off-by: Andrew Bennett Signed-off-by: Matthew Fortune Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- gcc/testsuite/

[PATCH 00/61] Improve Mips target

2025-01-31 Thread Aleksandar Rakic
From: Aleksandar Rakic Andrew Bennett (4): Fix unsafe comparison against stack_pointer_rtx Add microMIPS R6 support MIPS: Only split shifts if using -mdebugd Testsuite: Modify the gcc.dg/memcpy-4.c test Chao-ying Fu (6): Fix libsanitizer linkage options for cross toolchains Enable LS

[PATCH 08/61] Testsuite: Accept jrc for clear cache intrinsic

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune Cherry-picked e8186b2f4b5e843a83775a10f923916c4c9253a5 from https://github.com/MIPS/gcc Signed-off-by: Matthew Fortune Signed-off-by: Faraz Shahbazker Signed-off-by: Aleksandar Rakic --- gcc/testsuite/gcc.target/mips/clear-cache-1.c | 2 +- 1 file changed, 1 insertion(+

[PATCH 03/61] Fix libsanitizer linkage options for cross toolchains

2025-01-31 Thread Aleksandar Rakic
From: Chao-ying Fu In case of cross toolchain build, where GCC libraries are not installed within the designated sysroot, the shared sanitizer libraries link against libstdc++.so within the same directory. However this directory is not in RPATH, so attempting to build a dynamically linked applica

[PATCH 01/61] Multilib changes

2025-01-31 Thread Aleksandar Rakic
From: Robert Suchanek Remove single-float and short-double axes from multilib spec. The single-float/short-double combination is not immediately supportable from GCC 6 as the -fshort-double option has been removed and we do not have backend logic to implement a direct replacement. If/when we do

[PATCH 06/61] Add support for -mclib=[newlib,small,tiny]

2025-01-31 Thread Aleksandar Rakic
From: Chao-ying Fu Cherry-picked 3c800e0a3278de913ccefa7eed6eb070d4f7c558 from https://github.com/MIPS/gcc Signed-off-by: Jaydeep Patil Signed-off-by: Faraz Shahbazker Signed-off-by: Chao-ying Fu Signed-off-by: Aleksandar Rakic --- gcc/config/mips/mips-opts.h | 7 +++ gcc/config/mips/m

[PATCH 14/61] MIPS: Add support for -mdead-loads

2025-01-31 Thread Aleksandar Rakic
From: Matthew Fortune This option redirects the destination of a load to $0 if it is volatile and the result is not used. gcc/ChangeLog: * config/mips/loongson-mmi.md: Add the additional argument. * config/mips/mips-msa.md: Likewise. * config/mips/mips-protos.h

[PATCH 0/61] Improve Mips target

2025-01-31 Thread Aleksandar Rakic
This patch series improves the support for the mips64r6 target in GCC, includes the enhancements to the general bug fixes and contains other MIPS ISA and processor enablement. These patches are cherry-picked from the mips_rel/11_2_0/master and mips_rel/9_3_0/master branches from the MIPS' reposito

[PATCH v11] c++: Fix overeager Woverloaded-virtual with conversion operators [PR109918]

2025-01-31 Thread Simon Martin
Hi Jason, On 27 Jan 2025, at 16:49, Jason Merrill wrote: > On 1/27/25 10:41 AM, Simon Martin wrote: >> Hi Jason, >> >> On 17 Jan 2025, at 23:33, Jason Merrill wrote: >> >>> On 1/17/25 9:52 AM, Simon Martin wrote: Hi Jason, On 16 Jan 2025, at 22:49, Jason Merrill wrote: > O

[PATCH] aarch64: Fix dupq_* testsuite failures

2025-01-31 Thread Richard Sandiford
This patch fixes the dupq_* testsuite failures. The tests were introduced with r15-3669-ga92f54f580c3 (which was a nice improvement) and Pengxuan originally had a follow-on patch to recognise INDEX constants during vec_init. I'd originally wanted to solve this a different way, using wildcards whe

Re: [PATCH v2] c++: Don't merge friend declarations that specify default arguments [PR118319]

2025-01-31 Thread Simon Martin
Hi Jason, On 31 Jan 2025, at 16:29, Jason Merrill wrote: > On 1/31/25 9:52 AM, Simon Martin wrote: >> Hi Jason, >> >> On 9 Jan 2025, at 22:55, Jason Merrill wrote: >> >>> On 1/9/25 8:25 AM, Simon Martin wrote: We segfault upon the following invalid code === cut here === templa

Re: [PATCH] OpenMP/Fortran: Add missing pop_state in parse_omp_dispatch

2025-01-31 Thread Paul-Antoine Arras
Pushed to master as obvious. This should fix PR118714. On 31/01/2025 11:46, Paul-Antoine Arras wrote: When the ST_NONE case is taken, the function returns immediately. Not calling pop_state causes a dangling pointer. gcc/fortran/ChangeLog: * parse.cc (parse_omp_dispatch): Add missing p

Re: [PATCH v2] c++: Don't merge friend declarations that specify default arguments [PR118319]

2025-01-31 Thread Jason Merrill
On 1/31/25 9:52 AM, Simon Martin wrote: Hi Jason, On 9 Jan 2025, at 22:55, Jason Merrill wrote: On 1/9/25 8:25 AM, Simon Martin wrote: We segfault upon the following invalid code === cut here === template struct S { friend void foo (int a = []{}()); }; void foo (int a) {} int main () {

Re: [PATCH] libstdc++: Use canonical loop form in std::reduce

2025-01-31 Thread Abhishek Kaushik
Can we do __first + 4 <= __last? From: Jonathan Wakely Sent: Friday, January 31, 2025 8:28 PM To: libstd...@gcc.gnu.org Cc: Abhishek Kaushik ; gcc-patches@gcc.gnu.org Subject: Re: [PATCH] libstdc++: Use canonical loop form in std::reduce On Fri, 31 Jan 2025 at

Re: [PATCH] libstdc++: Use canonical loop form in std::reduce

2025-01-31 Thread Abhishek Kaushik
* ICX needs to be improved here Yes, we're trying to fix this but I figure I could also try asking politely. * a user could write such code himself. But it still makes sense for std::reduce to be faster than a hand-written reduce because we assume that as users of stl :) __

Re: [PATCH v2] wwwdocs: add a Python postprocessing script

2025-01-31 Thread Gerald Pfeifer
On Wed, 29 Jan 2025, David Malcolm wrote: >> python3: can't open file '/www/gcc/htdocs- >> preformatted/bin/process_html.py': [Errno 2] No such file or directory >> bin/process_html.py failed; aborting. >> >> I tried replacing this with just "process_html.py" or >> "./process_html.py", >> alas

Re: [PATCH] libstdc++: Use canonical loop form in std::reduce

2025-01-31 Thread Jonathan Wakely
On Fri, 31 Jan 2025 at 14:47, Marc Glisse wrote: > > On Fri, 31 Jan 2025, Abhishek Kaushik wrote: > > > The current while loop in std::reduce and related functions is hard to > > vectorize because the loop control variable is hard to detect in icx. > > > > `while ((__last - __first) >= 4)` > > > >

Re: [PATCH] libstdc++: Use canonical loop form in std::reduce

2025-01-31 Thread Richard Biener
On Fri, Jan 31, 2025 at 2:50 PM Jonathan Wakely wrote: > > On Fri, 31 Jan 2025 at 12:48, Richard Biener > wrote: > > > > On Fri, Jan 31, 2025 at 12:01 PM Abhishek Kaushik > > wrote: > > > > > > From 4ac7c7e56e23ed2f4dd2dafdfab6cfa110c14260 Mon Sep 17 00:00:00 2001 > > > From: Abhishek Kaushik

Re: [PATCH] libstdc++: Use canonical loop form in std::reduce

2025-01-31 Thread Marc Glisse
On Fri, 31 Jan 2025, Abhishek Kaushik wrote: The current while loop in std::reduce and related functions is hard to vectorize because the loop control variable is hard to detect in icx. `while ((__last - __first) >= 4)` Changing the loop header to a for loop following the OpenMP canonical form

[PATCH v2] c++: Don't merge friend declarations that specify default arguments [PR118319]

2025-01-31 Thread Simon Martin
Hi Jason, On 9 Jan 2025, at 22:55, Jason Merrill wrote: > On 1/9/25 8:25 AM, Simon Martin wrote: >> We segfault upon the following invalid code >> >> === cut here === >> template struct S { >>friend void foo (int a = []{}()); >> }; >> void foo (int a) {} >> int main () { >>S<0> t; >>

Re: [PATCH] icf, v2: Compare call argument types in certain cases and asm operands [PR117432]

2025-01-31 Thread Richard Biener
On Fri, 31 Jan 2025, Jakub Jelinek wrote: > On Fri, Jan 31, 2025 at 02:29:57PM +0100, Jakub Jelinek wrote: > > > } > > > else > > > { > > > tree fntype1 = gimple_call_fntype (s1); > > > tree fntype2 = gimple_call_fntype (s2); > > > > > > if ((fntype1 && !fntype2) > > >

[pushed][PR116234][LRA]: Check debug insn when looking at one insn pseudo occurrence

2025-01-31 Thread Vladimir Makarov
The following patch solves https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116234 The patch was successfully bootstrapped and tested on x86_64, aarch64, ppc64le. commit decc6c0d4d909ce510b6533c48d70d0b353f909a Author: Vladimir N. Makarov Date: Fri Jan 31 09:39:45 2025 -0500 [PR116234][LR

Re: [PATCH v2] c++: wrong-code with consteval constructor [PR117501]

2025-01-31 Thread Jason Merrill
On 1/30/25 3:43 PM, Marek Polacek wrote: On Wed, Jan 29, 2025 at 08:03:37AM -0500, Jason Merrill wrote: On 1/27/25 6:19 PM, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/14? -- >8 -- We've had a wrong-code problem since r14-4140, due to which we forget to ini

Re: [PATCH] c++: auto in trailing-return-type in parameter [PR117778]

2025-01-31 Thread Jason Merrill
On 1/30/25 5:24 PM, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/14? -- >8 -- This PR describes a few issues, both ICE and rejects-valid, but ultimately the problem is that we don't properly synthesize the second auto in: int g (auto fp() -> auto) {

[PATCH] libstdc++: Use canonical loop form in std::reduce

2025-01-31 Thread Abhishek Kaushik
>From 7a7c9a2a976fbb29f67c46284e7c1581cbe8cb07 Mon Sep 17 00:00:00 2001 From: Abhishek Kaushik Date: Fri, 31 Jan 2025 01:28:48 -0800 Subject: [PATCH] libstdc++: Use canonical loop form in std::reduce This change is for the INTEL C compiler (icx). The current while loop in std::reduce and related

Re: [PATCH] libstdc++: Use canonical loop form in std::reduce

2025-01-31 Thread Abhishek Kaushik
Sorry for the confusion, the change is for the intel compiler which is not able to vectorize correctly the while loop. I'll change the commit message to show this clearly. But it looks like the change still might be beneficial to g++: https://godbolt.org/z/Mo3PdxbaY ___

[PATCH] icf, v2: Compare call argument types in certain cases and asm operands [PR117432]

2025-01-31 Thread Jakub Jelinek
On Fri, Jan 31, 2025 at 02:29:57PM +0100, Jakub Jelinek wrote: > > } > > else > > { > > tree fntype1 = gimple_call_fntype (s1); > > tree fntype2 = gimple_call_fntype (s2); > > > > if ((fntype1 && !fntype2) > > || (!fntype1 && fntype2) > > || (fntype1

  1   2   >