[PATCH] phiopt: Optimize (x != cst1 ? x : cst2) != cst3 [PR104639]

2022-04-08 Thread Jakub Jelinek via Gcc-patches
Hi! Here is an attempt to resolve a P1 regression, where due to threading changes we no longer optimize bool foo(int i) { while (i == 4) i += 2; return i; } to just return i != 0; by enhancing the phiopt value_replacement optimization. Normally it will optimize x != cst1 ? x : cst

[PATCH] LoongArch: Fix bug for tmpdir-g++.dg-struct-layout-1/t033.

2022-04-08 Thread Lulu Cheng
From: chenglulu gcc/ChangeLog: * config/loongarch/loongarch.cc: Fix bug for tmpdir-g++.dg-struct-layout-1/t033. --- gcc/config/loongarch/loongarch.cc | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loo

Re: [PATCH] loongarch: testsuite: adapt stack-usage-1.c for LP64

2022-04-08 Thread Cheng Lulu
在 2022/4/9 上午5:48, Xi Ruoyao 写道: Another simple testcase change for LoongArch. Ok for trunk? --- LoongArch backend allocates two additional 8-byte stack slots for LP64, one for saving $fp and another for saving the temporary value "1". Ideally they are both unneeded, but (1) we're using -O0

Re: [PATCH] loongarch: testsuite: skip builtin-apply2.c

2022-04-08 Thread 程璐璐
在 2022/4/9 上午5:46, Xi Ruoyao 写道: A simple testcase change, tested on loongarch64-linux-gnuabif64. Ok for trunk? --- On LoongArch, variadic functions use different arugment passing conventions so this test is not valid (see the section named "Variadic argument" in the [ELF ABI][1]) and should

Re: [PATCH] c++: tolerate cdtors returning this in constexpr

2022-04-08 Thread Jason Merrill via Gcc-patches
On 4/7/22 18:25, Alexandre Oliva wrote: Hello, Jason, On Apr 6, 2022, Jason Merrill wrote: On 4/6/22 15:36, Alexandre Oliva wrote: Please adjust your patch subject lines for the new guidelines adopted as part of the git transition: https://gcc.gnu.org/contribute.html#patches Oh, wow, I

Re: [PATCH] c++: set loc on call even if result is discarded

2022-04-08 Thread Jason Merrill via Gcc-patches
On 4/7/22 18:48, Alexandre Oliva wrote: On Apr 6, 2022, Jason Merrill wrote: On 4/6/22 15:37, Alexandre Oliva wrote: Need to adjust this subject line, as well. *nod*, thanks * tree.cc (protected_set_expr_location): Propagate locus to call wrapped in cast-to-void. I'm reluctant to put t

[pushed] c++: constexpr non-trivial aggregate init [PR105191]

2022-04-08 Thread Jason Merrill via Gcc-patches
My patch for PR92385 made us use VEC_INIT_EXPR for aggregate initialization of an array where some elements are not explicitly initialized. Constexpr handling of that was treating initialization from {} as equivalent to value-initialization, which is problematic for classes with default member ini

[pushed] c++: friend implicit template instantiation [PR91618]

2022-04-08 Thread Jason Merrill via Gcc-patches
This rule that for a friend with a qualified name we try to find a matching template was already in C++98, but it seems we never implemented it, and nobody reported it until 2019. This patch sets DECL_IMPLICIT_INSTANTIATION to signal to check_explicit_specialization that we want to find a template

[PATCH] loongarch: testsuite: adapt stack-usage-1.c for LP64

2022-04-08 Thread Xi Ruoyao via Gcc-patches
Another simple testcase change for LoongArch. Ok for trunk? --- LoongArch backend allocates two additional 8-byte stack slots for LP64, one for saving $fp and another for saving the temporary value "1". Ideally they are both unneeded, but (1) we're using -O0 so the code is suboptimized by the na

[PATCH] loongarch: testsuite: skip builtin-apply2.c

2022-04-08 Thread Xi Ruoyao via Gcc-patches
A simple testcase change, tested on loongarch64-linux-gnuabif64. Ok for trunk? --- On LoongArch, variadic functions use different arugment passing conventions so this test is not valid (see the section named "Variadic argument" in the [ELF ABI][1]) and should be skipped. [1]: https://loongson.

Re: [PATCH] Add zero_extendditi2. Improve lxvr*x code generation.

2022-04-08 Thread Michael Meissner via Gcc-patches
On Wed, Apr 06, 2022 at 03:01:33PM -0500, will schmidt wrote: > In this context it's not clear what is the "old code" ? > The mtvsrdd > instruction is referenced in this code path. I see no direct reference > to lxvrdx here, though I suppose it's assumed somewhere behind the > emit_ calls. The lx

[PATCH, v2] PR fortran/105184 - ICE in gfc_array_init_size, at fortran/trans-array.cc:5841

2022-04-08 Thread Harald Anlauf via Gcc-patches
Dear all, Am 06.04.22 um 22:30 schrieb Harald Anlauf via Fortran: Dear all, the logic for checking the allocate-coshape-spec in an ALLOCATE statement was sort of sideways, and allowed to pass invalid specifications to the code generation. The fix seems obvious (to me). after submitting the p

Re: rustc_codegen_gcc and libgccjit for GCC 12 ?

2022-04-08 Thread Antoni Boucher via Gcc-patches
On Fri, 2022-04-08 at 15:36 -0400, David Malcolm wrote: > I'm excited to read that rustc_codegen_gcc, the libgccjit-based > backend > for rustc can now bootstrap rustc: >   https://blog.antoyo.xyz/rustc_codegen_gcc-progress-report-10 > > I've been focusing on the analyzer, and so haven't been as o

Re: [PATCH] libgccjit: Add support for sized integer types, including 128-bit integers [PR95325]

2022-04-08 Thread Antoni Boucher via Gcc-patches
David, it seems you missed this email that contains the updated patch and a few questions. Attaching the patch again. Thanks for the reviews! On Fri, 2022-01-21 at 11:22 -0500, Antoni Boucher via Jit wrote: > David: this is the email I was talking about in my other email. > Here's the updated pa

Re: [PATCH v2] RISCV: Add support for inlining subword atomics

2022-04-08 Thread Andreas Schwab
On Apr 08 2022, Patrick O'Neill wrote: > It looks like the file: > gcc/config/nds32/linux.h > interacts with the macro: > #define HAVE_sync_compare_and_swaphi 1 > > I'm not sure if that's the correct way to do it/if this is defined in a > different way for targets like x86/ARM/etc. They are norma

Re: [PATCH, rs6000] Correct match pattern in pr56605.c

2022-04-08 Thread Segher Boessenkool
Hi! On Mon, Feb 28, 2022 at 11:17:27AM +0800, HAO CHEN GUI wrote: > This patch corrects the match pattern in pr56605.c. The former pattern > is wrong and test case fails with GCC11. It should match following insn on > each subtarget after mode promotion is disabled. The patch need to be > backpo

rustc_codegen_gcc and libgccjit for GCC 12 ?

2022-04-08 Thread David Malcolm via Gcc-patches
I'm excited to read that rustc_codegen_gcc, the libgccjit-based backend for rustc can now bootstrap rustc: https://blog.antoyo.xyz/rustc_codegen_gcc-progress-report-10 I've been focusing on the analyzer, and so haven't been as on top of libgccjit patch review as I should have been. Sorry about

Re: [PATCH] libgccjit: Add support for bitcasts [PR104071]

2022-04-08 Thread David Malcolm via Gcc-patches
On Fri, 2022-01-21 at 18:41 -0500, Antoni Boucher wrote: > Hi. > Here's the updated patch. > Thanks. Review below: [...snip...] > diff --git a/gcc/jit/libgccjit.cc b/gcc/jit/libgccjit.cc > index 4c352e8c93d..6bf1e1ceee0 100644 > --- a/gcc/jit/libgccjit.cc > +++ b/gcc/jit/libgccjit.cc > @@ -240

Re: [PATCH] c, c++: attribute format on a ctor with a vbase [PR101833, PR47634]

2022-04-08 Thread Marek Polacek via Gcc-patches
On Wed, Apr 06, 2022 at 04:55:54PM -0400, Jason Merrill wrote: > On 4/1/22 15:14, Marek Polacek wrote: > > Attribute format takes three arguments: archetype, string-index, and > > first-to-check. The last two specify the position in the function > > parameter list. r63030 clarified that "Since no

Re: [PATCH] libgccjit: Add support for setting the alignment [PR104293]

2022-04-08 Thread David Malcolm via Gcc-patches
On Sun, 2022-01-30 at 20:38 -0500, Antoni Boucher via Gcc-patches wrote: > Hi. > This patch adds support for setting the alignment of variables in > libgccjit. Thanks. Sorry about the delay in reviewing it. > > I was wondering if I should change it so that it takes/returns bytes > instead of bi

Re: [PATCH v2] RISCV: Add support for inlining subword atomics

2022-04-08 Thread Patrick O'Neill
Hi Pan RZ, I appreciate the help - that's a good starting point for the macros. It looks like the file: gcc/config/nds32/linux.h interacts with the macro: #define HAVE_sync_compare_and_swaphi 1 I'm not sure if that's the correct way to do it/if this is defined in a different way for targets lik

Re: [PATCH v2] RISCV: Add support for inlining subword atomics

2022-04-08 Thread Pan RZ
Hi Patrick, We are more than delighted to hear that you'd like to implement inlining subword atomic load/store and exchange as well! I searched for these macros in the gcc codebase, and it seems like the internal logic that defines ATOMIC_* builtin macros can be found at gcc/c-family/c-cpp

[committed 3/3] libstdc++: Fix constraints on std::expected constructor [PR105153]

2022-04-08 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/105153 * include/std/expected (expected::expected(expected&&)): Fix constraints. * testsuite/20_util/expected/cons.cc: Check constructor. --- libstdc++-v3/include/std/expected

[committed 2/3] libstdc++: Fix std::expected::swap(expected&) [PR105154]

2022-04-08 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/105154 * include/std/expected (expected::swap): Set _M_has_value to false for objects that previously had a value. * testsuite/20_util/expected/swap.cc: Fix test to check void

[committed 1/3] libstdc++: Fix std::bad_expected_access constructor [PR105146]

2022-04-08 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/105146 * include/std/expected (bad_expected_access): Move constructor parameter. * testsuite/20_util/expected/bad.cc: New test. --- libstdc++-v3/include/std/expected

Re: [PATCH] rs6000: Guard bifs {un, }pack_{longdouble, ibm128} under hard float [PR103623]

2022-04-08 Thread Segher Boessenkool
On Fri, Apr 08, 2022 at 10:09:44AM +0800, Kewen.Lin wrote: > As Jakub noted here, we don't have the soft-float support for both m32 and m64 > before, as the bifs are always guarded under hard-float previously. But that bug was fixed for GCC 12. Or we thought so, at least :-( > >> What makes it I

Re: [PATCH] rs6000: Guard bifs {un, }pack_{longdouble, ibm128} under hard float [PR103623]

2022-04-08 Thread Segher Boessenkool
On Thu, Apr 07, 2022 at 03:00:14PM +0200, Jakub Jelinek wrote: > On Thu, Apr 07, 2022 at 06:09:52AM -0500, Segher Boessenkool wrote: > > On Thu, Mar 03, 2022 at 10:11:32AM +0800, Kewen.Lin wrote: > > > As PR103623 shows, it's a regression failure due to new built-in > > > function framework, previo

Re: [PATCH v2] RISCV: Add support for inlining subword atomics

2022-04-08 Thread Patrick O'Neill
Hi RZ Pan, I'll start working on the atomic store/exchange stuff. It shouldn't be too difficult to add since it will have similar masking logic to atomic fetch. Also - I briefly looked and couldn't find the place where those macro's values for RISC-V are defined in GCC. If anyone can point me in

Re: [PATCH, rs6000] Correct match pattern in pr56605.c

2022-04-08 Thread will schmidt via Gcc-patches
On Mon, 2022-02-28 at 11:17 +0800, HAO CHEN GUI via Gcc-patches wrote: > Hi, > This patch corrects the match pattern in pr56605.c. The former pattern > is wrong and test case fails with GCC11. It should match following insn on > each subtarget after mode promotion is disabled. The patch need to b

[PATCH] libiberty: add AC_CONFIG_MACRO_DIRS

2022-04-08 Thread Simon Marchi via Gcc-patches
Add AC_CONFIG_MACRO_DIRS([../config]) So that just running: $ autoreconf -vf ... does the right thing (no need to specify -I ../config). Note: I don't have access to the gcc repo, so if this patch is approved, can somebody push it there on my behalf? I can push it to binutils-gdb. libibe

Re: [PATCH v2] rs6000: Guard bifs {un, }pack_{longdouble, ibm128} under hard float [PR103623]

2022-04-08 Thread Segher Boessenkool
On Fri, Apr 08, 2022 at 03:09:00PM +0800, Kewen.Lin wrote: > As PR103623 shows, it's a regression failure due to new built-in > function framework, previously we guard __builtin_{un,}pack_{longdouble, > ibm128} built-in functions under hard float, so they are unavailable > with the given configurat

Re: [PATCH] Pass PKG_CONFIG_PATH down from top-level Makefile

2022-04-08 Thread Simon Marchi via Gcc-patches
On 2022-04-08 10:32, Nick Clifton wrote: > Hi Simon, > >> Ping. > > Patch approved - please apply. > > I appreciate that modifying these top level files is a bit nerve > wracking, but I think that you have done a good job in this case. :-) > > Cheers >   Nick > Thanks Nick, pushed. Simon

[PATCH][GCC] arm: remove unnecessary armv9-a multilib variant [PR104144]

2022-04-08 Thread Przemyslaw Wirkus via Gcc-patches
Hi, This patch is removing unnecessary armv9-a multilib variant which was introduced in commit 32ba7860ccaddd5219e6dae94a3d0653e124c9dd (add armv9-a architecture to -march). Now armv9-a(+simd) multilibs point to already existing armv8-a(+simd) ones as there are no changes between the two. Users wi

Re: [PATCH] rs6000/test: Adjust p9-vec-length-7 sensitive to unroll [PR103196]

2022-04-08 Thread Segher Boessenkool
Hi! Thanks for investigating. On Fri, Apr 08, 2022 at 03:25:51PM +0800, Kewen.Lin wrote: > on 2022/4/8 3:29 AM, Segher Boessenkool wrote: > > On Thu, Apr 07, 2022 at 09:19:51AM -0500, will schmidt wrote: > >> On Mon, 2022-02-28 at 13:37 +0800, Kewen.Lin via Gcc-patches wrote: > >>> As PR103196 sh

Re: [PATCH] Pass PKG_CONFIG_PATH down from top-level Makefile

2022-04-08 Thread Nick Clifton via Gcc-patches
Hi Simon, Ping. Patch approved - please apply. I appreciate that modifying these top level files is a bit nerve wracking, but I think that you have done a good job in this case. :-) Cheers Nick

[PATCH] tree-optimization/105198 - wrong code with predictive commoning

2022-04-08 Thread Richard Biener via Gcc-patches
When predictive commoning looks for a looparound PHI it tries to match the entry value definition (a load) up with the appropriate member of the chain. But it fails to consider stmts clobbering the very same memory location inbetween the load and loop entry. In theory we could be more clever on m

Re: [PATCH] testsuite: Increase auto-inlining param in gcc.dg/ipa/remref-7.c (PR 105183)

2022-04-08 Thread Richard Biener via Gcc-patches
On Fri, Apr 8, 2022 at 12:55 PM Martin Jambor wrote: > > Hi, > > a scan dump of testsuite gcc.dg/ipa/remref-7.c fails on a number of > platforms. I investigated only i?86-*-* with -mno-sse but assume the > issue is the same on all of the affected platform. > > Because function bar is not inlined

[PATCH] testsuite: Increase auto-inlining param in gcc.dg/ipa/remref-7.c (PR 105183)

2022-04-08 Thread Martin Jambor
Hi, a scan dump of testsuite gcc.dg/ipa/remref-7.c fails on a number of platforms. I investigated only i?86-*-* with -mno-sse but assume the issue is the same on all of the affected platform. Because function bar is not inlined there even though it is only called once, the process that is being

Re: [AArch64] PR target/105157 Increase number of cores TARGET_CPU_DEFAULT can encode

2022-04-08 Thread Richard Sandiford via Gcc-patches
"Andre Vieira (lists)" writes: > On 08/04/2022 08:04, Richard Sandiford wrote: >> I think this would be better as a static assert at the top level: >> >>static_assert (TARGET_CPU_generic < TARGET_CPU_MASK, >> "TARGET_CPU_NBITS is big enough"); > The motivation being that you want

Re: [AArch64] PR target/105157 Increase number of cores TARGET_CPU_DEFAULT can encode

2022-04-08 Thread Andre Vieira (lists) via Gcc-patches
On 08/04/2022 08:04, Richard Sandiford wrote: I think this would be better as a static assert at the top level: static_assert (TARGET_CPU_generic < TARGET_CPU_MASK, "TARGET_CPU_NBITS is big enough"); The motivation being that you want this to be checked regardless of wheth

Re: [PATCH] Add condition coverage profiling

2022-04-08 Thread Sebastian Huber
On 08/04/2022 09:33, Jørgen Kvalsvik wrote: On 08/04/2022 09:28, Jørgen Kvalsvik wrote: On 07/04/2022 18:53, Sebastian Huber wrote: Hello Jørgen, there could be an issue with conditions in for loops:     3:  189:  for (int a = 0; a <= 1; ++a) { branch  0 taken 2 branch  1 taken 1 (fallth

Re: [PATCH v2] rs6000: Guard bifs {un, }pack_{longdouble, ibm128} under hard float [PR103623]

2022-04-08 Thread Kewen.Lin via Gcc-patches
on 2022/4/8 4:04 PM, Jakub Jelinek wrote: > On Fri, Apr 08, 2022 at 03:09:00PM +0800, Kewen.Lin wrote: >> + /* Let's ignore all error messages about built-in function >> + unsupported due to soft-float, since they are not test >> + points here (this case is to check no ICE). */ >> + /* {

Re: [PATCH v2] rs6000: Guard bifs {un,}pack_{longdouble,ibm128} under hard float [PR103623]

2022-04-08 Thread Jakub Jelinek via Gcc-patches
On Fri, Apr 08, 2022 at 03:09:00PM +0800, Kewen.Lin wrote: > + /* Let's ignore all error messages about built-in function > + unsupported due to soft-float, since they are not test > + points here (this case is to check no ICE). */ > + /* { dg-error ".*" "pr103623" { target *-*-* } .-19

[committed] testsuite: Fix up 20050113-1.c test for i686-linux [PR105187]

2022-04-08 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 09:26:56PM -0400, Jason Merrill via Gcc-patches wrote: > gcc/testsuite/ChangeLog: > > * gcc.c-torture/compile/20050113-1.c: Moved to... > * c-c++-common/torture/20050113-1.c: ...here. The test FAILs on i686-linux if neither MMX isn't enabled, can be also reprod

Re: [PATCH] rs6000/test: Adjust p9-vec-length-7 sensitive to unroll [PR103196]

2022-04-08 Thread Kewen.Lin via Gcc-patches
Hi Will, on 2022/4/7 10:19 PM, will schmidt wrote: > On Mon, 2022-02-28 at 13:37 +0800, Kewen.Lin via Gcc-patches wrote: >> Hi, >> ... >> - >> PR testsuite/103196 >> >> gcc/testsuite/ChangeLog: >> >> * gcc.target/powerpc/p9-vec-length-7.h: Add DO_PRAGMA macro. >> * gcc.target/po

Re: libgomp nvptx plugin: Split 'PLUGIN_NVPTX_DYNAMIC' into 'PLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H' and 'PLUGIN_NVPTX_LINK_LIBCUDA' (was: [PATCH] Allow building GCC with PTX offloading even without CUDA

2022-04-08 Thread Tom de Vries via Gcc-patches
On 4/8/22 00:27, Thomas Schwinge wrote: Hi! On 2017-01-13T19:11:23+0100, Jakub Jelinek wrote: Especially for distributions it is undesirable to need to have proprietary CUDA libraries and headers installed when building GCC. --- libgomp/plugin/configfrag.ac.jj 2017-01-13 12:07:56.

[PATCH] Add condition coverage profiling

2022-04-08 Thread Jørgen Kvalsvik via Gcc-patches
On 08/04/2022 09:28, Jørgen Kvalsvik wrote: > On 07/04/2022 18:53, Sebastian Huber wrote: >> Hello Jørgen, >> >> there could be an issue with conditions in for loops: >> >>     3:  189:  for (int a = 0; a <= 1; ++a) { >> branch  0 taken 2 >> branch  1 taken 1 (fallthrough) >> conditions covered

[PATCH] c-family: Initialize ridpointers for __int128 etc. [PR105186]

2022-04-08 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase ICEs with C++ and is incorrectly rejected with C. The reason is that both FEs use ridpointers identifiers for CPP_KEYWORD and value or u.value for CPP_NAME e.g. when parsing attributes or OpenMP directives etc., like: /* Save away the identifier that indicates w

[PATCH] Add condition coverage profiling

2022-04-08 Thread Jørgen Kvalsvik via Gcc-patches
On 07/04/2022 18:53, Sebastian Huber wrote: > Hello Jørgen, > > there could be an issue with conditions in for loops: > >     3:  189:  for (int a = 0; a <= 1; ++a) { > branch  0 taken 2 > branch  1 taken 1 (fallthrough) > conditions covered 0/2 > condition  0 not covered (true) > condition 

Re: [PATCH] rs6000/test: Adjust p9-vec-length-7 sensitive to unroll [PR103196]

2022-04-08 Thread Kewen.Lin via Gcc-patches
Hi! on 2022/4/8 3:29 AM, Segher Boessenkool wrote: > Hi! > > On Thu, Apr 07, 2022 at 09:19:51AM -0500, will schmidt wrote: >> On Mon, 2022-02-28 at 13:37 +0800, Kewen.Lin via Gcc-patches wrote: >>> As PR103196 shows, p9-vec-length-full-7.c needs to be adjusted as the >>> complete unrolling can ha

[PATCH v2] rs6000: Guard bifs {un,}pack_{longdouble,ibm128} under hard float [PR103623]

2022-04-08 Thread Kewen.Lin via Gcc-patches
Hi, As PR103623 shows, it's a regression failure due to new built-in function framework, previously we guard __builtin_{un,}pack_{longdouble, ibm128} built-in functions under hard float, so they are unavailable with the given configuration. While with new bif infrastructure, it becomes available

Re: [AArch64] PR target/105157 Increase number of cores TARGET_CPU_DEFAULT can encode

2022-04-08 Thread Richard Sandiford via Gcc-patches
"Andre Vieira (lists)" writes: > Hi, > > This addresses the compile-time increase seen in the PR target/105157. > This was being caused by selecting the wrong core tuning, as when we > added the latest AArch64 the TARGET_CPU_generic tuning was pushed beyond > the 0x3f mask we used to encode bot