Re: [PATCH] LoongArch: Reimplement multilib build option handling.

2023-10-06 Thread Yang Yujie
On Wed, Oct 04, 2023 at 02:13:46PM +0200, Jan-Benedict Glaw wrote: > Seems this breaks for me with > > ../gcc/configure [...] --enable-werror-always --enable-languages=all > --disable-gcov --disable-shared --disable-threads > --target=loongarch64-linux-gnuf32 --without-headers > make V=1 all-gcc

[PATCH] LoongArch: Adjust makefile dependency for loongarch headers.

2023-10-07 Thread Yang Yujie
gcc/ChangeLog: * config.gcc: Add loongarch-driver.h to tm_files. * config/loongarch/loongarch.h: Do not include loongarch-driver.h. * config/loongarch/t-loongarch: Append loongarch-multilib.h to $(GTM_H) instead of $(TM_H) for building generator programs. --- gcc/c

Re: [PATCH] LoongArch: Adjust makefile dependency for loongarch headers.

2023-10-07 Thread Yang Yujie
Unfortunately, I was unable to reproduce the problem mentioned in https://gcc.gnu.org/pipermail/gcc-patches/2023-October/631933.html Heres's a possible fix without testing. Please tell me if this works. On Sat, Oct 07, 2023 at 04:50:14PM +0800, Yang Yujie wrote: > -TM_H += loongarch-mu

[PATCH v2] LoongArch: Adjust makefile dependency for loongarch headers.

2023-10-11 Thread Yang Yujie
gcc/ChangeLog: * config.gcc: Add loongarch-driver.h to tm_files. * config/loongarch/loongarch.h: Do not include loongarch-driver.h. * config/loongarch/t-loongarch: Append loongarch-multilib.h to $(GTM_H) instead of $(TM_H) for building generator programs. --- gcc/c

[PATCH v1 5/6] LoongArch: export headers for building GCC plugins

2023-08-13 Thread Yang Yujie
gcc/ChangeLog: * gcc/config/loongarch/t-loongarch: include loongarch-def.h, loongarch-tune.h and loongarch-driver.h in OPTIONS_H_EXTRA. Co-authored-by: Lulu Cheng --- gcc/config/loongarch/t-loongarch | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/conf

[PATCH v1 3/6] LoongArch: define preprocessing macros "__loongarch_{arch, tune}"

2023-08-13 Thread Yang Yujie
These are exported according to the LoongArch Toolchain Conventions[1] as a replacement of the obsolete "_LOONGARCH_{ARCH,TUNE}" macros, which are expanded to strings representing the actual architecture and microarchitecture of the target. [1] currently relased at https://github.com/loongson/Loon

[PATCH v1 2/6] LoongArch: improved target configuration interface

2023-08-13 Thread Yang Yujie
The configure script and the GCC driver are updated so that it is easier to customize and control GCC builds for targeting different LoongArch implementations. * Support options for LoongArch SIMD extensions: new configure options --with-simd={none,lsx,lasx}; new driver options -m[no]-l[a]sx /

[PATCH v1 4/6] LoongArch: use -mstrict-align by default when building libraries

2023-08-13 Thread Yang Yujie
LoongArch processors may not support memory accesses without natural alignments. Building libraries with -mstrict-align may help with toolchain binary compatiblity and performance on these implementations (e.g. Loongson 2K1000LA). With this patch, no significant performance degredation is observe

[PATCH v1 6/6] LoongArch: support loongarch*-elf target

2023-08-13 Thread Yang Yujie
gcc/ChangeLog: * config.gcc: add loongarch*-elf target. * config/loongarch/elf.h: New file. Link against newlib by default. libgcc/ChangeLog: * config.host: add loongarch*-elf target. --- gcc/config.gcc | 21 --- gcc/config/loongarch/elf.h

[PATCH v1 1/6] LoongArch: a symmetric multilib subdir layout

2023-08-13 Thread Yang Yujie
Multilib in gcc is asymmetric. i.e. a "default" / "toplevel" library variant is always built and installed, and: * it is installed directly under the gcc libdir (with no suffix); * it is selected / searched / linked against when the gcc driver does not receive any option from MULTILIB_OPTIONS

[PATCH] LoongArch: initial ada support on linux

2023-08-20 Thread Yang Yujie
gcc/ChangeLog: * ada/Makefile.rtl: Add LoongArch support. * ada/libgnarl/s-linux__loongarch.ads: New. * ada/libgnat/system-linux-loongarch.ads: New. * config/loongarch/loongarch.h: mark normalized options passed from driver to gnat1 as explicit for multilib.

[PATCH] libgccjit: allow common objects in $(EXTRA_GCC_OBJS) and $(EXTRA_OBJS)

2022-04-24 Thread Yang Yujie
iver than ${cpu_arch}-common.o. Regression tested on loongarch64-linux-gnuf64 an x86_64-pc-linux-gnu. Ok for trunk? Yujie >From 5d9121fa052c556fd854596af35da8e5649e8f08 Mon Sep 17 00:00:00 2001 From: Yang Yujie Date: Fri, 22 Apr 2022 14:36:37 +0800 Subject: [PATCH] libgccjit: allow common objects i

[PATCH v2] libgccjit: allow common objects in $(EXTRA_GCC_OBJS) and $(EXTRA_OBJS)

2022-05-19 Thread Yang Yujie
Hello, This patch fixes libgccjit build failure on loongarch* targets, and could probably be useful for future ports. For now, libgccjit is linked with objects from $(EXTRA_GCC_OBJS) and libbackend.a, which contains object files from $(EXTRA_OBJS). This effectively forbids any overlap between th

[PATCH] LoongArch: Use /lib instead of /lib64 as the library search path for MUSL.

2024-03-05 Thread Yang Yujie
gcc/ChangeLog: * config.gcc: Add a case for loongarch*-*-linux-musl*. * config/loongarch/linux.h: Disable the multilib-compatible treatment for *musl* targets. * config/loongarch/musl.h: New file. --- gcc/config.gcc | 3 +++ gcc/config/loongarch/linu

Re: [PATCH v4] LoongArch: Split loongarch_option_override_internal into smaller procedures

2024-03-30 Thread Yang Yujie
v1 -> v2: - Rebased to master. - Specifies "(void)" for the empty parameter list of loongarch_global_init. v2 -> v3: - Keep the original option-processing behavior (-march=la664 enables -mrecip=all) and fix the ICE when -mfrecipe is not passed with -mrecip. v3 -> v4: - Rewrite changelog.

[PATCH v4] LoongArch: Split loongarch_option_override_internal into smaller procedures

2024-03-30 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/genopts/loongarch.opt.in: Mark -m[no-]recip as aliases to -mrecip={all,none}, respectively. * config/loongarch/loongarch.opt: Regenerate. * config/loongarch/loongarch-def.h (ABI_FPU_64): Rename to... (ABI_FPU64_P): ...this.

[PATCH] LoongArch: Fix missing plugin header

2024-04-01 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/t-loongarch: Add loongarch-def-arrays.h to OPTION_H_EXTRA. --- gcc/config/loongarch/t-loongarch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/config/loongarch/t-loongarch b/gcc/config/loongarch/t-loongarch index 3dd7

[PATCH] LoongArch: Enable switchable target

2024-04-07 Thread Yang Yujie
This patch fixes the back-end context switching in cases where functions should be built with their own target contexts instead of the global one, such as LTO linking and functions with target attributes (TBD). PR target/113233 gcc/ChangeLog: * config/loongarch/loongarch.cc (loon

Re: [PATCH] LoongArch: Enable switchable target

2024-04-07 Thread Yang Yujie
On Sun, Apr 07, 2024 at 04:23:53PM +0800, Xi Ruoyao wrote: > On Sun, 2024-04-07 at 15:47 +0800, Yang Yujie wrote: > > This patch fixes the back-end context switching in cases where functions > > should be built with their own target contexts instead of the > > global one, su

Re: [PATCH] LoongArch: Enable switchable target

2024-04-07 Thread Yang Yujie
On Sun, Apr 07, 2024 at 08:56:53PM +0800, Xi Ruoyao wrote: > On Sun, 2024-04-07 at 15:47 +0800, Yang Yujie wrote: > > * config/loongarch/loongarch-builtins.cc > > (loongarch_init_builtins): > >     Initialize all builtin functions at startup. > > git gcc-verif

[PATCH v2] LoongArch: Enable switchable target

2024-04-08 Thread Yang Yujie
This patch fixes the back-end context switching in cases where functions should be built with their own target contexts instead of the global one, such as LTO linking and functions with target attributes (TBD). PR target/113233 gcc/ChangeLog: * config/loongarch/loongarch.cc (loon

Re: [PATCH v2] LoongArch: Enable switchable target

2024-04-08 Thread Yang Yujie
v1 -> v2: Remove spaces from changelog.

Re: [PATCH v2] LoongArch: Enable switchable target

2024-04-08 Thread Yang Yujie
On Mon, Apr 08, 2024 at 04:49:58PM +0800, Xi Ruoyao wrote: > On Mon, 2024-04-08 at 16:46 +0800, Yang Yujie wrote: > > v1 -> v2: > > Remove spaces from changelog. > > I've rebuilt the base system with a GCC including this patch. LTO+PGO > bootstrap fine, regtes

[PATCH v2] LoongArch: Split loongarch_option_override_internal into smaller procedures

2024-02-20 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/genopts/loongarch.opt.in: Mark -m[no-]recip as aliases to -mrecip={all,none}. * config/loongarch/loongarch.opt: Same. * config/loongarch/loongarch-def.h: Modify ABI condition macros for convenience. * config/loongarc

Re: [PATCH v2] LoongArch: Split loongarch_option_override_internal into smaller procedures

2024-02-20 Thread Yang Yujie
v1 -> v2: - Rebased to master. - Specifies "(void)" for the empty parameter list of loongarch_global_init.

[PATCH v3] LoongArch: Split loongarch_option_override_internal into smaller procedures

2024-02-22 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/genopts/loongarch.opt.in: Mark -m[no-]recip as aliases to -mrecip={all,none}. * config/loongarch/loongarch.opt: Same. * config/loongarch/loongarch-def.h: Modify ABI condition macros for convenience. * config/loongarc

Re: [PATCH v3] LoongArch: Split loongarch_option_override_internal into smaller procedures

2024-02-22 Thread Yang Yujie
v1 -> v2: - Rebased to master. - Specifies "(void)" for the empty parameter list of loongarch_global_init. v2 -> v3: - Keep the original option-processing behavior (-march=la664 enables -mrecip=all) and fix the ICE when -mfrecipe is not passed with -mrecip.

[PATCH v2] LoongArch: Implement option save/restore

2024-01-10 Thread Yang Yujie
LTO option streaming and target attributes both require per-function target configuration, which is achieved via option save/restore. We implement TARGET_OPTION_{SAVE,RESTORE} to switch the la_target context in addition to other automatically maintained option states (via the "Save" option propert

Re: [PATCH v2] LoongArch: Implement option save/restore

2024-01-10 Thread Yang Yujie
v1 -> v2: Do not save la_target directly to struct cl_target_options in TARGET_OPTION_SAVE, update to *opts first instead, since it is getting saved later.

[PATCH] LoongArch: Split loongarch_option_override_internal into smaller procedures

2024-01-10 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/genopts/loongarch.opt.in: Mark -m[no-]recip as aliases to -mrecip={all,none}. * config/loongarch/loongarch.opt: Same. * config/loongarch/loongarch-def.h: Modify ABI condition macros for convenience. * config/loongarc

[PATCH v2] LoongArch: Split loongarch_option_override_internal into smaller procedures

2024-01-10 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/genopts/loongarch.opt.in: Mark -m[no-]recip as aliases to -mrecip={all,none}. * config/loongarch/loongarch.opt: Same. * config/loongarch/loongarch-def.h: Modify ABI condition macros for convenience. * config/loongarc

Re: [PATCH] LoongArch: Split loongarch_option_override_internal into smaller procedures

2024-01-10 Thread Yang Yujie
Sorry, this is the wrong patch. The good one is posted as v2, which was bootstrapped and tested on loongarch64-linux-gnu. Yujie

[PATCH] LoongArch: Fix soft-float builds of libffi

2024-01-26 Thread Yang Yujie
This patch correspond to the upstream PR: https://github.com/libffi/libffi/pull/817 libffi/ChangeLog: * src/loongarch64/ffi.c: Avoid defining floats in struct call_context if the ABI is soft-float. --- libffi/src/loongarch64/ffi.c | 2 ++ 1 file changed, 2 insertions(+) diff --g

[PATCH 2/4] LoongArch: Rename ISA_BASE_LA64V100 to ISA_BASE_LA64

2024-01-04 Thread Yang Yujie
LoongArch ISA manual v1.10 suggests that software should not depend on the ISA version number for marking processor features. The ISA version number is now defined as a collective name of individual ISA evolutions. Since there is a independent ISA evolution mask now, we can drop the version inform

[PATCH 1/4] LoongArch: Handle ISA evolution switches along with other options

2024-01-04 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/genopts/genstr.sh: Prepend the isa_evolution variable with the common la_ prefix. * config/loongarch/genopts/loongarch.opt.in: Mark ISA evolution flags as saved using TargetVariable. * config/loongarch/loongarch.opt: Same.

[PATCH 4/4] LoongArch: Simplify -mexplicit-reloc definitions

2024-01-04 Thread Yang Yujie
Since we do not need printing or manual parsing of this option, (whether in the driver or for target attributes to be supported later) it can be handled in the .opt file framework. gcc/ChangeLog: * config/loongarch/genopts/loongarch-strings: Remove explicit-reloc argument string d

[PATCH 0/4] LoongArch: Adjust option handling code (1st patchset)

2024-01-04 Thread Yang Yujie
This patchset performs some code cleanup, and is bootstrapped and regtested on loongarch64-linux-gnu. Yang Yujie (4): LoongArch: Handle ISA evolution switches along with other options LoongArch: Rename ISA_BASE_LA64V100 to ISA_BASE_LA64 LoongArch: Use enums for constants LoongArch

[PATCH 3/4] LoongArch: Use enums for constants

2024-01-04 Thread Yang Yujie
Target features constants from loongarch-def.h are currently defined as macros. Switch to enums for better look in the debugger. gcc/ChangeLog: * config/loongarch/loongarch-def.h: Define constants with enums instead of Macros. --- gcc/config/loongarch/loongarch-def.h | 115 ++

[PATCH] LoongArch: Implement option save/restore

2024-01-05 Thread Yang Yujie
LTO option streaming and target attributes both require per-function target configuration, which is achieved via option save/restore. We implement TARGET_OPTION_{SAVE,RESTORE} to switch the la_target context in addition to other automatically maintained option states (via the "Save" option propert

Re: [PATCH 1/4] LoongArch: Handle ISA evolution switches along with other options

2024-01-05 Thread Yang Yujie
On Fri, Jan 05, 2024 at 08:12:08PM +0800, Xi Ruoyao wrote: > On Fri, 2024-01-05 at 14:55 +0800, Yang Yujie wrote: > > +#define ISA_HAS_FRECIPE \ > > +  (la_target.isa.evolution & OPTION_MASK_ISA_FRECIPE) > > +#define ISA_HAS_DIV32 \ > > +  (la_target.isa.ev

[PATCH v2 3/4] LoongArch: Use enums for constants

2024-01-07 Thread Yang Yujie
Target features constants from loongarch-def.h are currently defined as macros. Switch to enums for better look in the debugger. gcc/ChangeLog: * config/loongarch/loongarch-def.h: Define constants with enums instead of Macros. --- gcc/config/loongarch/loongarch-def.h | 115 ++

[PATCH v2 4/4] LoongArch: Simplify -mexplicit-reloc definitions

2024-01-07 Thread Yang Yujie
Since we do not need printing or manual parsing of this option, (whether in the driver or for target attributes to be supported later) it can be handled in the .opt file framework. gcc/ChangeLog: * config/loongarch/genopts/loongarch-strings: Remove explicit-reloc argument string d

[PATCH v2 1/4] LoongArch: Handle ISA evolution switches along with other options

2024-01-07 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/genopts/genstr.sh: Prepend the isa_evolution variable with the common la_ prefix. * config/loongarch/genopts/loongarch.opt.in: Mark ISA evolution flags as saved using TargetVariable. * config/loongarch/loongarch.opt: Same.

[PATCH v2 2/4] LoongArch: Rename ISA_BASE_LA64V100 to ISA_BASE_LA64

2024-01-07 Thread Yang Yujie
LoongArch ISA manual v1.10 suggests that software should not depend on the ISA version number for marking processor features. The ISA version number is now defined as a collective name of individual ISA evolutions. Since there is a independent ISA evolution mask now, we can drop the version inform

[PATCH v2 0/4] Adjust option handling code

2024-01-07 Thread Yang Yujie
This patchset performs some code cleanup, and is bootstrapped and regtested on loongarch64-linux-gnu. Changes from v1 -> v2: * Replaced all TARGET_ macros from .opt. * Fixed definition of ISA_HAS_LAMCAS. Yang Yujie (4): LoongArch: Handle ISA evolution switches along with other opti

[PATCH v2 1/3] LoongArch: Adjust D version strings.

2023-11-30 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/loongarch-d.cc: Undefine LoongArch32. Define LoongArch_SF, LoongArch_F32, LoongArch_F64 gcc/d/ChangeLog: * dmd/cond.d: Same. * implement-d.texi: Same. --- gcc/config/loongarch/loongarch-d.cc | 27 ++- gcc/

[PATCH v2 3/3] libphobos: LoongArch hardware support.

2023-11-30 Thread Yang Yujie
libphobos/ChangeLog: * src/std/math/hardware.d: Implement FP control. * libdruntime/config/loongarch/switchcontext.S: New file. --- .../config/loongarch/switchcontext.S | 133 ++ libphobos/src/std/math/hardware.d | 53 +++ 2 files changed,

[PATCH v2 0/3] LoongArch D support

2023-11-30 Thread Yang Yujie
631 Yang Yujie (3): LoongArch: Adjust D version strings. libphobos: Update build scripts for LoongArch64. libphobos: LoongArch hardware support. gcc/config/loongarch/loongarch-d.cc | 27 ++-- gcc/d/dmd/cond.d | 6 +- gcc/d/implemen

[PATCH v2 2/3] libphobos: Update build scripts for LoongArch64.

2023-11-30 Thread Yang Yujie
libphobos/ChangeLog: * m4/druntime/cpu.m4: Support loongarch* targets. * libdruntime/Makefile.am: Same. * libdruntime/Makefile.in: Regenerate. * configure: Regenerate. --- libphobos/configure | 21 ++- libphobos/libdruntime/Makefile.am | 3 + lib

Re: [PATCH v2 3/3] libphobos: LoongArch hardware support.

2023-12-01 Thread Yang Yujie
On Fri, Dec 01, 2023 at 04:39:10PM +0800, Xi Ruoyao wrote: > > This part seems > https://github.com/dlang/phobos/commit/870eb5d5d6972b12dd4b69d48ef049abee811b6b. > > Iain: would it be better to just perform a merge from upstream dmd? > > -- > Xi Ruoyao > School of Aerospace Science and Technol

[PATCH v3 0/3] LoongArch D support

2023-12-01 Thread Yang Yujie
631 Yang Yujie (3): LoongArch: Adjust D version strings. libphobos: Update build scripts for LoongArch64. libruntime: Add fiber context switch code for LoongArch. gcc/config/loongarch/loongarch-d.cc | 27 ++-- gcc/d/dmd/cond.d | 6 +- gcc/d/i

[PATCH v3 3/3] libruntime: Add fiber context switch code for LoongArch.

2023-12-01 Thread Yang Yujie
libphobos/ChangeLog: * libdruntime/config/loongarch/switchcontext.S: New file. --- .../config/loongarch/switchcontext.S | 133 ++ 1 file changed, 133 insertions(+) create mode 100644 libphobos/libdruntime/config/loongarch/switchcontext.S diff --git a/libphobos/l

[PATCH v3 1/3] LoongArch: Adjust D version strings.

2023-12-01 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/loongarch-d.cc: Undefine LoongArch32. Define LoongArch_SF, LoongArch_F32, LoongArch_F64 gcc/d/ChangeLog: * dmd/cond.d: Same. * implement-d.texi: Same. --- gcc/config/loongarch/loongarch-d.cc | 27 ++- gcc/

[PATCH v3 2/3] libphobos: Update build scripts for LoongArch64.

2023-12-01 Thread Yang Yujie
libphobos/ChangeLog: * m4/druntime/cpu.m4: Support loongarch* targets. * libdruntime/Makefile.am: Same. * libdruntime/Makefile.in: Regenerate. * configure: Regenerate. --- libphobos/configure | 21 ++- libphobos/libdruntime/Makefile.am | 3 + lib

[PATCH] testsuite: Adjust for the new permerror -Wincompatible-pointer-types

2023-12-05 Thread Yang Yujie
r14-6037 turned -Wincompatible-pointer-types into a permerror, which causes the following tests to fail. gcc/testsuite/ChangeLog: * gcc.dg/fixed-point/composite-type.c: replace dg-warning with dg-error. --- .../gcc.dg/fixed-point/composite-type.c | 64 +-- 1 file ch

[PATCH v2] LoongArch: Fix eh_return epilogue for normal returns

2023-12-05 Thread Yang Yujie
On LoongArch, the regitsters $r4 - $r7 (EH_RETURN_DATA_REGNO) will be saved and restored in the function prologue and epilogue if the given function calls __builtin_eh_return. This causes the return value to be overwritten on normal return paths and breaks a rare case of libgcc's _Unwind_RaiseExce

Re: [PATCH] testsuite: Adjust for the new permerror -Wincompatible-pointer-types

2023-12-06 Thread Yang Yujie
On Wed, Dec 06, 2023 at 10:45:22AM -0700, Jeff Law wrote: > > > On 12/6/23 05:12, Florian Weimer wrote: > > * Yang Yujie: > > > > > From: Yang Yujie > > > Subject: [PATCH] testsuite: Adjust for the new permerror > > > -Wincompatible-pointer-typ

[PATCH v3] LoongArch: Fix eh_return epilogue for normal returns

2023-12-06 Thread Yang Yujie
On LoongArch, the regitsters $r4 - $r7 (EH_RETURN_DATA_REGNO) will be saved and restored in the function prologue and epilogue if the given function calls __builtin_eh_return. This causes the return value to be overwritten on normal return paths and breaks a rare case of libgcc's _Unwind_RaiseExce

[PATCH v3 0/1] LoongArch: Fix eh_return epilogue for normal returns

2023-12-06 Thread Yang Yujie
Updates: v1 -> v2: Add a test case. v2 -> v3: Fix code format. Yang Yujie (1): LoongArch: Fix eh_return epilogue for normal returns gcc/config/loongarch/loongarch-protos.h | 2 +- gcc/config/loongarch/loongarch.cc | 41 --- gcc/config/loongarch/loonga

Re: [PATCH] testsuite: Adjust for the new permerror -Wincompatible-pointer-types

2023-12-06 Thread Yang Yujie
On Thu, Dec 07, 2023 at 01:35:23AM +, Sam James wrote: > > Yang Yujie writes: > > > On Wed, Dec 06, 2023 at 10:45:22AM -0700, Jeff Law wrote: > >> > >> > >> On 12/6/23 05:12, Florian Weimer wrote: > >> > * Yang Yujie: > >> &g

Re: [PATCH v3] LoongArch: Fix eh_return epilogue for normal returns

2023-12-06 Thread Yang Yujie
On Thu, Dec 07, 2023 at 11:02:58AM +0800, Xi Ruoyao wrote: > > I don't like this pair of {} for the for statement. It's not necessary > and it changes the indent level, causing the diff hard to review. > > Otherwise LGTM. I'm not sure why I didn't notice the eh_return issue > when I learnt shri

Re: [PATCH v3 1/3] LoongArch: Adjust D version strings.

2023-12-07 Thread Yang Yujie
On Thu, Dec 07, 2023 at 11:30:16AM +0100, Iain Buclaw wrote: > Hi, > > Thanks for this. > > Excerpts from Yang Yujie's message of Dezember 1, 2023 11:08 am: > > diff --git a/gcc/d/dmd/cond.d b/gcc/d/dmd/cond.d > > index 568b639e0b6..02af0cc9e29 100644 > > --- a/gcc/d/dmd/cond.d > > +++ b/gcc/d/dm

Re: [PATCH v3 2/3] libphobos: Update build scripts for LoongArch64.

2023-12-07 Thread Yang Yujie
On Thu, Dec 07, 2023 at 11:34:28AM +0100, Iain Buclaw wrote: > > Just a nitpick, I'd thought the committing of switchcontext.S should > come before this. I have no strong opinion either way. > > OK to commit. > > Iain. Thanks for the suggestion, indeed this makes sense. Yujie

Re: [PATCH] testsuite: Adjust for the new permerror -Wincompatible-pointer-types

2023-12-07 Thread Yang Yujie
On Thu, Dec 07, 2023 at 10:18:47AM +0100, Florian Weimer wrote: > * Yang Yujie: > > > With this patch, I also noticed a few errors in building unpatched older > > software like expect-5.45.4, perl-5.28.3 and bash-5.0. Will this also be > > the case when GCC 14 gets relea

Re: [PATCH v3] LoongArch: Fix eh_return epilogue for normal returns

2023-12-07 Thread Yang Yujie
On Thu, Dec 07, 2023 at 04:13:51PM +0800, Xi Ruoyao wrote: > > I understand and I don't think adding {} is wrong. The problem is the > indent change causes a large chunk of diff and it makes reviewing more > difficult. Thus generally we should not mix real code change and format > change in a co

[PATCH v4] LoongArch: Fix eh_return epilogue for normal returns

2023-12-08 Thread Yang Yujie
On LoongArch, the regitsters $r4 - $r7 (EH_RETURN_DATA_REGNO) will be saved and restored in the function prologue and epilogue if the given function calls __builtin_eh_return. This causes the return value to be overwritten on normal return paths and breaks a rare case of libgcc's _Unwind_RaiseExce

Re: [PATCH v4] LoongArch: Fix eh_return epilogue for normal returns

2023-12-08 Thread Yang Yujie
Updates: v1 -> v2: Add a test case. v2 -> v3: Fix code format. v3 -> v4: Fix code format. Avoid unwanted optimization in the test. On Fri, Dec 08, 2023 at 05:54:46PM +0800, Yang Yujie wrote: > On LoongArch, the regitsters $r4 - $r7 (EH_RETURN_DATA_REGNO) will be saved > and

Re: [PATCH v4] LoongArch: Fix eh_return epilogue for normal returns

2023-12-08 Thread Yang Yujie
Sorry, this is the wrong patch. I will post it again. On Fri, Dec 08, 2023 at 05:57:12PM +0800, Yang Yujie wrote: > Updates: > v1 -> v2: Add a test case. > v2 -> v3: Fix code format. > v3 -> v4: Fix code format. Avoid unwanted optimization in the test. > > On Fri,

[PATCH v5] LoongArch: Fix eh_return epilogue for normal returns.

2023-12-08 Thread Yang Yujie
On LoongArch, the regitsters $r4 - $r7 (EH_RETURN_DATA_REGNO) will be saved and restored in the function prologue and epilogue if the given function calls __builtin_eh_return. This causes the return value to be overwritten on normal return paths and breaks a rare case of libgcc's _Unwind_RaiseExce

[PATCH v3 0/2] LoongArch D support

2023-12-08 Thread Yang Yujie
es2 # of unsupported tests 631 Yang Yujie (2): libruntime: Add fiber context switch code for LoongArch. libphobos: Update build scripts for LoongArch64. libphobos/configure | 21 ++- libphobos/libdruntime/Makefile.am | 3 + libphobos/

[PATCH v3 1/2] libruntime: Add fiber context switch code for LoongArch.

2023-12-08 Thread Yang Yujie
libphobos/ChangeLog: * libdruntime/config/loongarch/switchcontext.S: New file. --- .../config/loongarch/switchcontext.S | 133 ++ 1 file changed, 133 insertions(+) create mode 100644 libphobos/libdruntime/config/loongarch/switchcontext.S diff --git a/libphobos/l

[PATCH v3 2/2] libphobos: Update build scripts for LoongArch64.

2023-12-08 Thread Yang Yujie
libphobos/ChangeLog: * m4/druntime/cpu.m4: Support loongarch* targets. * libdruntime/Makefile.am: Same. * libdruntime/Makefile.in: Regenerate. * configure: Regenerate. --- libphobos/configure | 21 ++- libphobos/libdruntime/Makefile.am | 3 + lib

[PING][PATCH] LoongArch: initial ada support on linux

2023-08-24 Thread Yang Yujie
gcc/ChangeLog: * ada/Makefile.rtl: Add LoongArch support. * ada/libgnarl/s-linux__loongarch.ads: New. * ada/libgnat/system-linux-loongarch.ads: New. * config/loongarch/loongarch.h: mark normalized options passed from driver to gnat1 as explicit for multilib.

[PATCH v2 3/4] LoongArch: add new configure option --with-strict-align-lib

2023-08-29 Thread Yang Yujie
LoongArch processors may not support memory accesses without natural alignments. Building libraries with -mstrict-align may help with toolchain binary compatiblity and performance on these implementations (e.g. Loongson 2K1000LA). No significant performance degredation is observed on current main

[PATCH v2 2/4] LoongArch: define preprocessing macros "__loongarch_{arch, tune}"

2023-08-29 Thread Yang Yujie
These are exported according to the LoongArch Toolchain Conventions[1] as a replacement of the obsolete "_LOONGARCH_{ARCH,TUNE}" macros, which are expanded to strings representing the actual architecture and microarchitecture of the target. [1] currently relased at https://github.com/loongson/Loon

[PATCH v2 1/4] LoongArch: improved target configuration interface

2023-08-29 Thread Yang Yujie
The configure script and the GCC driver are updated so that it is easier to customize and control GCC builds for targeting different LoongArch implementations. * Make --with-abi obsolete, since it might cause different default ABI under the same target triplet, which is undesirable. The default

[PATCH v2 4/4] LoongArch: support loongarch*-elf target

2023-08-29 Thread Yang Yujie
gcc/ChangeLog: * config.gcc: add loongarch*-elf target. * config/loongarch/elf.h: New file. Link against newlib by default. libgcc/ChangeLog: * config.host: add loongarch*-elf target. --- gcc/config.gcc | 15 ++- gcc/config/loongarch/elf.h | 5

[PATCH 0/4] LoongArch: target configuration interface update

2023-08-29 Thread Yang Yujie
h= architecture or the default --with-simd= setting has LSX support. 5. Other bug fixes. Yang Yujie (4): LoongArch: improved target configuration interface LoongArch: define preprocessing macros "__loongarch_{arch,tune}" LoongArch: add new configure option --with-strict-align

[PATCH v3 3/4] LoongArch: add new configure option --with-strict-align-lib

2023-08-31 Thread Yang Yujie
LoongArch processors may not support memory accesses without natural alignments. Building libraries with -mstrict-align may help with toolchain binary compatiblity and performance on these implementations (e.g. Loongson 2K1000LA). No significant performance degredation is observed on current main

[PATCH v3 4/4] LoongArch: support loongarch*-elf target

2023-08-31 Thread Yang Yujie
gcc/ChangeLog: * config.gcc: add loongarch*-elf target. * config/loongarch/elf.h: New file. Link against newlib by default. libgcc/ChangeLog: * config.host: add loongarch*-elf target. --- gcc/config.gcc | 15 ++- gcc/config/loongarch/elf.h | 5

[PATCH v3 1/4] LoongArch: improved target configuration interface

2023-08-31 Thread Yang Yujie
The configure script and the GCC driver are updated so that it is easier to customize and control GCC builds for targeting different LoongArch implementations. * Make --with-abi obsolete, since it might cause different default ABI under the same target triplet, which is undesirable. The default

[PATCH v3 0/4] LoongArch: target configuration interface update

2023-08-31 Thread Yang Yujie
t triplet) 4. Using "-mno-lasx" do not cause a fallback to "-msimd=none" as long as the -march= architecture or the default --with-simd= setting has LSX support. Yang Yujie (4): LoongArch: improved target configuration interface LoongArch: define preprocessi

[PATCH v3 2/4] LoongArch: define preprocessing macros "__loongarch_{arch, tune}"

2023-08-31 Thread Yang Yujie
These are exported according to the LoongArch Toolchain Conventions[1] as a replacement of the obsolete "_LOONGARCH_{ARCH,TUNE}" macros, which are expanded to strings representing the actual architecture and microarchitecture of the target. [1] currently relased at https://github.com/loongson/Loon

Re: [PING][PATCH] LoongArch: initial ada support on linux

2023-09-03 Thread Yang Yujie
On Fri, Sep 01, 2023 at 01:52:16PM +, Arnaud Charlet wrote: > A small nit above: I'd suggest using += instead of := $(XXX) to make things > clearer. Ok, will fix in v2.

[PATCH v2] LoongArch: initial ada support on linux

2023-09-03 Thread Yang Yujie
gcc/ChangeLog: * ada/Makefile.rtl: Add LoongArch support. * ada/libgnarl/s-linux__loongarch.ads: New. * ada/libgnat/system-linux-loongarch.ads: New. * config/loongarch/loongarch.h: mark normalized options passed from driver to gnat1 as explicit for multilib.

Re: [PATCH v3 1/4] LoongArch: improved target configuration interface

2023-09-05 Thread Yang Yujie
On Tue, Sep 05, 2023 at 09:31:56PM +0800, Xi Ruoyao wrote: > On Thu, 2023-08-31 at 20:48 +0800, Yang Yujie wrote: > > * Support options for LoongArch SIMD extensions: > >   new configure options --with-simd={none,lsx,lasx}; > >   new compiler option -msimd={none,lsx,lasx}; >

Re: [PATCH v1 2/6] LoongArch: improved target configuration interface

2023-09-05 Thread Yang Yujie
On Wed, Sep 06, 2023 at 07:43:26AM +0100, Richard Sandiford wrote: > Yang Yujie writes: > > @@ -5171,25 +5213,21 @@ case "${target}" in > > # ${with_multilib_list} should not contain whitespaces, > > # consecutive commas or s

[PATCH] LoongArch: Fix unintentional bash-ism in r14-3665.

2023-09-06 Thread Yang Yujie
gcc/ChangeLog: * config.gcc: remove non-POSIX syntax "<<<". --- gcc/config.gcc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index b2fe7c7ceef..6d4c8becd28 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -5189,7 +5189,7 @@ case "${

[PATCH] LoongArch: Link c++ header directory in the default ABI to the toplevel.

2023-09-06 Thread Yang Yujie
When multilib is enabled, the c++ header directory of the default multilib variant needs to be linked to the toplevel since g++ does not search the toplevel in this case. libstdc++-v3/ChangeLog: * configure.host: Register t-loongarch in tmake_file. * config/cpu/loongarch/t-loongar

Re: [PATCH] LoongArch: Link c++ header directory in the default ABI to the toplevel.

2023-09-06 Thread Yang Yujie
On Wed, Sep 06, 2023 at 06:38:25PM +0800, Xi Ruoyao wrote: > On Wed, 2023-09-06 at 18:06 +0800, Yang Yujie wrote: > > When multilib is enabled, the c++ header directory of the default multilib > > variant needs to be linked to the toplevel since g++ does not search the > >

[PATCH v2] LoongArch: Adjust C++ multilib header layout.

2023-09-06 Thread Yang Yujie
For LoongArch, the toplevel library build is always aliased to one of the multilib variants. This patch installs it with the actual MULTISUBDIR (instead of ".") so that the headers can be reached by the compiler. This patch is an update of https://gcc.gnu.org/pipermail/gcc-patches/2023-September/

Re: [PATCH v3 1/4] LoongArch: improved target configuration interface

2023-09-07 Thread Yang Yujie
> This is bad. It makes BOOT_CFLAGS=-mlasx or CFLAGS_FOR_TARGET=-mlasx > silently ignored so we cannot test a LSX/LASX or vectorizer change with > them. > > Why do we need to purge all user-specified -m options here? Yes, that is an issue that I haven't considered. The purge rules (self_specs) e

Re: [PATCH v3 1/4] LoongArch: improved target configuration interface

2023-09-07 Thread Yang Yujie
On Thu, Sep 07, 2023 at 05:47:36PM +0800, Xi Ruoyao wrote: > On Thu, 2023-09-07 at 17:31 +0800, Yang Yujie wrote: > > > This is bad.  It makes BOOT_CFLAGS=-mlasx or CFLAGS_FOR_TARGET=-mlasx > > > silently ignored so we cannot test a LSX/LASX or vectorizer change with > &g

Re: [PATCH v3 1/4] LoongArch: improved target configuration interface

2023-09-08 Thread Yang Yujie
On Thu, Sep 07, 2023 at 07:54:41PM +0800, Yang Yujie wrote: > On Thu, Sep 07, 2023 at 05:47:36PM +0800, Xi Ruoyao wrote: > > On Thu, 2023-09-07 at 17:31 +0800, Yang Yujie wrote: > > > > This is bad.  It makes BOOT_CFLAGS=-mlasx or CFLAGS_FOR_TARGET=-mlasx > > > > s

Re: [PATCH v3 1/4] LoongArch: improved target configuration interface

2023-09-08 Thread Yang Yujie
On Sat, Sep 09, 2023 at 01:56:57PM +0800, Xi Ruoyao wrote: > On Sat, 2023-09-09 at 10:46 +0800, Yang Yujie wrote: > > The next option I can think of would be MULTILIB_EXTRA_OPTS, where > > -fmultiflags > > fit in nicely.  However, these options won't reach the topleve

[PATCH] libsanitizer: adjust triplet pattern to allow loongarch64-linux* targets.

2023-11-16 Thread Yang Yujie
libsanitizer/ChangeLog: * configure.tgt: allow loongarch64-linux-*. --- libsanitizer/configure.tgt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsanitizer/configure.tgt b/libsanitizer/configure.tgt index d24566a2343..5af524cb271 100644 --- a/libsanitizer/configure

[PATCH] libphobos: Fix static build.

2023-11-16 Thread Yang Yujie
This is a temporary solution to https://forum.dlang.org/thread/bug-1226...@https.d.puremagic.com%2Fissues%2F libphobos/ChangeLog: * libdruntime/gcc/sections/elf.d: Removes reference to __tls_get_addr for static libdruntime. --- libphobos/libdruntime/gcc/sections/elf.d | 4 +++-

Re: Re: [PATCH] libsanitizer: adjust triplet pattern to allow loongarch64-linux* targets.

2023-11-16 Thread Yang Yujie
> ${target} in there shouldn't be what user specified, but what config.sub > canonicalized it to. > And > ./config.sub x86_64-linux; ./config.sub loongarch64-linux > x86_64-pc-linux-gnu > loongarch64-unknown-linux-gnu > so I really don't see why you want to change it. OK, I see. Thanks. Yujie

[PATCH] LoongArch: Fix eh_return epilogue for normal returns.

2023-11-16 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/loongarch.cc: Do not restore the saved eh_return data registers ($r4-$r7) for a normal return of a function that calls __builtin_eh_return elsewhere. * config/loongarch/loongarch-protos.h: Same. * config/loongarch/loongarch.

[PATCH 1/3] LoongArch: Adjust D version strings.

2023-11-17 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/loongarch-d.cc: Undefine LoongArch32. Define LoongArch_SF, LoongArch_F32, LoongArch_F64 gcc/d/ChangeLog: * dmd/cond.d: Same. * implement-d.texi: Same. --- gcc/config/loongarch/loongarch-d.cc | 27 ++- gcc/

  1   2   >