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

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

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

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

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

2022-04-15 Thread Lulu Cheng
Hi,all: This patch has been merged into the master branch. Thanks! Lulu Cheng 在 2022/4/11 下午3:08, Lulu Cheng 写道: From: chenglulu gcc/ChangeLog: * config/loongarch/loongarch.cc: Fix bug for tmpdir-g++.dg-struct-layout-1/t033. --- gcc/config/loongarch/loongarch.cc | 8

[PATCH v1] LoongArch: Optimized multiply instruction generation.

2023-09-05 Thread Lulu Cheng
1. Can generate mulh.w[u] instruction. 2. Can generate mulw.d.wu instruction. gcc/ChangeLog: * config/loongarch/loongarch.md (mulsidi3_64bit): (muldi3_highpart): Modify template name. (mulsi3_highpart): Likewise. (mulsidi3_64bit): Field unsigned

[PATCH] LoongArch: gcc: Modify gas uleb128 support test.

2023-09-14 Thread Lulu Cheng
From: mengqinggang Add "ld conftest.o -o conftest" process, then the "objdump -dr" contents is right. Because gas write zero to objdec file and generate R_LARCH_ADD_ULEB128/R_LARCH_SUB_ULEB128 reloc pair to calcualte uleb128 format symbol subtraction after ld relaxation. gcc/ChangeLog:

[PATCH 1/2] LoongArch: Optimize switch with sign-extended index.

2023-09-02 Thread Lulu Cheng
The patch refers to the submission of RISCV 7bbce9b50302959286381d9177818642bceaf301. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_extend_comparands): In unsigned QImode test, check for sign extended subreg and/or constant operands, and do a sign extend in

[PATCH v2] LoongArch: Fix bug of 'di3_fake'.

2023-09-12 Thread Lulu Cheng
PR 111334 gcc/ChangeLog: * config/loongarch/loongarch.md: Fix bug of 'di3_fake'. gcc/testsuite/ChangeLog: * gcc.target/loongarch/pr111334.c: New test. --- v1 -> v2: Modify the template "*3", the SI type division operation is not supported under

[PATCH] LoongArch: Change the value of branch_cost from 2 to 6.

2023-09-12 Thread Lulu Cheng
gcc/ChangeLog: * config/loongarch/loongarch-def.c: Modify the default value of branch_cost. gcc/testsuite/ChangeLog: * gcc.target/loongarch/cmov_ii.c: New test. --- gcc/config/loongarch/loongarch-def.c | 4 ++-- gcc/testsuite/gcc.target/loongarch/cmov_ii.c | 16

[PATCH v1] LoongArch: Fix bug of 'di3_fake'.

2023-09-09 Thread Lulu Cheng
PR 111334 gcc/ChangeLog: * config/loongarch/loongarch.md: Fix bug of di3_fake. gcc/testsuite/ChangeLog: * gcc.target/loongarch/pr111334.c: New test. --- gcc/config/loongarch/loongarch.md | 14 +-- gcc/testsuite/gcc.target/loongarch/pr111334.c | 39

[PATCH v1] LoongArch: Optimize fixed-point and floating-point conversion operations.

2023-08-31 Thread Lulu Cheng
Before optimization, the operation of taking fixed-point numbers from memory and then forcing type conversion needs to be loaded into fixed-point registers before conversion. After the optimization is completed, the fixed-point value is directly transferred to the floating-point register for type

[PATCH v1] LoongArch: Add floating point conditional move support.

2023-09-14 Thread Lulu Cheng
gcc/ChangeLog: * config/loongarch/loongarch-protos.h (loongarch_expand_conditional_move): Modify the return value type of a function. * config/loongarch/loongarch.cc (loongarch_expand_conditional_move): Added floating point conditional transfer

[PATCH] LoongArch: Delete macro definition ASM_OUTPUT_ALIGN_WITH_NOP.

2023-09-15 Thread Lulu Cheng
There are two reasons for removing this macro definition: 1. The default in the assembler is to use the nop instruction for filling. 2. For assembly directives: .align [abs-expr[, abs-expr[, abs-expr]]] The third expression it is the maximum number of bytes that should be skipped by this

[PATCH v1] LoongArch: Check whether binutils supports the relax function. If supported, explicit relocs are turned off by default.

2023-09-14 Thread Lulu Cheng
gcc/ChangeLog: * config.in: Regenerate. * config/loongarch/genopts/loongarch.opt.in: Add compilation option mrelax. And set the initial value of explicit-relocs according to the detection status. * config/loongarch/gnu-user.h: When compiling with

[PATCH v2] LoongArch: Delete macro definition ASM_OUTPUT_ALIGN_WITH_NOP.

2023-10-12 Thread Lulu Cheng
There are two reasons for removing this macro definition: 1. The default in the assembler is to use the nop instruction for filling. 2. For assembly directives: .align [abs-expr[, abs-expr[, abs-expr]]] The third expression it is the maximum number of bytes that should be skipped by this

[PATCH] LoongArch: Define macro CLEAR_INSN_CACHE.

2023-10-20 Thread Lulu Cheng
LoongArch's microstructure ensures cache consistency by hardware. Due to out-of-order execution, ibar is required to ensure the visibility of the store (invalidated icache) executed by this CPU before ibar (to the instance). ibar will not invalidate the icache, so the start and end parameters are

[PATCH v2] libffi: Backport of LoongArch support for libffi.

2023-08-22 Thread Lulu Cheng
v1 -> v2: Modify the changelog information and add PR libffi/108682. This is a backport of , and contains modifications to commit 5a4774cd4d, as well as the LoongArch schema portion of commit ee22ecbd11. This is needed for libgo.

[PATCH v2] LoongArch: Enable '-free' starting at -O2.

2023-08-27 Thread Lulu Cheng
v1 -> v2: 1. Modify Changelog information format. gcc/ChangeLog: * common/config/loongarch/loongarch-common.cc: Enable '-free' on O2 and above. * doc/invoke.texi: Modify the description information of the '-free' compilation option and add the LoongArch

[PATCH v1] LoongArch: Enable '-free' starting at -O2.

2023-08-27 Thread Lulu Cheng
gcc/ChangeLog: * common/config/loongarch/loongarch-common.cc: Enable '-free' on O2 and above. * doc/invoke.texi: Modify the description information of the '-free' compilation option and add the LoongArch description. gcc/testsuite/ChangeLog: *

[PATCH v1] LoongArch: Remove the symbolic extension instruction due to the SLT directive.

2023-08-24 Thread Lulu Cheng
Since the slt instruction does not distinguish between 32-bit and 64-bit operations under the LoongArch 64-bit architecture, if the operands of slt are of SImode, symbol expansion is required before operation. But similar to the following test case, symbol expansion can be omitted:

[PATCH v1] libffi: Backport of LoongArch support for libffi.

2023-08-22 Thread Lulu Cheng
This is a backport of , and contains modifications to commit 5a4774cd4d, as well as the LoongArch schema portion of commit ee22ecbd11. This is needed for libgo. libffi/ChangeLog: * configure.host: Add LoongArch support. *

[PATCH v2] LoongArch: Remove redundant sign extension instructions caused by SLT instructions.

2023-08-25 Thread Lulu Cheng
v1 -> v2: 1. Modify description information Since the SLT instruction does not distinguish between 64-bit operations and 32-bit operations under the 64-bit LoongArch architecture, if the operand of slt is SImode, the sign extension of the operand needs to be displayed. But similar to

Re: [PATCH] loongarch: ignore zero-size fields in calling convention

2022-04-25 Thread Lulu Cheng
This modification will cause the ABI to change, we are discussing solutions. And we will give a conclusion at the latest tommorrow. Thanks! 在 2022/4/25 下午1:57, Xi Ruoyao 写道: Ping. Normally we shouldn't ping a patch after only a few days, but we're running out of time to catch GCC 12

Re: [PATCH] loongarch: ignore zero-size fields in calling convention

2022-04-27 Thread Lulu Cheng
I think the modification should be below. if (!TYPE_P (TREE_TYPE (f)))    return -1; Thanks! Lulu Cheng

[PATCH 1/2] LoongArch: Add '(clobber (mem:BLK (scratch)))' to PLV instruction templates.

2022-04-27 Thread Lulu Cheng
gcc/ChangeLog: * config/loongarch/loongarch.md: Add '(clobber (mem:BLK (scratch)))' to PLV instruction templates. --- gcc/config/loongarch/loongarch.md | 40 +-- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git

[PATCH 2/2] LoongArch: Add fdiv define_expand template.

2022-04-27 Thread Lulu Cheng
gcc/ChangeLog: * config/loongarch/loongarch.md: Add fdiv define_expand template, then generate floating-point division and floating-point reciprocal instructions. --- gcc/config/loongarch/loongarch.md | 6 ++ 1 file changed, 6 insertions(+) diff --git

[PATCH v3] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.

2022-07-07 Thread Lulu Cheng
update testsuite. -- Under the LA architecture, when the stack is dropped too far, the process of dropping the stack is divided into two steps. step1: After dropping the stack, save callee saved registers on the stack. step2: The rest of it. The stack drop operation is

Re: [PATCH v3] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.

2022-07-07 Thread Lulu Cheng
在 2022/7/7 下午7:51, Xi Ruoyao 写道: On Thu, 2022-07-07 at 18:30 +0800, Lulu Cheng wrote: /* snip */ diff --git a/gcc/testsuite/gcc.target/loongarch/prolog-opt.c b/gcc/testsuite/gcc.target/loongarch/prolog-opt.c new file mode 100644 index 000..c7bd71dde93 --- /dev/null +++ b/gcc

[PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero.

2022-07-07 Thread Lulu Cheng
gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_compute_frame_info): Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero, don't minus UNITS_PER_WORD or UNITS_PER_FP_REG. ---

[PATCH v2] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.

2022-07-07 Thread Lulu Cheng
Under the LA architecture, when the stack is dropped too far, the process of dropping the stack is divided into two steps. step1: After dropping the stack, save callee saved registers on the stack. step2: The rest of it. The stack drop operation is optimized when frame->total_size minus

Re: [PATCH 0/2] loongarch: improve code generation for integer division

2022-07-07 Thread Lulu Cheng
在 2022/7/7 上午10:23, Xi Ruoyao 写道: We were generating some unnecessary instructions for integer division. These two patches improve the code generation to compile template T div(T a, T b) { return a / b; } into a single division instruction (along with a return instruction of course) as

[pushd][PATCH v4] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method when frame->mask or frame->fmask is zero.

2022-07-07 Thread Lulu Cheng
Pushed for trunk and gcc-12. r13-1569-gaa8fd7f65683ef. r12-8558-ge623829c18ec29 Under the LA architecture, when the stack is dropped too far, the process of dropping the stack is divided into two steps. step1: After dropping the stack, save callee saved registers on the stack.

Re: [PATCH] loongarch: use -mno-check-zero-division as the default for optimized code

2022-07-04 Thread Lulu Cheng
在 2022/7/3 上午11:06, Xi Ruoyao 写道: On Sat, 2022-07-02 at 16:35 +0800, Lulu Cheng wrote: 在 2022/7/2 下午4:24, Xi Ruoyao 写道: I'll commit the patch with the hook removed after another regtest on loongarch64-linux-gnu.  I just rebuilt the entire system on my 3A5000, so I need some time to set it up

Re: [PATCH v3] loongarch: fix mulsidi3_64bit instruction

2022-07-09 Thread Lulu Cheng
在 2022/7/9 上午10:56, Xi Ruoyao 写道: v3: Relax scan-assembler pattern in test case mulw_d_w.c. It's because multiplication is Abelian and the compiler may switch the order of operands in the future. -- >8 -- (mult (sign_extend:DI rj:SI) (sign_extend:DI rk:SI)) should be "mulw.d.w", not "mul.d".

Re: [PATCH 0/2] loongarch: improve code generation for integer division

2022-07-09 Thread Lulu Cheng
在 2022/7/7 上午10:23, Xi Ruoyao 写道: We were generating some unnecessary instructions for integer division. These two patches improve the code generation to compile template T div(T a, T b) { return a / b; } into a single division instruction (along with a return instruction of course) as

[pushed][PATCH] LoongArch: Remove undefined behavior from code [PR 106097]

2022-06-29 Thread Lulu Cheng
C++2017 and previous standard description: The value of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are zero-filled. If E1 has an unsigned type, the value of the result is E1×2E2, reduced modulo one more than the maximum value representable inthe result type. Otherwise, if E1 has a

Re: [PATCH] loongarch: use -mno-check-zero-division as the default for optimized code

2022-07-02 Thread Lulu Cheng
RGET_FLAGS    MASK_CHECK_ZERO_DIV - I think this modifications are needed, and there is no problem with the rest. Thanks! Lulu Cheng

Re: [PATCH] loongarch: use -mno-check-zero-division as the default for optimized code

2022-07-02 Thread Lulu Cheng
在 2022/7/2 下午4:24, Xi Ruoyao 写道: On Sat, 2022-07-02 at 15:39 +0800, Lulu Cheng wrote: diff --git a/gcc/common/config/loongarch/loongarch-common.cc b/gcc/common/config/loongarch/loongarch-common.cc index b6cbd84b873..f8b4660fabf 100644 --- a/gcc/common/config/loongarch/loongarch-common.cc

Re: [PATCH v1 1/2] LoongArch: Modify the method of obtaining symbolic addresses.

2022-07-19 Thread Lulu Cheng
在 2022/7/19 下午10:29, Xi Ruoyao 写道: The change seems too large. It would be better to split it into multiple commits (for example, just 3 commits for 1,2,3 below). On Tue, 2022-07-19 at 21:08 +0800, Lulu Cheng wrote: 1. The original LA macro instruction is split into two instructions

[PATCH v1 2/2] LoongArch: Modify the definition of the ASM_PREFERRED_EH_DATA_FORMAT macro.

2022-07-19 Thread Lulu Cheng
Some R_LARCH_64 in section .eh_frame will to generate R_LARCH_NONE, we change relocation to R_LARCH_32_PCREL from R_LARCH_64 in setction .eh_frame and not generate dynamic relocation for R_LARCH_32_PCREL. gcc/ChangeLog: * config/loongarch/loongarch.h (ASM_PREFERRED_EH_DATA_FORMAT):

[PATCH v1 0/2] LoongArch: Modify the method of obtaining symbolic addresses.

2022-07-19 Thread Lulu Cheng
/binutils/2022-July/121849.html https://sourceware.org/pipermail/binutils/2022-July/121850.html https://sourceware.org/pipermail/binutils/2022-July/121851.html https://sourceware.org/pipermail/binutils/2022-July/121852.html https://sourceware.org/pipermail/binutils/2022-July/121853.html Lulu Cheng (2

[PATCH v1 1/2] LoongArch: Modify the method of obtaining symbolic addresses.

2022-07-19 Thread Lulu Cheng
1. The original LA macro instruction is split into two instructions to obtain the address of the symbol if enable '-mexplicit-relocs'. 2. Currently, '-mcmodel=' only supports 'normal' mode, because other mode behaviors are not yet determined. This function is gradually improved by the

[PATCH][wwwdocs] gcc-13: Add loongarch '-mexplicit-relocs' support

2022-07-26 Thread Lulu Cheng
Hi, Recently we added split symbol support, changed in r13-1834. It is ok for wwwdocs? Thanks! Lulu Cheng --- htdocs/gcc-13/changes.html | 21 + 1 file changed, 21 insertions(+) diff --git a/htdocs/gcc-13/changes.html b/htdocs/gcc-13/changes.html index 57bd8724

Re: [pushed][PATCH v1 0/2] LoongArch: Modify the method of obtaining symbolic addresses.

2022-07-26 Thread Lulu Cheng
在 2022/7/19 下午9:08, Lulu Cheng 写道: 1. The original LA macro instruction is split into two instructions to obtain the address of the symbol if enable '-mexplicit-relocs'. 2. Currently, '-mcmodel=' only supports 'normal' mode, because other mode behaviors are not yet determined

Re: [PATCH][wwwdocs] gcc-13: Add loongarch '-mexplicit-relocs' support

2022-07-26 Thread Lulu Cheng
在 2022/7/26 下午5:44, Xi Ruoyao 写道: +  whether the la.* macro instructions will be generated when +  loading symbolic addresses. +  This feature requires binutils version 2.40 or later. If you want to use the +  older version of bintuils, add compiler parameters +  -mno-explicit-relocs at

Re: [PATCH][wwwdocs] gcc-13: Add loongarch '-mexplicit-relocs' support

2022-07-26 Thread Lulu Cheng
在 2022/7/26 下午7:32, Gerald Pfeifer 写道: On Tue, 26 Jul 2022, Lulu Cheng wrote: +LoongArch + + The option -mexplicit-relocs has been added, this indicates + whether the la.* macro instructions will be generated when + loading symbolic addresses. How about making this "...has been

Re: [PATCH][wwwdocs] gcc-13: Add loongarch '-mexplicit-relocs' support

2022-07-26 Thread Lulu Cheng
在 2022/7/26 下午8:01, Xi Ruoyao 写道: On Tue, 2022-07-26 at 19:42 +0800, Lulu Cheng wrote: 在 2022/7/26 下午5:44, Xi Ruoyao 写道: +  whether the la.* macro instructions will be generated when +  loading symbolic addresses. +  This feature requires binutils version 2.40 or later. If you want to use

Re: [PATCH v1] LoongArch: Define the macro ASM_PREFERRED_EH_DATA_FORMAT by checking the assembler's support for eh_frame encoding.

2022-07-28 Thread Lulu Cheng
在 2022/7/29 上午11:18, Xi Ruoyao 写道: On Fri, 2022-07-29 at 10:43 +0800, Lulu Cheng wrote: .eh_frame DW_EH_PE_pcrel encoding format is not supported by gas <= 2.39. Check if the assembler support DW_EH_PE_PCREL encoding and define .eh_frame encoding type. gcc/ChangeLog: * config

[PATCH v1] LoongArch: Define the macro ASM_PREFERRED_EH_DATA_FORMAT by checking the assembler's support for eh_frame encoding.

2022-07-28 Thread Lulu Cheng
The ASM_PREFERRED_EH_DATA_FORMAT macro before and after modification is as follows: #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ - (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_absptr) + (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) Use the following

[PATCH v2] LoongArch: Define the macro ASM_PREFERRED_EH_DATA_FORMAT by checking the assembler's support for eh_frame encoding.

2022-07-28 Thread Lulu Cheng
The ASM_PREFERRED_EH_DATA_FORMAT macro before and after modification is as follows: #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ - (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_absptr) + (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) Use the following tests

Re: [PATCH][wwwdocs] gcc-13: Add loongarch '-mexplicit-relocs' support

2022-07-28 Thread Lulu Cheng
在 2022/7/28 下午6:41, Xi Ruoyao 写道: On Thu, 2022-07-28 at 10:59 +0800, Lulu Cheng wrote: The ASM_PREFERRED_EH_DATA_FORMAT macro before and after modification is as follows:  #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \  -  (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_absptr

Re: [PATCH v2] LoongArch: Define the macro ASM_PREFERRED_EH_DATA_FORMAT by checking the assembler's support for eh_frame encoding.

2022-07-29 Thread Lulu Cheng
在 2022/7/29 下午12:02, Lulu Cheng 写道: The ASM_PREFERRED_EH_DATA_FORMAT macro before and after modification is as follows: #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ - (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_absptr) + (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel

Re: [PATCH v3] LoongArch: add addr_global attribute

2022-07-29 Thread Lulu Cheng
在 2022/7/30 上午1:17, Xi Ruoyao 写道: Change v2 to v3: - Disable section anchor for addr_global symbols. - Use -O2 in test to make sure section anchor is disabled. -- Background:

Re: [PATCH] LoongArch: document -m[no-]explicit-relocs

2022-07-27 Thread Lulu Cheng
在 2022/7/27 下午3:21, WANG Xuerui 写道: Hi, On 2022/7/27 15:06, Xi Ruoyao wrote: Document newly introduced -m[no-]explicit-relocs options.  Ok for trunk? -- >8 -- gcc/ChangeLog: * doc/invoke.texi: Document -m[no-]explicit-relocs for LoongArch. ---   gcc/doc/invoke.texi | 12

Re: [PATCH] LoongArch: document -m[no-]explicit-relocs

2022-07-27 Thread Lulu Cheng
在 2022/7/27 下午5:15, Xi Ruoyao 写道: On Wed, 2022-07-27 at 16:47 +0800, Lulu Cheng wrote:  "Use or do not use assembler relocation operators when dealing with symbolic addresses. The alternative is to use assembler macros instead, which may limit optimization.  The default

Re: [PATCH] LoongArch: adjust the default of -mexplicit-relocs by checking gas feature

2022-07-26 Thread Lulu Cheng
在 2022/7/26 下午10:15, Xi Ruoyao 写道: The following should work. I've tested it locally by building GCC with both old (2.38 with patch) and new (trunk) Binutils. Ok for trunk? I simply checked as instead of ld. If as supports explicitly relocations, the produced .o file won't be supported by

Re: [PATCH][wwwdocs] gcc-13: Add loongarch '-mexplicit-relocs' support

2022-07-27 Thread Lulu Cheng
在 2022/7/26 下午8:01, Xi Ruoyao 写道: On Tue, 2022-07-26 at 19:42 +0800, Lulu Cheng wrote: 在 2022/7/26 下午5:44, Xi Ruoyao 写道: Should we indicate that our .eh_frame section format has changed? I don't really understand C++ exception handling, so: does the change breaks something? For example

[PATCH v2 0/3] LoongArch: Modify the method of obtaining symbolic addresses.

2022-07-21 Thread Lulu Cheng
/binutils/2022-July/121936.html [6]https://sourceware.org/pipermail/binutils/2022-July/121938.html [7]https://sourceware.org/pipermail/binutils/2022-July/121939.html Lulu Cheng (3): LoongArch: Subdivision symbol type, add SYMBOL_PCREL support. LoongArch: Support split symbol. LoongArch

[PATCH v2 1/3] LoongArch: Subdivision symbol type, add SYMBOL_PCREL support.

2022-07-21 Thread Lulu Cheng
1. Remove cModel type support other than normal. 2. The method that calls global functions from 'la.global + jirl' to 'bl' when build with '-fplt'. gcc/ChangeLog: * config/loongarch/constraints.md (a): Delete the constraint. (b): A constant call not local address. (h):

[PATCH v2 2/3] LoongArch: Support split symbol.

2022-07-21 Thread Lulu Cheng
Add compilation option '-mexplicit-relocs', and if enable '-mexplicit-relocs' the symbolic address load instruction 'la.*' will be split into two instructions. This ckompilation option enabled by default. gcc/ChangeLog: * common/config/loongarch/loongarch-common.cc: Enable

[PATCH v2 3/3] LoongArch: Modify the definition of the ASM_PREFERRED_EH_DATA_FORMAT macro.

2022-07-21 Thread Lulu Cheng
Some R_LARCH_64 in section .eh_frame will to generate R_LARCH_NONE, we change relocation to R_LARCH_32_PCREL from R_LARCH_64 in setction .eh_frame and not generate dynamic relocation for R_LARCH_32_PCREL. gcc/ChangeLog: * config/loongarch/loongarch.h (ASM_PREFERRED_EH_DATA_FORMAT):

Re: [PATCH v2] loongarch: ignore zero-size fields in calling convention

2022-04-27 Thread Lulu Cheng
I have pushed upstream. Thanks. Lulu Cheng 在 2022/4/27 下午7:45, Xi Ruoyao 写道: On Wed, 2022-04-27 at 14:57 +0800, Lulu Cheng wrote: I think the modification should be below. if (!TYPE_P (TREE_TYPE (f)))     return -1; I think (!TYPE_P (TREE_TYPE (f)) will never

Re: [PATCH v2] loongarch: ignore zero-size fields in calling convention

2022-04-27 Thread Lulu Cheng
OK! 在 2022/4/27 下午7:45, Xi Ruoyao 写道: On Wed, 2022-04-27 at 14:57 +0800, Lulu Cheng wrote: I think the modification should be below. if (!TYPE_P (TREE_TYPE (f)))     return -1; I think (!TYPE_P (TREE_TYPE (f)) will never be true (the code handling calling

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

2022-08-25 Thread Lulu Cheng
在 2022/8/25 下午7:41, Xi Ruoyao 写道: On Thu, 2022-08-25 at 17:12 +0800, Xi Ruoyao via Gcc-patches wrote: On Thu, 2022-08-25 at 16:53 +0800, Lulu Cheng wrote: I think this should add a sentence: "Currently, the identifier name can only be one of small or extreme." I'll add

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

2022-08-25 Thread Lulu Cheng
在 2022/8/24 下午10:12, Xi Ruoyao 写道: On Wed, 2022-08-24 at 22:08 +0800, Xi Ruoyao wrote: v1 -> v2:  * Avoid introduce of SYMBOL_PCREL32, use SYMBOL_PCREL for 32-bit PC    relative.  * Rebase onto a bug fix ([1/2] in the series) to avoid merge conflict.  * Fix missed ChangeLog entries.

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

2022-08-25 Thread Lulu Cheng
在 2022/8/24 下午10:03, Xi Ruoyao 写道: SYMBOL_REF_TLS_MODEL invokes SYMBOL_REF_FLAGS, and SYMBOL_REF_FLAGS invokes RTL_FLAG_CHECK1 and aborts when RTL code is not SYMBOL_REF. r13-1833 removed "gcc_assert (SYMBOL_REF_P (x))" before invoking "SYMBOL_REF_TLS_MODEL (x)", indicating that it's now

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

2022-08-28 Thread Lulu Cheng
LGTM! Thanks. 在 2022/8/24 下午10:09, Xi Ruoyao 写道: If GCC is not built with a working linker for the target (developers occansionally build such a "minimal" GCC for testing and debugging), TLS will be emulated and __tls_get_addr won't be used. Refine those tests depending on __tls_get_addr with

Re: [PATCH v1] LoongArch: Add support code model extreme.

2022-08-18 Thread Lulu Cheng
在 2022/8/18 下午8:52, Xi Ruoyao 写道: On Thu, 2022-08-18 at 19:49 +0800, Lulu Cheng wrote: I think we can ignore the effect of -fplt if code model is extreme, instead of forcing everyone to explicitly add -fno-plt. The "large" code model of x86_64 also does not limit the add

Re: [PATCH v1] LoongArch: Add support code model extreme.

2022-08-18 Thread Lulu Cheng
在 2022/8/18 下午7:37, Xi Ruoyao 写道: + if (opts->x_flag_plt) + error ("code model %qs and %qs not support %s mode", +"tiny-static", "extreme", "plt"); I think we can ignore the effect of -fplt if code model is extreme, instead of forcing everyone to explicitly add

[PATCH v1] LoongArch: Add support code model extreme.

2022-08-18 Thread Lulu Cheng
Use five instructions to calculate a signed 64-bit offset relative to the pc. gcc/ChangeLog: * config/loongarch/loongarch-opts.cc: Allow cmodel to be extreme. * config/loongarch/loongarch.cc (loongarch_call_tls_get_addr): Add extreme support for TLS GD and LD types.

[PATCH v3] LoongArch: Add support code model extreme.

2022-08-19 Thread Lulu Cheng
v1 -> v2: - Modify some description information. - Add options -W[no]extreme-plt, warn about code model extreme not support plt mode, and then disable plt. v2 -> v3: - When -mcmodel=extreme, default set to -fno-plt mode, if the user forces to use '-mcmodel=extreme -fplt', an error will be

[PATCH v4] LoongArch: Add support code model extreme.

2022-08-20 Thread Lulu Cheng
v1 -> v2: - Modify some description information. - Add options -W[no]extreme-plt, warn about code model extreme not support plt mode, and then disable plt. v2 -> v3: - When -mcmodel=extreme, default set to -fno-plt mode, if the user forces to use '-mcmodel=extreme -fplt', an error will be

[PATCH v1] LoongArch: Add new code model 'emdium'.

2022-08-20 Thread Lulu Cheng
The function jump instruction in normal mode is 'bl', so the scope of the function jump is +-128MB. Now we've added support for 'medium' mode, this mode is to complete the function jump through two instructions: pcalau12i + jirl So in this mode the function jump range is increased to

Re: [commited PATCH v4] LoongArch: Add support code model extreme.

2022-08-20 Thread Lulu Cheng
Pushd to r13-2128. 在 2022/8/20 下午4:39, Lulu Cheng 写道: v1 -> v2: - Modify some description information. - Add options -W[no]extreme-plt, warn about code model extreme not support plt mode, and then disable plt. v2 -> v3: - When -mcmodel=extreme, default set to -fno-plt mode, if the user

Re: [PATCH] libsanitizer: enable libubsan and libasan for loongarch64-*-linux*

2022-08-31 Thread Lulu Cheng
OK! Thanks! 在 2022/8/31 下午1:54, Xi Ruoyao 写道: The LoongArch support for libubsan and libasan has been added in: - https://reviews.llvm.org/D129371 - https://reviews.llvm.org/D129418 and we've merged them in r13-2269. It's time to enable them. No unexpected failures in GCC asan.exp and

Re: [PATCH v2] LoongArch: Fix pr106828 by define hook TARGET_ASAN_SHADOW_OFFSET in loongarch backend.

2022-09-07 Thread Lulu Cheng
Sorry, I will correct this typo. Thanks! 在 2022/9/7 下午5:58, Martin Liška 写道: On 9/7/22 09:39, Lulu Cheng wrote: |+ This value is taken from the file libsanitizer/asan/asan_mappint.h. */| s/asan_mappint.h/asan_mapping.h Cheers, Martin

[PATCH v2] LoongArch: Fix pr106828 by define hook TARGET_ASAN_SHADOW_OFFSET in loongarch backend.

2022-09-07 Thread Lulu Cheng
Sorry, asan shadow offset is wrong in v1. In the file asan_mapping.h line 207: #define ASAN_SHADOW_OFFSET_CONST 0x4000 So it's should be 1<<46. gcc/ChangeLog: PR target/106828 * config/loongarch/loongarch.cc

[PATCH] LoongArch: Fix pr106828 by define hook TARGET_ASAN_SHADOW_OFFSET in loongarch backend.

2022-09-07 Thread Lulu Cheng
gcc/ChangeLog: PR target/106828 * config/loongarch/loongarch.cc (loongarch_asan_shadow_offset): New. (TARGET_ASAN_SHADOW_OFFSET): New. gcc/testsuite/ChangeLog: PR target/106828 * g++.target/loongarch/pr106828.C: New test. ---

Re: [commited PATCH v2] LoongArch: Fix pr106828 by define hook TARGET_ASAN_SHADOW_OFFSET in loongarch backend.

2022-09-07 Thread Lulu Cheng
在 2022/9/7 下午4:02, Xi Ruoyao 写道: On Wed, 2022-09-07 at 15:39 +0800, Lulu Cheng wrote: Sorry, asan shadow offset is wrong in v1. In the file asan_mapping.h line 207: #    define ASAN_SHADOW_OFFSET_CONST 0x4000 So it's should be 1<<46. LGTM. I forgot to i

Re: [PATCH] LoongArch: add -mdirect-extern-access option

2022-09-03 Thread Lulu Cheng
I think the following modification should be added: git diff loongarch/predicates.md +;; Do not use GOT to access external symbols, when define +;; TARGET_DIRECT_EXTERN_ACCESS. +  (define_predicate "is_const_call_local_symbol"    (and (match_operand 0 "const_call_insn_operand")     (ior

Re: [PATCH] LoongArch: add -mdirect-extern-access option

2022-09-04 Thread Lulu Cheng
在 2022/9/4 下午2:35, Xi Ruoyao 写道: On Sun, 2022-09-04 at 11:22 +0800, Lulu Cheng wrote: 在 2022/9/4 上午10:51, Xi Ruoyao 写道: On Sun, 2022-09-04 at 10:26 +0800, Lulu Cheng wrote: If the above modifications are not added, the function call is:  bl %plt(test1) now is :  bl test1

Re: [PATCH] LoongArch: add -mdirect-extern-access option

2022-09-03 Thread Lulu Cheng
在 2022/9/4 上午10:51, Xi Ruoyao 写道: On Sun, 2022-09-04 at 10:26 +0800, Lulu Cheng wrote: If the above modifications are not added, the function call is:  bl %plt(test1) now is :  bl test1 Regarding "%plt(...)", in the binutils code: /* For compatible old asm code. */

Re: [PATCH v2] LoongArch: add -mdirect-extern-access option

2022-09-04 Thread Lulu Cheng
LGTM! Thanks! 在 2022/9/4 下午9:18, Xi Ruoyao 写道: v1 -> v2: Move TARGET_DIRECT_EXTERN_ACCESS check from loongarch_classify_symbol to loongarch_symbol_binds_local_p, so "%plt" is not output if -mdirect-extern-access used. -- >8 -- As a new target, LoongArch does not use copy relocation as it's

Re: LoongArch: add model attribute

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

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

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

[PATCH v2] LoongArch: Add support code model extreme.

2022-08-18 Thread Lulu Cheng
v1 -> v2: - Modify some description information. - Add options -W[no]extreme-plt, warn about code model extreme not support plt mode, and then disable plt. --- Use five instructions to calculate a signed 64-bit offset relative to the pc. gcc/ChangeLog:

Re: [PATCH] LoongArch: Use UNSPEC for fmin/fmax RTL pattern [PR105414]

2022-09-28 Thread Lulu Cheng
I have no problem. Thanks. 在 2022/9/24 下午8:47, Xi Ruoyao 写道: I made a mistake defining fmin/fmax RTL patterns in r13-2085: I used smin and smax in the definition mistakenly. This causes the optimizer to perform constant folding as if fmin/fmax was "really" smin/smax operations even with

Re: [PATCH] LoongArch: Add prefetch instruction

2022-09-28 Thread Lulu Cheng
Hi, My colleague is testing the performance data of prefetch and prefetchx. And will submit both supports together if there is no problem. 在 2022/9/25 下午7:25, Xi Ruoyao 写道: The test pr106397.c fails on LoongArch because we don't have defined prefetch instruction. We can silence the test for

Re: [commited PATCH] LoongArch: Libitm add LoongArch support.

2022-09-28 Thread Lulu Cheng
在 2022/9/26 上午10:05, Lulu Cheng 写道: Co-Authored-By: Yang Yujie libitm/ChangeLog: * configure.tgt: Add loongarch support. * config/loongarch/asm.h: New file. * config/loongarch/sjlj.S: New file. * config/loongarch/target.h: New file. Pushed to r13-2910.

Re: [PATCH v2] LoongArch: Libvtv add loongarch support.

2022-09-28 Thread Lulu Cheng
在 2022/9/27 下午7:44, Xi Ruoyao 写道: On Tue, 2022-09-27 at 15:49 +0800, Lulu Cheng wrote:  #if defined (__CYGWIN__) || defined (__MINGW32__)    if (VTV_PAGE_SIZE != sysconf_SC_PAGE_SIZE()) +#elif defined (__loongarch_lp64) +  /* I think that under the LoongArch 64-bit system, VTV_PAGE_SIZE

Re: [PATCH] LoongArch: Libvtv add LoongArch support.

2022-09-26 Thread Lulu Cheng
see where this macro is used, is there something wrong with my understanding? 在 2022/9/26 下午1:38, Xi Ruoyao 写道: On Mon, 2022-09-26 at 10:00 +0800, Lulu Cheng wrote: Co-Authored-By: qijingwen include/ChangeLog: * vtv-change-permission.h (defined): (VTV_PAGE_SIZE): 16k p

Re: [PATCH] Libvtv-test: Fix the problem that scansarif.exp cannot be found in libvtv regression test.

2022-09-26 Thread Lulu Cheng
Sorry, I will try to avoid this problem in the future. 在 2022/9/27 上午11:30, WANG Xuerui 写道: On 2022/9/27 11:16, Lulu Cheng wrote: r13-967 add ARRIF output format. However libvtv does not add support. "SARIF support was added in r13-967 but libvtv wasn't updated." (Tip: alway

Re: [PATCH] LoongArch: Pass cache information to optimizer

2022-09-26 Thread Lulu Cheng
在 2022/9/27 上午11:16, Xi Ruoyao 写道: On Mon, 2022-09-26 at 15:04 +0800, Lulu Cheng wrote: This change may have to wait for the test results to determine whether to merge. With this patch and my other pending patches - https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602172.html - https

[PATCH v2] Libvtv-test: Fix bug that scansarif.exp cannot be found in libvtv regression test.

2022-09-27 Thread Lulu Cheng
SARIF support was added in r13-967 but libvtv wasn't updated. libvtv/ChangeLog: * testsuite/lib/libvtv-dg.exp: Add load_gcc_lib of scansarif.exp. --- libvtv/testsuite/lib/libvtv-dg.exp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libvtv/testsuite/lib/libvtv-dg.exp

[PATCH] Libvtv-test: Fix the problem that scansarif.exp cannot be found in libvtv regression test.

2022-09-26 Thread Lulu Cheng
r13-967 add ARRIF output format. However libvtv does not add support. commit 6cf276ddf22066af780335cd0072d2c27aabe468 Author: David Malcolm Date: Thu Jun 2 15:40:22 2022 -0400 diagnostics: add SARIF output format libvtv/ChangeLog: *

[PATCH v2] LoongArch: Libvtv add loongarch support.

2022-09-27 Thread Lulu Cheng
v1 - > v2: 1. When the macro __loongarch_lp64 is defined, the VTV_PAGE_SIZE is set to 64K. 2. In the vtv_malloc.cc file __vtv_malloc_init function, it does not check whether VTV_PAGE_SIZE is equal to the system page size, if the macro __loongarch_lp64 is defined. All regression tests of

[PATCH v1 1/2] LoongArch: Optimize immediate load.

2022-10-29 Thread Lulu Cheng
Fixed an issue where the compiler would not take four 64-bit immediate load instructions out of the loop. gcc/ChangeLog: * config/loongarch/constraints.md (x): New constraint. * config/loongarch/loongarch.cc (struct loongarch_integer_op): Define a new member curr_value,

[PATCH v1 0/2] Optimize immediate load. Add prefetch insns.

2022-10-29 Thread Lulu Cheng
.html) 2. Add prefetch insns. *** BLURB HERE *** Lulu Cheng (2): LoongArch: Optimize immediate load. LoongArch: Add prefetch insns. gcc/config/loongarch/constraints.md | 7 +- gcc/config/loongarch/loongarch-def.c | 2 + gcc/config/loongarch/loongarch-protos.h | 1

[PATCH v1 2/2] LoongArch: Add prefetch insns.

2022-10-29 Thread Lulu Cheng
Co-Authored-By: xujiahao gcc/ChangeLog: * config/loongarch/loongarch-def.c: Initial number of parallel prefetch. * config/loongarch/loongarch-protos.h (loongarch_prefetch_cookie): Function declaration. * config/loongarch/loongarch-tune.h (struct loongarch_cache):

[PATCH v4] Libvtv: Add loongarch support.

2022-10-29 Thread Lulu Cheng
v1 - > v2: 1. When the macro __loongarch_lp64 is defined, the VTV_PAGE_SIZE is set to 64K. 2. In the vtv_malloc.cc file __vtv_malloc_init function, it does not check whether VTV_PAGE_SIZE is equal to the system page size, if the macro __loongarch_lp64 is defined. v2 -> v3: Set

Re: [PATCH v1 2/2] LoongArch: Add prefetch insns.

2022-10-29 Thread Lulu Cheng
Sorry for the problem in this patch. I will send it again after modification. 在 2022/10/29 下午3:05, Lulu Cheng 写道: Co-Authored-By: xujiahao gcc/ChangeLog: * config/loongarch/loongarch-def.c: Initial number of parallel prefetch. * config/loongarch/loongarch-protos.h

  1   2   3   4   >