Re: [RFC PATCH 0/3] _BitInt(N) support for LoongArch

2025-05-21 Thread Yang Yujie
On Wed, May 21, 2025 at 11:48:08AM GMT, Jakub Jelinek wrote: > In gimple-lower-bitint.cc I'd strongly prefer to differentiate between > changes required to get info->extended working correctly (that is what > should be committed first, and right now should include the LSHIFT_EXPR in > lower_shift_s

Re: [RFC PATCH 0/3] _BitInt(N) support for LoongArch

2025-05-21 Thread Yang Yujie
On Wed, May 21, 2025 at 09:21:40AM GMT, Jakub Jelinek wrote: > > The existing testsuite never tests whether the padding bits are sign or zero > extended or contain unknown values. > In the s390x patch, info->extended is set to true, yet all bitint tests but > bitint-64.c at -O3 pass. > > So, I'm

Re: [RFC PATCH 0/3] _BitInt(N) support for LoongArch

2025-05-20 Thread Yang Yujie
On Tue, May 20, 2025 at 03:44:09PM GMT, Jakub Jelinek wrote: > I'd suggest working on it incrementally rather than with a full patch set. > In one or multiple patches handle the promote_mode stuff, the atomic > extension and expr.cc changes with the feedback incorporated. Ok. > For gimple-lower-b

Re: [RFC PATCH 0/3] _BitInt(N) support for LoongArch

2025-05-20 Thread Yang Yujie
On Tue, May 20, 2025 at 09:55:04PM GMT, Xi Ruoyao wrote: > On Tue, 2025-05-20 at 15:44 +0200, Jakub Jelinek wrote: > > > Specifically, the tests told me to extend (thought "truncate" > > > was kind of an equivalent word) the output of left shift, plus/minus, > > > > Truncation is the exact opposit

Re: [RFC PATCH 0/3] _BitInt(N) support for LoongArch

2025-05-20 Thread Yang Yujie
Hi Jakub, Thanks for the quick review. Aside from code formatting issues, can I conclude that you suggest we should rebase this onto your new big-endian support patch? Or do you think it's necessary to add big-endian && extended support together? > Are you sure all those changes were really nec

[RFC PATCH 0/3] _BitInt(N) support for LoongArch

2025-05-19 Thread Yang Yujie
o be made to gimple lowering and expand. This series has been bootstrapped and regtested with x86_64-linux-gnu and loongarch64-linux-gnu (against a version that leaves the partial limbs undefined). Please help us find if there's something we've missed. Thanks, Yujie Yang Yujie (3):

[RFC PATCH 1/3] bitint: Support ABI-extended _BitInt(N)

2025-05-19 Thread Yang Yujie
The padding bits of _BitInt(N) are undefined in the x86-64 and the aarch64 ABI. In general, the current lowering and expand process perform truncations when taking a _BitInt value as input, while leaving them as-is in the output. By adding truncation on the output side, we can define psABIs (e.g.

[RFC PATCH 2/3] bitint: Allow wider abi_limb_mode than limb_mode during layout

2025-05-19 Thread Yang Yujie
gcc/ChangeLog: * stor-layout.cc (layout_type): Allow limb_mode to be DImode while abi_limb_mode is TImode for _BitInt(N), N > 64. --- gcc/stor-layout.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/stor-layout.cc b/gcc/stor-layout.cc index 18b5af56124.

[RFC PATCH 3/3] LoongArch: Add support for _BitInt [PR117599]

2025-05-19 Thread Yang Yujie
This patch adds support for C23's _BitInt for LoongArch. Though there's not an official psABI definition, our plan is to have 16-byte alignment for N > 64 and the padding bits sign/zero-extended when passed between procedures. One exception would be "unsigned _BitInt(32)". To match the behavior o

[PATCH] LoongArch: Fix awk / sed usage for compatibility

2025-04-06 Thread Yang Yujie
Tested with nawk, mawk, and gawk. gcc/ChangeLog: * config/loongarch/genopts/gen-evolution.awk: remove usage of "asort". * config/loongarch/genopts/genstr.sh: replace sed with awk. --- .../loongarch/genopts/gen-evolution.awk | 12 +++- gcc/config/loongarch/genopts/ge

[PATCH 1/1] LoongArch: Remove gawk extension from a generator script.

2024-07-22 Thread Yang Yujie
gcc/ChangeLog: * config/loongarch/genopts/gen-evolution.awk: Do not use "length()" to compute the size of an array. --- gcc/config/loongarch/genopts/gen-evolution.awk | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/config/loongarch/genopts/gen-evolut

[PATCH 0/1] LoongArch: Remove gawk extension from a generator script.

2024-07-22 Thread Yang Yujie
Builds for the LoongArch target fail if the system "awk" is not "gawk". This patch removes this unnecessary requirement. Thanks to Jan-Benedict Glaw for finding and reporting this issue. Yang Yujie (1): LoongArch: Remove gawk extension from a generator script. gcc/conf

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 __loongarc

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

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

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

[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

[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 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 +++ gcc/config/loongarch/linu

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

[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

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. * config/loongarc

[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

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 propert

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

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

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

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

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

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

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

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

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 > > +++ b/gcc/d/dm

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

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

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

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

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

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

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

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

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 --- a/libsanitizer/configure

[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

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

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 runtime

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

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

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

  1   2   >