Re: [PATCH v4 1/2] LoongArch: Define ISA versions

2024-04-22 Thread Yang Yujie
v1 -> v2: - Fixed build issues of runtime libraries caused by the new header. - Restored the default ARCH of lp64f/lp64s ABI to "abi-default". v2 -> v3: - Fixed libobjc build. - Modify "LoongArch v1.1 features" to "LoongArch v1.1 instructions" in invoke.texi. v3 -> v4: - Do not define

[PATCH v4 1/2] LoongArch: Define ISA versions

2024-04-22 Thread Yang Yujie
These ISA versions are defined as -march= parameters and are recommended for building binaries for distribution. Detailed description of these definitions can be found at https://github.com/loongson/la-toolchain-conventions, which the LoongArch GCC port aims to conform to. gcc/ChangeLog:

[PATCH v4 2/2] LoongArch: Define builtin macros for ISA evolutions

2024-04-22 Thread Yang Yujie
Detailed description of these definitions can be found at https://github.com/loongson/la-toolchain-conventions, which the LoongArch GCC port aims to conform to. gcc/ChangeLog: * config.gcc: Add loongarch-evolution.o. * config/loongarch/genopts/genstr.sh: Enable generation of

Re: [PATCH v3 1/2] LoongArch: Define ISA versions

2024-04-22 Thread Yang Yujie
v1 -> v2: - Fixed build issues of runtime libraries caused by the new header. - Restored the default ARCH of lp64f/lp64s ABI to "abi-default". v2 -> v3: - Fixed libobjc build. - Modify "LoongArch v1.1 features" to "LoongArch v1.1 instructions" in invoke.texi.

[PATCH v3 2/2] LoongArch: Define builtin macros for ISA evolutions

2024-04-22 Thread Yang Yujie
Detailed description of these definitions can be found at https://github.com/loongson/la-toolchain-conventions, which the LoongArch GCC port aims to conform to. gcc/ChangeLog: * config.gcc: Add loongarch-evolution.o. * config/loongarch/genopts/genstr.sh: Enable generation of

[PATCH v3 1/2] LoongArch: Define ISA versions

2024-04-22 Thread Yang Yujie
These ISA versions are defined as -march= parameters and are recommended for building binaries for distribution. Detailed description of these definitions can be found at https://github.com/loongson/la-toolchain-conventions, which the LoongArch GCC port aims to conform to. gcc/ChangeLog:

Re: [PATCH v2 1/2] LoongArch: Define ISA versions

2024-04-20 Thread Yang Yujie
v1 -> v2: - Fixed build issues of runtime libraries caused by the new header. - Restored the default ARCH of lp64f/lp64s ABI to "abi-default".

[PATCH v2 2/2] LoongArch: Define builtin macros for ISA evolutions

2024-04-20 Thread Yang Yujie
Detailed description of these definitions can be found at https://github.com/loongson/la-toolchain-conventions, which the LoongArch GCC port aims to conform to. gcc/ChangeLog: * config.gcc: Add loongarch-evolution.o. * config/loongarch/genopts/genstr.sh: Enable generation of

[PATCH v2 1/2] LoongArch: Define ISA versions

2024-04-20 Thread Yang Yujie
These ISA versions are defined as -march= parameters and are recommended for building binaries for distribution. Detailed description of these definitions can be found at https://github.com/loongson/la-toolchain-conventions, which the LoongArch GCC port aims to conform to. gcc/ChangeLog:

Re: [PATCH 1/2] LoongArch: Define ISA versions

2024-04-19 Thread Yang Yujie
On Fri, Apr 19, 2024 at 07:34:33PM +0800, Xi Ruoyao wrote: > On Fri, 2024-04-19 at 19:04 +0800, Yang Yujie wrote: > > These ISA versions are defined as -march= parameters and > > are recommended for building binaries for distribution. > > > > Detailed description of the

[PATCH 1/2] LoongArch: Define ISA versions

2024-04-19 Thread Yang Yujie
These ISA versions are defined as -march= parameters and are recommended for building binaries for distribution. Detailed description of these definitions can be found at https://github.com/loongson/la-toolchain-conventions, which the LoongArch GCC port aims to conform to. gcc/ChangeLog:

[PATCH 2/2] LoongArch: Define builtin macros for ISA evolutions

2024-04-19 Thread Yang Yujie
Detailed description of these definitions can be found at https://github.com/loongson/la-toolchain-conventions, which the LoongArch GCC port aims to conform to. gcc/ChangeLog: * config.gcc: Add loongarch-evolution.o. * config/loongarch/genopts/genstr.sh: Enable generation of

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, regtested f

Re: [PATCH v2] LoongArch: Enable switchable target

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

[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

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

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

[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

[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

[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.

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] 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 +++

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 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. *

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 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. *

[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

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 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. *

[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. *

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 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

[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 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

[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 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

[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

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] 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

[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 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 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

[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

[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 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 +

[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

[PATCH v3 0/2] LoongArch D support

2023-12-08 Thread Yang Yujie
2 # 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/libdr

[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

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,

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 &g

[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

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

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 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 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 > > +++

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

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

[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

[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

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 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

[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

[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 +

[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 ++-

[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

[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/implem

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

[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 +

[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/implement-d.t

[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

[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 ++-

[PATCH 3/3] libphobos: Adjust LoongArch definitons.

2023-11-17 Thread Yang Yujie
Upstream commits: https://github.com/dlang/phobos/commit/870eb5d5d6972b12dd4b69d48ef049abee811b6b https://github.com/dlang/dmd/commit/9cb5517290fac5d28f52c11c254115c0f1086b69 libphobos/ChangeLog: * libdruntime/core/stdc/fenv.d: Fix LongArch FP rounding mode constants. *

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

2023-11-17 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 +

[PATCH 0/3] LoongArch GDC support.

2023-11-17 Thread Yang Yujie
This patchset is based on Zixing Liu's initial support patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631260.html Yang Yujie (3): LoongArch: Adjust D version strings. libphobos: Update build scripts for LoongArch64. libphobos: Adjust LoongArch definitons. gcc/config

[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 ++-

[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. *

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] 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 +++-

[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 ---

[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. ---

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-multili

[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. ---

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

Re: [PATCH v2 0/1] Add LoongArch64 support for D frontend

2023-09-25 Thread Yang Yujie
Hi Zixing, We are also working on a patch series that could pass the libphobos regression tests. Will post this later once all failed items are fixed. Yujie On Sun, Sep 24, 2023 at 03:40:32PM -0600, Zixing Liu wrote: > This patch adds the LoongArch64 support for GCC D frontend. > > The

[PATCH] LoongArch: Reimplement multilib build option handling.

2023-09-13 Thread Yang Yujie
Library build options from --with-multilib-list used to be processed with *self_spec, which missed the driver's initial canonicalization. This caused limitations on CFLAGS override and the use of driver-only options like -m[no]-lsx. The problem is solved by promoting the injection rules of

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

2023-09-09 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 toplevel bui

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-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-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)

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

2023-09-07 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

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] 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. *

[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

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

2023-09-06 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

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}; >

[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

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 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

[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 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

  1   2   >