Re: [PATCH v3] Many pages: Document fixed-width types with ISO C naming

2022-08-24 Thread Greg Kroah-Hartman via Gcc-patches
On Thu, Aug 25, 2022 at 01:36:10AM +0200, Alejandro Colomar wrote: > But from your side what do we have? Just direct NAKs without much > explanation. The only one who gave some explanation was Greg, and he > vaguely pointed to Linus's comments about it in the past, with no precise > pointer to

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Will Hawkins
On Wed, Aug 24, 2022 at 7:03 PM Jonathan Wakely wrote: > > On Wed, 24 Aug 2022 at 23:47, Jonathan Wakely wrote: > > > > On Wed, 24 Aug 2022 at 23:39, Alexandre Oliva wrote: > > > > > > On Aug 24, 2022, Jonathan Wakely via Gcc-patches > > > wrote: > > > > > > >*

[PATCH v4] rs6000: Rework ELFv2 support for -fpatchable-function-entry* [PR99888]

2022-08-24 Thread Kewen.Lin via Gcc-patches
Hi, As PR99888 and its related show, the current support for -fpatchable-function-entry on powerpc ELFv2 doesn't work well with global entry existence. For example, with one command line option -fpatchable-function-entry=3,2, it got below w/o this patch: .LPFE1: nop nop

Re: [PATCH, rs6000] Change insn condition from TARGET_64BIT to TARGET_POWERPC64 for VSX scalar extract/insert instructions

2022-08-24 Thread Kewen.Lin via Gcc-patches
on 2022/8/25 11:37, HAO CHEN GUI wrote: > Hi, > > On 24/8/2022 下午 1:24, Kewen.Lin wrote: >> Could you try to test with dg-options "-mdejagnu-cpu=power9 -mpowerpc64" all >> the time, but still >> having that has_arch_ppc64 effective target on aix? >> >> I'd expect has_arch_ppc64 check to fail on

Re: [PATCH] Don't gimple fold ymm-version vblendvpd/vblendvps/vpblendvb w/o TARGET_AVX2

2022-08-24 Thread Hongtao Liu via Gcc-patches
On Wed, Aug 24, 2022 at 9:15 AM liuhongt wrote: > > Since 256-bit vector integer comparison is under TARGET_AVX2, > and gimple folding for vblendvpd/vblendvps/vpblendvb relies on that. > Restrict gimple fold condition to TARGET_AVX2. > > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. >

Re: [PATCH, rs6000] Change insn condition from TARGET_64BIT to TARGET_POWERPC64 for VSX scalar extract/insert instructions

2022-08-24 Thread HAO CHEN GUI via Gcc-patches
Hi, On 24/8/2022 下午 1:24, Kewen.Lin wrote: > Could you try to test with dg-options "-mdejagnu-cpu=power9 -mpowerpc64" all > the time, but still > having that has_arch_ppc64 effective target on aix? > > I'd expect has_arch_ppc64 check to fail on aix 32bit, the error will not be a > problem

Re: [PATCH v3] Many pages: Document fixed-width types with ISO C naming

2022-08-24 Thread Linus Torvalds
On Wed, Aug 24, 2022 at 4:36 PM Alejandro Colomar wrote: > > I'm trying to be nice, and ask for review to make sure I'm not making > some big mistake by accident, and I get disrespect? No thanks. You've been told multiple times that the kernel doesn't use the "standard" names, and *cannot* use

Re: [PATCH v3] Many pages: Document fixed-width types with ISO C naming

2022-08-24 Thread Alejandro Colomar via Gcc-patches
Alexei, On 8/24/22 20:55, Alejandro Colomar wrote: > Link: > Link: > Signed-off-by: Alejandro Colomar > Nacked-by: Alexei Starovoitov > Nacked-by:

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Jonathan Wakely via Gcc-patches
On Wed, 24 Aug 2022 at 23:47, Jonathan Wakely wrote: > > On Wed, 24 Aug 2022 at 23:39, Alexandre Oliva wrote: > > > > On Aug 24, 2022, Jonathan Wakely via Gcc-patches > > wrote: > > > > >* include/bits/basic_string.h (operator+(const string&, > > > const char*)): > > >

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Jonathan Wakely via Gcc-patches
On Wed, 24 Aug 2022 at 23:39, Alexandre Oliva wrote: > > On Aug 24, 2022, Jonathan Wakely via Gcc-patches > wrote: > > >* include/bits/basic_string.h (operator+(const string&, > > const char*)): > >Remove naive implementation. > >*

Re: [PATCH v3] Many pages: Document fixed-width types with ISO C naming

2022-08-24 Thread Alexei Starovoitov via Gcc-patches
On Wed, Aug 24, 2022 at 12:04 PM Alejandro Colomar wrote: > > diff --git a/man2/bpf.2 b/man2/bpf.2 > index d05b73ec2..84d1b62e5 100644 > --- a/man2/bpf.2 > +++ b/man2/bpf.2 > @@ -169,34 +169,34 @@ commands: > .EX > union bpf_attr { > struct {/* Used by BPF_MAP_CREATE */ > -

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Alexandre Oliva via Gcc-patches
On Aug 24, 2022, Jonathan Wakely via Gcc-patches wrote: >* include/bits/basic_string.h (operator+(const string&, > const char*)): >Remove naive implementation. >* include/bits/basic_string.tcc (operator+(const string&, > const char*)): >Add

Re: [PATCH v4] c++: Implement -Wself-move warning [PR81159]

2022-08-24 Thread Marek Polacek via Gcc-patches
On Tue, Aug 23, 2022 at 05:27:00PM -0400, Jason Merrill wrote: > On 8/23/22 09:39, Marek Polacek wrote: > > + tree arg = CALL_EXPR_ARG (fn, 0); > > + extract_op (arg); > > + if (TREE_CODE (arg) == ADDR_EXPR) > > +arg = TREE_OPERAND (arg, 0); > > + tree type = TREE_TYPE (lhs); > > + lhs =

Re: [PATCH] c++: Implement C++23 P2071R2 - Named universal character escapes [PR106648]

2022-08-24 Thread Jason Merrill via Gcc-patches
On 8/21/22 14:18, Jakub Jelinek wrote: Hi! The following patch implements the C++23 P2071R2 - Named universal character escapes paper to support \N{LATIN SMALL LETTER E} etc. I've used Unicode 14.0, there are 144803 character name properties (including the ones generated by Unicode NR1 and NR2

[PATCH] libstdc++: Optimize std::con/disjunction, __and_/__or_, etc

2022-08-24 Thread Patrick Palka via Gcc-patches
The internal type-level logical operations __and_ and __or_ are currently quite slow to compile for a couple of reasons: 1. They are drop-in replacements for std::con/disjunction, which are rigidly specified to form a type that derives from the first type argument that caused the

Re: [PATCH 0/3] picolibc: Add picolibc linking help

2022-08-24 Thread Keith Packard via Gcc-patches
Andrew Pinski writes: (removing gcc@ as not appropriate for patch discussions) Thanks for reviewing my patches; I appreciate the time you have taken to think about this. > Why do you need to change the specs to support picolibc? Why not have > the library supply the specs file instead, like

[PATCH v3] Many pages: Document fixed-width types with ISO C naming

2022-08-24 Thread Alejandro Colomar via Gcc-patches
Kernel __u64 and similar types are ABI-compatible, and mostly API-compatible with ISO C types. User-space programmers don't care about kernel details, and should only use libc types. Document syscalls and structures provided by the Linux kernel as if they used libc types. There's work in the

Re: [Patch] Fortran/OpenMP: Fix strictly structured blocks parsing

2022-08-24 Thread Harald Anlauf via Gcc-patches
Hi Tobias, Am 24.08.22 um 19:47 schrieb Tobias Burnus: This patch is about error diagnostic + an ICE for invalid code. [...] (So far, so good, but then the parsing-code did run into a bug.) For the blocks, the following applies. OpenMP permits either * strictly structured blocks (with

Re: [PATCH] IBM zSystems: Fix function_ok_for_sibcall [PR106355]

2022-08-24 Thread Stefan Schulze Frielinghaus via Gcc-patches
On Wed, Aug 17, 2022 at 01:50:45PM +0200, Stefan Schulze Frielinghaus wrote: > For a parameter with BLKmode we cannot use REG_NREGS in order to > determine the number of consecutive registers. Streamlined this with > the implementation of s390_function_arg. > > Fix some indentation whitespace,

Re: [PATCH] libstdc++: Fix fallout from P2321R2 pair/tuple enhancements

2022-08-24 Thread Jonathan Wakely via Gcc-patches
On Wed, 24 Aug 2022 at 18:00, Patrick Palka via Libstdc++ wrote: > > On Wed, 24 Aug 2022, Patrick Palka wrote: > > > r13-2159-g72886fcc626953 introduced some testsuite regressions in C++23 > > mode: > > > > FAIL: 20_util/pair/requirements/explicit_instantiation/1.cc (test for > > excess

Re: [PATCH] c: Implement C23 nullptr (N3042)

2022-08-24 Thread Marek Polacek via Gcc-patches
On Mon, Aug 15, 2022 at 04:03:13PM -0400, Jason Merrill wrote: > On 8/13/22 14:35, Marek Polacek wrote: > > This patch implements the C23 nullptr literal: > > , which is > > intended to replace the problematic definition of NULL which

Re: [PATCH 0/3] picolibc: Add picolibc linking help

2022-08-24 Thread Andrew Pinski via Gcc-patches
On Wed, Aug 24, 2022 at 11:12 AM Keith Packard via Gcc-patches wrote: > > Picolibc is a C library for embedded systems based on code from newlib > and avr libc. To connect some system-dependent picolibc functions > (like stdio) to an underlying platform, the platform may provide an OS > library.

[PATCH v2] c: Implement C23 nullptr (N3042)

2022-08-24 Thread Marek Polacek via Gcc-patches
On Mon, Aug 15, 2022 at 05:48:34PM +, Joseph Myers wrote: > On Sat, 13 Aug 2022, Marek Polacek via Gcc-patches wrote: > > > This patch also defines nullptr_t in . I'm uncertain about > > the __STDC_VERSION__ version I should be checking. Also, I'm not > > We're using defined

[PATCH 0/3] picolibc: Add picolibc linking help

2022-08-24 Thread Keith Packard via Gcc-patches
Picolibc is a C library for embedded systems based on code from newlib and avr libc. To connect some system-dependent picolibc functions (like stdio) to an underlying platform, the platform may provide an OS library. This OS library must follow the C library in the link command line. In current

[PATCH 3/3] picolibc: Add '--oslib=' option when default C library is picolibc

2022-08-24 Thread Keith Packard via Gcc-patches
This option allows targets to insert an OS library after the C library in the LIB_PATH spec file fragment. This library maps a few POSIX APIs used by picolibc to underlying system capabilities. For example, picolibc provides 'libsemihost' on various targets which maps these APIs to semihosting

[PATCH 1/3] picolibc: Allow default libc to be specified to configure

2022-08-24 Thread Keith Packard via Gcc-patches
The default C library is normally computed based on the target triplet. However, for embedded systems, it can be useful to leave the triplet alone while changing which C library is used by default. Other C libraries may still be available on the system so the compiler and can be used by specifying

[PATCH 2/3] picolibc: Add newlib and picolibc as default C library choices

2022-08-24 Thread Keith Packard via Gcc-patches
Signed-off-by: Keith Packard --- gcc/config.gcc | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index f8b6da4f4e7..0aa4bd6c3dd 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -639,7 +639,7 @@ case ${target} in esac # Common C

Re: [PATCH] Fortran: improve error recovery while simplifying size of bad array [PR103694]

2022-08-24 Thread Tobias Burnus
Dear Harald, On 23.08.22 22:29, Harald Anlauf via Fortran wrote: the simplification of the size of an array with a bad decl should not be successful. Improve the error recovery for such a situation. [...] Regtested on x86_64-pc-linux-gnu. The PR is marked as a 12/13 regression. Will

[Patch] Fortran/OpenMP: Fix strictly structured blocks parsing

2022-08-24 Thread Tobias Burnus
This patch is about error diagnostic + an ICE for invalid code. Before the patch, gfortran/f951 showed: ... Error: 'ancestor' device modifier not preceded by 'requires' directive with 'reverse_offload' clause 18 | end block | 1 Error: Expecting END PROGRAM statement at (1) gfortran:

Re: [PATCH] libstdc++: Fix fallout from P2321R2 pair/tuple enhancements

2022-08-24 Thread Patrick Palka via Gcc-patches
On Wed, 24 Aug 2022, Patrick Palka wrote: > r13-2159-g72886fcc626953 introduced some testsuite regressions in C++23 > mode: > > FAIL: 20_util/pair/requirements/explicit_instantiation/1.cc (test for > excess errors) > FAIL: 20_util/tuple/53648.cc (test for excess errors) > FAIL:

[PATCH] libstdc++: Fix fallout from P2321R2 pair/tuple enhancements

2022-08-24 Thread Patrick Palka via Gcc-patches
r13-2159-g72886fcc626953 introduced some testsuite regressions in C++23 mode: FAIL: 20_util/pair/requirements/explicit_instantiation/1.cc (test for excess errors) FAIL: 20_util/tuple/53648.cc (test for excess errors) FAIL: 20_util/tuple/cons/noexcept_specs.cc (test for excess errors)

[PATCH][RFC] Uninit diagnostic consistency

2022-08-24 Thread Richard Biener via Gcc-patches
I've figured that while the uninit diagnostic is intended to diagnose all cases where we cannot prove the must-uninit paths are not reaching any use the actual implementation errors on the wrong side in two places. First the recently added use_cannot_happen computes the must-uninit predicate

[committed] libstdc++: Fix regression in std::stable_sort

2022-08-24 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. No backport needed as the regression is only on trunk. -- >8 -- The recent change to split out the cold path of std::stable_sort caused a regression for some Qt code. The problem is that the library now adds a value of type ptrdiff_t to the iterator,

Re: [PATCH Rust front-end v2 01/37] Use DW_ATE_UTF for the Rust 'char' type

2022-08-24 Thread Jason Merrill via Gcc-patches
On 8/24/22 04:59, herron.phi...@googlemail.com wrote: From: Tom Tromey The Rust 'char' type should use the DWARF DW_ATE_UTF encoding. The DWARF changes are OK. --- gcc/dwarf2out.cc | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Jonathan Wakely via Gcc-patches
On Wed, 24 Aug 2022 at 07:17, Will Hawkins wrote: > > Until now operator+(char*, string) and operator+(string, char*) had > different performance characteristics. The former required a single > memory allocation and the latter required two. This patch makes the > performance equal. > >

[PATCH v2 2/2 resend] LoongArch: add model attribute

2022-08-24 Thread Xi Ruoyao via Gcc-patches
On Wed, 2022-08-24 at 22:08 +0800, Xi Ruoyao wrote: > v1 -> v2: > >  * Avoid introduce of SYMBOL_PCREL32, use SYMBOL_PCREL for 32-bit PC >    relative. >  * Rebase onto a bug fix ([1/2] in the series) to avoid merge conflict. >  * Fix missed ChangeLog entries. Resend because my mail client has

[PATCH] LoongArch: testsuite: refine __tls_get_addr tests with tls_native

2022-08-24 Thread Xi Ruoyao via Gcc-patches
If GCC is not built with a working linker for the target (developers occansionally build such a "minimal" GCC for testing and debugging), TLS will be emulated and __tls_get_addr won't be used. Refine those tests depending on __tls_get_addr with tls_native to avoid test failures.

[PATCH v2 2/2] LoongArch: add model attribute

2022-08-24 Thread Xi Ruoyao via Gcc-patches
v1 -> v2: * Avoid introduce of SYMBOL_PCREL32, use SYMBOL_PCREL for 32-bit PC relative. * Rebase onto a bug fix ([1/2] in the series) to avoid merge conflict. * Fix missed ChangeLog entries. -- >8 -- A linker script and/or a section attribute may locate some object specially, so we need

Re: [PATCH V4] rs6000: Optimize cmp on rotated 16bits constant

2022-08-24 Thread Segher Boessenkool
On Wed, Aug 24, 2022 at 03:48:49PM +0800, Jiufu Guo wrote: > Segher Boessenkool writes: > >> + "TARGET_POWERPC64 && !reload_completed && can_create_pseudo_p () > > > > reload_completed in splitters is almost always wrong. It isn't any > > better if it is in the insn condition of a

[PATCH 1/2] LoongArch: Avoid RTL flag check failure in loongarch_classify_symbol

2022-08-24 Thread Xi Ruoyao via Gcc-patches
SYMBOL_REF_TLS_MODEL invokes SYMBOL_REF_FLAGS, and SYMBOL_REF_FLAGS invokes RTL_FLAG_CHECK1 and aborts when RTL code is not SYMBOL_REF. r13-1833 removed "gcc_assert (SYMBOL_REF_P (x))" before invoking "SYMBOL_REF_TLS_MODEL (x)", indicating that it's now possible that "x" is not a SYMBOL_REF. So

Re: [PATCH v3] rs6000: Rework ELFv2 support for -fpatchable-function-entry* [PR99888]

2022-08-24 Thread Segher Boessenkool
On Wed, Aug 24, 2022 at 03:30:51PM +0800, Kewen.Lin wrote: > on 2022/8/23 22:33, Segher Boessenkool wrote: > I thought if we can consider [1] and updated the documentation similarly > like "For PowerPC with the ELFv2 ABI, there will be M nops before the global > entry point, and N-M after the

Re: Rust frontend patches v1

2022-08-24 Thread Martin Liška
On 8/24/22 15:51, Philip Herron wrote: > Hi Martin, > > Not right now, it is on the to-do list, but do we have to do it in texinfo? Well, I still hope we will move to Sphinx (and remove Texinfo) after the Cauldron. Anyway, using Sphinx is even now possible as a default documentation formal

Re: Rust frontend patches v1

2022-08-24 Thread Philip Herron
Hi Martin, Not right now, it is on the to-do list, but do we have to do it in texinfo? Thanks --Phil On Wed, 24 Aug 2022 at 14:49, Martin Liška wrote: > > On 8/15/22 16:33, Martin Liška wrote: > > On 8/15/22 16:07, Manuel López-Ibáñez via Gcc-patches wrote: > >> Dear Philip, > >> > >> Another

Re: Rust frontend patches v1

2022-08-24 Thread Martin Liška
On 8/15/22 16:33, Martin Liška wrote: > On 8/15/22 16:07, Manuel López-Ibáñez via Gcc-patches wrote: >> Dear Philip, >> >> Another thing to pay attention to is the move to Sphinx for documentation: >> https://gcc.gnu.org/pipermail/gcc/2022-August/239233.html > > Hi. > > Which is something I can

[COMMITTED] bpf: facilitate constant propagation of function addresses

2022-08-24 Thread Jose E. Marchesi via Gcc-patches
eBPF effectively supports two kind of call instructions: - The so called pseudo-calls ("bpf to bpf"). - External calls ("bpf to kernel"). The BPF call instruction always gets an immediate argument, whose interpretation varies depending on the purpose of the instruction: - For pseudo-calls,

[committed] libstdc++: Add check for LWG 3741 problem case

2022-08-24 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. -- >8 -- This LWG issue was closed as NAD, as it was just a bug in an implementation, not a defect in the standard. Libstdc++ never had that bug and always worked for the problem case. Add a test to ensure we don't regress. The problem occurs when abs

Re: [PATCH 3/3] libstdc++: Implement ranges::zip_view from P2321R2

2022-08-24 Thread Jonathan Wakely via Gcc-patches
On Tue, 23 Aug 2022 at 02:38, Patrick Palka via Libstdc++ wrote: > > Tested on 86_64-pc-linux-gnu, does this look OK for trunk? As discussed privately, please remove the #include (which is not needed, and adds declarations to the global namespace that we don't need). OK with that change,

[PATCH Rust front-end v2 37/37] gccrs: Add README, CONTRIBUTING and compiler logo

2022-08-24 Thread herron . philip
From: Philip Herron We still need to write out documentation section but these README's will help in the mean time. --- gcc/rust/CONTRIBUTING.md | 130 +++ gcc/rust/README.md | 264 +++ gcc/rust/logo.png| Bin 0 -> 70864 bytes 3

[PATCH Rust front-end v2 28/37] gccrs: Add metadata ouptput pass

2022-08-24 Thread herron . philip
From: Philip Herron Extern crates statements to tell the front-end to look for another library. The mechanism here is heavily inspired from gccgo, so when we compile a library for example we invoke: gccrs -g -O2 -frust-crate=mylib -c src/lib.rs -o src/mylib.o All going well this object file

[PATCH Rust front-end v2 35/37] gccrs: add compiler driver

2022-08-24 Thread herron . philip
From: Philip Herron Our compiler driver is pretty simple so far, the key piece to enforce is that a compilation unit in Rust is the whole crate so the process for compiling rust means pointing the compiler at the main entry point such as src/lib.rs or src/main.rs where the expansion pass takes

[PATCH Rust front-end v2 31/37] gccrs: Add GCC Rust front-end Make-lang.in

2022-08-24 Thread herron . philip
From: Philip Herron This is the Makefile for our front-end. --- gcc/rust/Make-lang.in | 400 ++ 1 file changed, 400 insertions(+) create mode 100644 gcc/rust/Make-lang.in diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in new file mode 100644

[PATCH Rust front-end v2 30/37] gccrs: These are wrappers ported from reusing gccgo

2022-08-24 Thread herron . philip
From: Philip Herron The wrappers over linemap and location will eventually disappear here but served as a useful starting point for us. We have wrappers over the diagnostics system which we might be able to get rid of as well. --- gcc/rust/rust-diagnostics.cc | 244

[PATCH Rust front-end v2 33/37] gccrs: add lang-spec.h

2022-08-24 Thread herron . philip
From: Philip Herron This specifies the extensions of the Rust language. --- gcc/rust/lang-specs.h | 26 ++ 1 file changed, 26 insertions(+) create mode 100644 gcc/rust/lang-specs.h diff --git a/gcc/rust/lang-specs.h b/gcc/rust/lang-specs.h new file mode 100644 index

[PATCH Rust front-end v2 32/37] gccrs: Add config-lang.in

2022-08-24 Thread herron . philip
From: Philip Herron This was a copy paste from gccgo front-end, we do not use any of the target_libs yet but we will need these when we support the libpanic crate. --- gcc/rust/config-lang.in | 34 ++ 1 file changed, 34 insertions(+) create mode 100644

[PATCH Rust front-end v2 24/37] gccrs: Add const checker

2022-08-24 Thread herron . philip
From: Arthur Cohen Similarly to the unsafe checker, constant evaluation can only be performed in a few contexts and include restrictions on the Rust language. Should the user fail to uphold those conditions, errors will be reported and the compilation pipeline interrupted. These contexts are as

[PATCH Rust front-end v2 26/37] gccrs: Add dead code scan on HIR

2022-08-24 Thread herron . philip
From: Thomas Young In order to find dead code we use a depth first search and keep liveness variables, after type resolution. In this case, if a function is unused and it calls another function the 2nd function is now unused since the caller is not used etc. The algorithm is a depth first

[PATCH Rust front-end v2 27/37] gccrs: Add unused variable scan

2022-08-24 Thread herron . philip
From: Philip Herron This is a simple walk_tree which acts on the monomorphized code. By walking the compiled translation unit of functions. --- gcc/rust/checks/lints/rust-lint-unused-var.cc | 98 +++ gcc/rust/checks/lints/rust-lint-unused-var.h | 36 +++ 2 files changed,

[PATCH Rust front-end v2 21/37] gccrs: Add helpers mappings canonical path and lang items

2022-08-24 Thread herron . philip
From: Philip Herron These are various helper classes used in the compiler pipeline. --- gcc/rust/util/rust-canonical-path.h | 195 + gcc/rust/util/rust-common.h | 53 ++ gcc/rust/util/rust-hir-map.cc | 980 ++ gcc/rust/util/rust-hir-map.h

[PATCH Rust front-end v2 23/37] gccrs: Add unsafe checks for Rust

2022-08-24 Thread herron . philip
From: Arthur Cohen The UnsafeChecker visitor verifies that unsafe actions are only performed in unsafe contexts. Otherwise, an error should be reported to the user and the compilation pipeline should be halted. These contexts, which include unsafe blocks or unsafe functions, are allowed to

[PATCH Rust front-end v2 36/37] gccrs: compiler proper interface kicks off the pipeline

2022-08-24 Thread herron . philip
From: Philip Herron This is a wrapper to get out of C land in the rust-lang.cc and into our class hierarchy for the rust front-end. We expect that the front-end only support one source file input as the expansion pass will attempt to resolve that relative pass and parse accordingly. The main

[PATCH Rust front-end v2 17/37] gccrs: Add Rust ABI enum helpers

2022-08-24 Thread herron . philip
From: Philip Herron This is a simple helper over an enum of possible ABI options in Rust. --- gcc/rust/util/rust-abi.cc | 72 +++ gcc/rust/util/rust-abi.h | 45 2 files changed, 117 insertions(+) create mode 100644

[PATCH Rust front-end v2 15/37] gccrs: Add wrapper for make_unique

2022-08-24 Thread herron . philip
From: Philip Herron This is a wrapper for make_unique we can likely get rid of this as there are other implementations available or simply keep using the unique_ptr constructor. --- gcc/rust/util/rust-make-unique.h | 35 1 file changed, 35 insertions(+) create

[PATCH Rust front-end v2 34/37] gccrs: add lang.opt

2022-08-24 Thread herron . philip
From: Philip Herron We have some rust specific langugage options note -fwrapv is enabled by default in the code. We are trying to respect options such as -Wunused-result which we get by porting over c++ no-discard for rust's must-use attribute, so we have enabled these by default directly here.

[PATCH Rust front-end v2 20/37] gccrs: Add attributes checker

2022-08-24 Thread herron . philip
From: Arthur Cohen The attribute checker is responsible for checking the validity of various attributes including built-in ones. It is currently unfinished and will receive some modifications, as well as become the host of some existing code in the compiler which needs to be refactored. One of

[PATCH Rust front-end v2 19/37] gccrs: Add implementation of Optional

2022-08-24 Thread herron . philip
From: Arthur Cohen Add an Optional class to improve error handling --- gcc/rust/util/rust-optional-test.cc | 111 +++ gcc/rust/util/rust-optional.h | 278 2 files changed, 389 insertions(+) create mode 100644 gcc/rust/util/rust-optional-test.cc

[PATCH Rust front-end v2 18/37] gccrs: Add Base62 implementation

2022-08-24 Thread herron . philip
From: Arthur Cohen Used for V0 symbol mangling scheme which. --- gcc/rust/util/rust-base62.cc | 46 gcc/rust/util/rust-base62.h | 34 ++ 2 files changed, 80 insertions(+) create mode 100644 gcc/rust/util/rust-base62.cc create mode

[PATCH Rust front-end v2 25/37] gccrs: Add privacy checks

2022-08-24 Thread herron . philip
From: Arthur Cohen This pass is responsible for resolving the privacy of items and verifying that access to these items is performed within the limits of that privacy. By default, items in Rust are private and only public to the current module and its submodules. However, the user can annotate

[PATCH Rust front-end v2 16/37] gccrs: Add port of FNV hash used during legacy symbol mangling

2022-08-24 Thread herron . philip
From: Philip Herron This hash was ported from the go runime as we needed a hash for the legacy symbol mangling system. Which means all symbols in Rust contain a hash of some metadata for uniqueness on generic functions. --- gcc/rust/util/fnv-hash.h | 95

[PATCH Rust front-end v2 07/37] gccrs: Add gcc-check-target check-rust

2022-08-24 Thread herron . philip
From: Philip Herron This allows us to invoke the rust testsuite. ChangeLog: * Makefile.def: Add autogen target * Makefile.in: regenerate via autogen --- Makefile.def | 1 + Makefile.in | 8 2 files changed, 9 insertions(+) diff --git a/Makefile.def b/Makefile.def

[PATCH Rust front-end v2 04/37] gccrs: Add link cases testsuite

2022-08-24 Thread herron . philip
From: Philip Herron This testsuite is heavily inspired from the lto testsuite which uses a pattern that each file is compiled to an object file and finally linked together. Since rust does not have headers/prototypes we rely on the ordering here so that all files numbered greater than zero get

[PATCH Rust front-end v2 06/37] gccrs: Add execution test cases

2022-08-24 Thread herron . philip
From: Philip Herron This is similar to the compile/torture/*.rs test cases but all of these are dg-execute testcases so they get compiled, linked and executed by default, all the while being compiled with the matrix of torture options. The only caveat here is that currently gccrs does not

[PATCH Rust front-end v2 03/37] gccrs: Add Debug info testsuite

2022-08-24 Thread herron . philip
From: Philip Herron This testsuite is specifically about testcases which scan the asm debug info for results. Co-authored-by: Tom Tromey --- gcc/testsuite/rust/debug/chartype.rs | 10 ++ .../rust/debug/custom_link_section.rs | 13

[PATCH Rust front-end v2 09/37] gccrs: Add Lexer for Rust front-end

2022-08-24 Thread herron . philip
From: The Other The lexer is refered to as a ManagedTokenSource within the parser, this lexer does not currently support unicode but serves as a starting point to do so. Co-authored-by: Philip Herron Co-authored-by: Arthur Cohen Co-authored-by: Mark Wielaard ---

[PATCH Rust front-end v2 02/37] gccrs: Add nessecary hooks for a Rust front-end testsuite

2022-08-24 Thread herron . philip
From: Philip Herron This copy's over code from other front-end testsuites to enable testing for the rust front-end specifically. Co-authored-by: Marc Poulhiès Co-authored-by: Thomas Schwinge --- gcc/testsuite/lib/rust-dg.exp | 49 + gcc/testsuite/lib/rust.exp| 186

Rust frontend patches v2

2022-08-24 Thread herron . philip
This is the 2nd patch set for gccrs, since v1 we have dropped the changes for target hooks which are not nessecary for us right now. This now focuses directly on the front-end the only patch that affects GCC now is a tweak to debug info. Note we are close to merging our port of the C++ constexpr

[PATCH Rust front-end v2 01/37] Use DW_ATE_UTF for the Rust 'char' type

2022-08-24 Thread herron . philip
From: Tom Tromey The Rust 'char' type should use the DWARF DW_ATE_UTF encoding. --- gcc/dwarf2out.cc | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index e3920c898f5..a8bccbabca4 100644 --- a/gcc/dwarf2out.cc +++

Re: [PATCH] i386: avoid zero extension for crc32q

2022-08-24 Thread Alexander Monakov via Gcc-patches
On Tue, 23 Aug 2022, Alexander Monakov via Gcc-patches wrote: > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/pr106453.c > @@ -0,0 +1,13 @@ > +/* { dg-do compile } */ > +/* { dg-options "-msse4.2 -O2 -fdump-rtl-final" } */ > +/* { dg-final { scan-rtl-dump-not "zero_extendsidi" "final" } }

[PATCH V5] rs6000: Optimize cmp on rotated 16bits constant

2022-08-24 Thread Jiufu Guo via Gcc-patches
Hi, When checking eq/ne with a constant which has only 16bits, it can be optimized to check the rotated data. By this, the constant building is optimized. As the example in PR103743: For "in == 0x8000LL", this patch generates: rotldi %r3,%r3,16 cmpldi %cr0,%r3,32768

[PATCH 2/2] Move things around in predicate analysis

2022-08-24 Thread Richard Biener via Gcc-patches
This moves a few functions, notably normalization after a big comment documenting it. I've left the rest unorganized for now. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * gimple-predicate-analysis.cc: Move predicate normalization after the comment documenting

[PATCH 1/2] Split uninit analysis from predicate analysis

2022-08-24 Thread Richard Biener via Gcc-patches
This splits the API collected in gimple-predicate-analysis.h into what I'd call a predicate and assorted functionality plus utility used by the uninit pass that happens to use that. I've tried to be minimalistic with refactoring, there's still recursive instantiation of uninit_analysis, the new

Re: [PATCH] internal-fn, tree-cfg: Fix .TRAP handling and another __builtin_trap vops issue [PR106099]

2022-08-24 Thread Richard Biener via Gcc-patches
On Wed, 24 Aug 2022, Jakub Jelinek wrote: > Hi! > > This patch fixes 2 __builtin_unreachable/__builtin_trap related issues. > One (first hunk) is that CDDCE happily removes calls to .TRAP () > internal-fn as useless. The problem is that the internal-fn is > ECF_CONST | ECF_NORETURN, doesn't

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Jonathan Wakely via Gcc-patches
On Wed, 24 Aug 2022 at 07:18, Will Hawkins wrote: > > On Tue, Aug 23, 2022 at 12:33 PM Jonathan Wakely wrote: > > > > On Mon, 22 Aug 2022 at 19:15, Will Hawkins wrote: > > > > > > Until now operator+(char*, string) and operator+(string, char*) had > > > different performance characteristics. The

[PATCH] Some more predicate analysis TLC

2022-08-24 Thread Richard Biener via Gcc-patches
This limits the simple control dep also to the cd_root plus avoids filling the lazily computed PHI def predicate in the early out path which would leave it not simplified and normalized if it were re-used. It also avoids computing the use predicates when the post-dominance early out doesn't need

[PATCH] internal-fn, tree-cfg: Fix .TRAP handling and another __builtin_trap vops issue [PR106099]

2022-08-24 Thread Jakub Jelinek via Gcc-patches
Hi! This patch fixes 2 __builtin_unreachable/__builtin_trap related issues. One (first hunk) is that CDDCE happily removes calls to .TRAP () internal-fn as useless. The problem is that the internal-fn is ECF_CONST | ECF_NORETURN, doesn't have lhs and so DCE thinks it doesn't have side-effects

[PATCH] rs6000/test: Adjust pr104992.c with vect_int_mod [PR106516]

2022-08-24 Thread Kewen.Lin via Gcc-patches
Hi, As PR106516 shows, we can get unexpected gimple outputs for function thud on some target which supports modulus operation for vector int. This patch introduces one effective target vect_int_mod for it, then adjusts the test case with it. Tested on x86_64-redhat-linux and

[PATCH] Adjust the symbol for SECTION_LINK_ORDER linked_to section [PR99889]

2022-08-24 Thread Kewen.Lin via Gcc-patches
Hi, As discussed in PR98125, -fpatchable-function-entry with SECTION_LINK_ORDER support doesn't work well on powerpc64 ELFv1 because the filled "Symbol" in .section name,"flags"o,@type,Symbol sits in .opd section instead of in the function_section like .text or named .text*. Since we already

[PATCH] rs6000: using li/lis+oris/xoris to build constants

2022-08-24 Thread Jiufu Guo via Gcc-patches
Hi, PR106708 constaint some constants which can be support by li/lis + oris/xoris. For constant C: if ((c & 0x80008000ULL) == 0x8000ULL) or say: 32(0)+1(1)+15(x)+1(0)+15(x), we could use li+oris to build constant 'C'. if ((c & 0x8000ULL) == 0x8000ULL) or say:

Re: [PATCH] sched1: Fix -fcompare-debug issue in schedule_region [PR105586]

2022-08-24 Thread Surya Kumari Jangala via Gcc-patches
Hi Peter, Segher, Thanks for going thru the patch! I will make the proposed changes to the Changelog. Regards, Surya On 23/08/22 6:58 pm, Segher Boessenkool wrote: > Hi! > > On Tue, Aug 23, 2022 at 07:55:22AM -0500, Peter Bergner wrote: >> It looks good to me, but I cannot approve it. > >

[committed] i386: Fix up mode iterators that weren't expanded [PR106721]

2022-08-24 Thread Jakub Jelinek via Gcc-patches
Hi! Currently, when md file reader sees and something is valid mode (or code) attribute but which doesn't include case for the current mode (or code), it just keeps the untouched. I went through all cases matching <[a-zA-Z] in tmp-mddump.md after make mddump. Most of the cases were related to

Re: [PATCH V4] rs6000: Optimize cmp on rotated 16bits constant

2022-08-24 Thread Jiufu Guo via Gcc-patches
Hi! Segher Boessenkool writes: > Hi! > > On Mon, Jul 25, 2022 at 09:29:22PM +0800, Jiufu Guo wrote: >> When checking eq/neq with a constant which has only 16bits, it can be >> optimized to check the rotated data. By this, the constant building >> is optimized. > > "ne", not "neq". Oh, thanks!

[PATCH] LoongArch: Fix pr106459 by use HWIT instead of 1UL.

2022-08-24 Thread xuchenghua
From: Chenghua Xu gcc/ChangeLog: PR target/106459 * config/loongarch/loongarch.cc (loongarch_build_integer): Use HOST_WIDE_INT. * config/loongarch/loongarch.h (IMM_REACH): Likewise. (HWIT_1U): New Defined. (LU12I_OPERAND): Use HOST_WIDE_INT.

Re: [PATCH] gcov: fix file and function summary information

2022-08-24 Thread Martin Liška
On 8/24/22 09:12, Jørgen Kvalsvik wrote: > I tested it and get the file summary as expected: > > File 'demo.cc' > Lines executed:84.62% of 26 > Branches executed:100.00% of 6 > Taken at least once:50.00% of 6 > Calls executed:100.00% of 4 > Creating 'demo.cc.gcov' > > Thanks, > Jørgen Great,

Re: [PATCH v3] rs6000: Rework ELFv2 support for -fpatchable-function-entry* [PR99888]

2022-08-24 Thread Kewen.Lin via Gcc-patches
Hi Segher, on 2022/8/23 22:33, Segher Boessenkool wrote: > On Fri, Aug 19, 2022 at 10:40:10AM +0800, Kewen.Lin wrote: >> Since you proposed to update the documentation, I'm thinking if we can >> reconsider Fangrui's proposal in the PR which Alan seconded: Put preceding >> nops before GEP and

Re: [PATCH] gcov: fix file and function summary information

2022-08-24 Thread Jørgen Kvalsvik
On 22/08/2022 21:25, Martin Liška wrote: Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Jorgen: Can you please test it before I'll install it? Thanks, Martin gcc/ChangeLog: * gcov.cc (add_line_counts): Add group functions to coverage summary.

Re: [commited PATCH v1] LoongArch: Add new code model 'medium'.

2022-08-24 Thread Lulu Cheng
Pushed to r13-2165. 在 2022/8/20 下午5:18, Huacai Chen 写道: Hi, Lulu, I think there is a typo in your subject line. Huacai On Sat, Aug 20, 2022 at 5:05 PM Lulu Cheng wrote: The function jump instruction in normal mode is 'bl', so the scope of the function jump is +-128MB. Now we've added

Re: LoongArch: add model attribute

2022-08-24 Thread Lulu Cheng
在 2022/8/23 下午10:51, Xi Ruoyao 写道: diff --git a/gcc/config/loongarch/loongarch-protos.h b/gcc/config/loongarch/loongarch-protos.h index cadaad7519c..4e925aa3876 100644 --- a/gcc/config/loongarch/loongarch-protos.h +++ b/gcc/config/loongarch/loongarch-protos.h @@ -30,6 +30,12 @@ along with

Re: [PATCH] Speedup path discovery in predicate::use_cannot_happen

2022-08-24 Thread Richard Biener via Gcc-patches
On Tue, 23 Aug 2022, Aldy Hernandez wrote: > On Tue, Aug 23, 2022 at 2:16 PM Richard Biener wrote: > > > > The following reverts a hunk from r8-5789-g11ef0b22d68cd1 that > > made compute_control_dep_chain start from function entry rather > > than the immediate dominator of the source block of

Re: [PATCH, rs6000] Change insn condition from TARGET_64BIT to TARGET_POWERPC64 for VSX scalar extract/insert instructions

2022-08-24 Thread HAO CHEN GUI via Gcc-patches
Hi Kewen, On 24/8/2022 下午 1:24, Kewen.Lin wrote: > Could you try to test with dg-options "-mdejagnu-cpu=power9 -mpowerpc64" all > the time, but still > having that has_arch_ppc64 effective target on aix? > > I'd expect has_arch_ppc64 check to fail on aix 32bit, the error will not be a >

Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread Will Hawkins
On Tue, Aug 23, 2022 at 12:33 PM Jonathan Wakely wrote: > > On Mon, 22 Aug 2022 at 19:15, Will Hawkins wrote: > > > > Until now operator+(char*, string) and operator+(string, char*) had > > different performance characteristics. The former required a single > > memory allocation and the latter

[PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally

2022-08-24 Thread whh8b
From: Will Hawkins Until now operator+(char*, string) and operator+(string, char*) had different performance characteristics. The former required a single memory allocation and the latter required two. This patch makes the performance equal. libstdc++-v3/ChangeLog: *

  1   2   >