Skip to content

LA: rework atomic implemention #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 39 commits into from

Conversation

mips-hp
Copy link

@mips-hp mips-hp commented Oct 19, 2021

No description provided.

chenglulu326 and others added 30 commits July 29, 2021 17:29
	* config.gcc: Add LoongArch tuples.
	* config.host: Likewise.
	* config/host-linux.c: Likewise.
	* configure: Likewise.
	* configure.ac: Likewise.
	* common/config/loongarch/loongarch-common.c: New file.
	* config/loongarch/constraints.md: Likewise.
	* config/loongarch/driver-native.c: Likewise.
	* config/loongarch/generic.md: Likewise.
	* config/loongarch/genopt.sh: Likewise.
	* config/loongarch/gnu-user.h: Likewise.
	* config/loongarch/gs464v.md: Likewise.
	* config/loongarch/larchintrin.h: Likewise.
	* config/loongarch/linux.h: Likewise.
	* config/loongarch/loongarch-builtins.c: Likewise.
	* config/loongarch/loongarch-c.c: Likewise.
	* config/loongarch/loongarch-cpus.def: Likewise.
	* config/loongarch/loongarch-ftypes.def: Likewise.
	* config/loongarch/loongarch-modes.def: Likewise.
	* config/loongarch/loongarch-opts.h: Likewise.
	* config/loongarch/loongarch-protos.h: Likewise.
	* config/loongarch/loongarch-tables.opt: Likewise.
	* config/loongarch/loongarch.c: Likewise.
	* config/loongarch/loongarch.h: Likewise.
	* config/loongarch/loongarch.md: Likewise.
	* config/loongarch/loongarch.opt: Likewise.
	* config/loongarch/predicates.md: Likewise.
	* config/loongarch/sync.md: Likewise.
	* config/loongarch/t-linux: Likewise.
	* config/loongarch/t-loongarch: Likewise.
	* config/loongarch/x-native: Likewise.
	* config.host: Add LoongArch tuples.
	* configure: Likewise.
	* configure.ac: Likewise.
	* config/loongarch/crtfastmath.c: New file.
	* config/loongarch/crti.S: Likewise.
	* config/loongarch/crtn.S: Likewise.
	* config/loongarch/lib2funcs.c: Likewise.
	* config/loongarch/linux-unwind.h: Likewise.
	* config/loongarch/sfp-machine.h: Likewise.
	* config/loongarch/t-crtstuff: Likewise.
	* config/loongarch/t-elf: Likewise.
	* config/loongarch/t-loongarch: Likewise.
	* config/loongarch/t-loongarch64: Likewise.
	* config/loongarch/t-softfp-tf: Likewise.
	* configure.tgt:  Add LoongArch tuple.
	* lib/target-supports.exp: Define the LoongArch target.
	* g++.dg/cpp0x/constexpr-rom.C: Skip on LoongArch.
	* g++.old-deja/g++.abi/ptrmem.C: Likewise.
	* gcc.dg/loop-8.c: Likewise.
	* gcc.dg/torture/stackalign/builtin-apply-2.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-3.c: Likewise.
	* g++.old-deja/g++.pt/ptrmem6.C: Add support LoongArch.
	* gcc.dg/20020312-2.c: Likewise.
	* gcc.target/loongarch/loongarch.exp: New file.
	* gcc.target/loongarch/tst-asm-const.c: Likewise.
	* config/picflag.m4: Add LoongArch tuples.
	* configure: Likewise.
	* configure.ac: Likewise.
    gcc/
    * config/loongarch/loongarch-builtins.c: Code style.
    * config/loongarch/loongarch.c: Likewise.
    * config/loongarch/loongarch.md: Likewise
	gcc/config/loongarch
	* loongarch-cpus.def: Modify the value of ISA in loongarch_cpu_info_table.
Also add helpful error messages.

    gcc/
    * config.gcc: Modify LoongArch config.
…e use of the resolver attribute.

	gcc/
	config.gcc: Indirect function support.
	gcc/
	* config.gcc: Removed '-march=loongarch'.

	gcc/config/loongarch/
	* loongarch-cpus.def:
	* loongarch-tables.opt: add PROCESSOR_LOONGARCH32.
	* loongarch.c: Likewise.
	* loongarch.md: Likewise.
	gcc/config/loongarch
	* loongarch.c: attribute interrupt.
Co-authored-by: WÁNG Xuěruì <1175567+xen0n@users.noreply.github.com>
Co-authored-by: WÁNG Xuěruì <1175567+xen0n@users.noreply.github.com>
…ls'.

	gcc/config/loongarch:
	* loongarch.c: Delete hook TARGET_MACHINE_DEPENDENT_REORG.
	* loongarch.opt: Delete mrelax-pic-calls.
	gcc/config/loongarch:
	* loongarch-c.c: Delete no-float support.
	* loongarch.c: Likewise.
	* loongarch.opt: Likewise.
	gcc/config/loongarch/
	* loongarch.c: Remove some unused code.
	gcc/config/loongarch/
	* loongarch.c: Change movmemsi to cpymemsi.
	* loongarch.h: Likewise.
	* loongarch.md: Likewise.
Commit message shamelessly copied from 1777beb by jakub:

This function, because it is sometimes called even outside of function
bodies, uses create_tmp_var_raw rather than create_tmp_var.  But in order
for that to work, when first referenced, the VAR_DECLs need to appear in a
TARGET_EXPR so that during gimplification the var gets the right
DECL_CONTEXT and is added to local decls.

gcc/

	* config/loongarch/loongarch-builtins.c: Use TARGET_EXPR instead
	  of MODIFY_EXPR.
	* gcc/common/config/loongarch/loongarch-common.c:
	  Added to compile parameter '-mmemcpy' processing
	* gcc/config.gcc: Add arch gs464v support.

	gcc/config/loongarch/
	* gnu-user.h: Delete LINUX_DRIVER_SELF_SPECS.
	* loongarch-cpus.def: Modify gs464v's isa from 0 to 2.
	* loongarch-opts.h:
	* loongarch.c: Reimplementing handlers loongarch_option_override.
	* loongarch.h: Delete BASE_DRIVER_SELF_SPECS.
	* loongarch.opt: Define loongarch_isa_flags.
	gcc/config/loongarch/
	* loongarch-protos.h: Delete some unused codes.
	* loongarch.c: Likewise.
	* loongarch.h: Likewise.
	* loongarch.md: Likewise.
	* predicates.md: Likewise.
	gcc/config/loongarch/
	* loongarch.c: Remove DBX support.
	* loongarch.h: Likewise.
	* gcc/config.gcc: Remove loongarch32 support.

	gcc/config/loongarch/
	* larchintrin.h: Remove loongarch32 support.
	* loongarch-c.c: Likewise.
	* loongarch-cpus.def: Likewise.
	* loongarch-tables.opt: Likewise.
	* loongarch.c: Likewise.
	* loongarch.h: Likewise.
	* loongarch.md: Likewise.
	* loongarch.opt: Likewise.
	libgcc/config/loongarch/
	* linux-unwind.h: Replace 'struct _sig_ucontext_t' with 'struct ucontext_t'.
     gcc/
     * config.gcc: Revised '--with' handling logic.
     * config.host: Likewise.

     gcc/config/loongarch/
     * driver-native.c: Removed.
     * gnu-user.h: Reorganized .h definitions for readability.
     * linux.h: Likewise.
     * loongarch.h: Likewise.
     * loongarch-opts.c: Revised '-m' handling logic.
     * loongarch-opts.h: Likewise.
     * loongarch.opt: Likewise
     * loongarch-driver.c: Likewise.
     * loongarch-driver.h: Likewise.
     * loongarch.c: Likewise.
     * t-loongarch: Likewise.
     * x-native: Likewise, removed.
     * genopt.sh: Likewise, removed.
     * loongarch-cpus.c: Made processor property tables mostly static.
     * loongarch-cpus.h:  Likewise.
     * loongarch-rtx-cost.h: Likewise.
     * loongarch-cpus.def: Likewise, Removed.
     * loongarch-tables.opt: Likeise, Removed.
     * gs464v.md: Replaced condition macros.
     * loongarch-c.c: Likewise.
     * loongarch.md: Likewise.
     * t-linux: Added basic multilib support (int/fp ABI).
chenglulu326 and others added 9 commits October 8, 2021 09:27
        commit 9069e94
        Author: Kito Cheng <kito.cheng@sifive.com>
        Date:   Mon Feb 24 10:54:21 2020 -0600

        RISC-V: Adjust floating point code gen for LTGT compare

        - Using gcc.dg/torture/pr91323.c as testcase, so no new testcase
          introduced.
        - According latest GCC document LTGT and discussion on pr91323
          LTGT should signals on NaNs, like GE/GT/LE/LT.
        - So we expand (LTGT a b) to ((LT a b) | (GT a b)) for fit the document.

        gcc/config/loongarch/
        * loongarch.md: Change the code gen for LTGT.
Rationales:

1. No upstreamed GCC ports use "native" as the default.  I don't think
   the upstream will accept this.
2. Using "native" as the default can cause severe trouble for distro
   maintainers.
3. Explicitly setting --with-arch=native when cross compiling actually
   *makes* sense: you can use a cross compiler (A) to cross compile a
   native compiler (B) for loongarch64 which uses -march=native by
   default.  Compiler B runs on loongarch64 so it can detect the
   loongarch64 CPU feature at runtime.  OTOH, the cross compiler, A,
   can't use -march=native because it generally does not run on a
   loongarch64 CPU.

gcc/

	* config.gcc: Use loongarch64 instead of native as the default
	  --with-arch setting.  And, accept --with-arch=native while
	  cross compiling, but reject it for cross compiler.
…get triplet.

    gcc/
    * config.gcc: Use loongarch64 instead of native as the default
    --with-arch setting.
    gcc/config/loongarch
    * loongarch-driver.c: print a message if the current ABI
      and library/startfile search path do not match.
	gcc/
	* config/loongarch/loongarch-protos.h:
          Modify loongarch_output_probe_stack_range declarations.
	* config/loongarch/lloongarch.c
	  (loongarch_emit_probe_stack_range): Fix the condition for stack
  	  probe loop unrolling, to avoid a dead loop causing segfault.
	* config/loongarch/lloongarch.h: Define LARCH_PROLOGUE_TEMP3_REGNUM.
	* config/loongarch/lloongarch.md
  	  (probe_stack_range_<P:mode>): Add an input operand.
    gcc/config/loongarch/
    * loongarch.h: modified ASM_SPEC to include "%{mfloat-abi=*}".
	+. change style.

	+. use hint 0x700 in dbar for future extension.

	+. add shortcut for dbar when ll.*/sc.* pair succeed, so
	remove TARGET_FIX_LOONGSON3_LLSC
@mips-hp mips-hp closed this Oct 19, 2021
xen0n pushed a commit to xen0n/gcc that referenced this pull request Nov 27, 2021
* LoongArch: conform to LoongArch toolchain conventions.

* LoongArch: toolchain convention conformance fix (patch 2)

* LoongArch: toolchain convention conformance fix (patch 3)

* Update loongarch.h

* LoongArch: edit GCC documentation for command-line arguments.

* fix coding style.

* Update linux.h

* bug fix: allow native-FPU configuration.

* modify code style.

* documents the "configure" interface for loongarch.

* modify code style (patch 2).

Co-authored-by: Yang Yujie <yangyujie@loongson.cn>
Co-authored-by: ChengLulu <88083425+chenglulu326@users.noreply.github.com>
hubot pushed a commit that referenced this pull request Apr 8, 2024
In PR 113907 comment #58, Honza found a case where ICF thinks bodies
of functions are equivalent but becaise of difference in aliases in a
memory access, different aggregate jump functions are associated with
supposedly equivalent call statements.  This patch adds a way to
compare jump functions and plugs it into ICF to avoid the issue.

gcc/ChangeLog:

2024-03-20  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113907
	* ipa-prop.h (class ipa_vr): Declare new overload of a member function
	equal_p.
	(ipa_jump_functions_equivalent_p): Declare.
	* ipa-prop.cc (ipa_vr::equal_p): New function.
	(ipa_agg_pass_through_jf_equivalent_p): Likewise.
	(ipa_agg_jump_functions_equivalent_p): Likewise.
	(ipa_jump_functions_equivalent_p): Likewise.
	* ipa-cp.h (values_equal_for_ipcp_p): Declare.
	* ipa-cp.cc (values_equal_for_ipcp_p): Make function public.
	* ipa-icf-gimple.cc: Include alloc-pool.h, symbol-summary.h, sreal.h,
	ipa-cp.h and ipa-prop.h.
	(func_checker::compare_gimple_call): Comapre jump functions.

gcc/testsuite/ChangeLog:

2024-03-20  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113907
	* gcc.dg/lto/pr113907_0.c: New.
	* gcc.dg/lto/pr113907_1.c: Likewise.
	* gcc.dg/lto/pr113907_2.c: Likewise.
hubot pushed a commit that referenced this pull request May 7, 2024
vsetvli local eliminate is only consider the current demand instead of
full demand, and it will use that incomplete info to remove vsetvli.

Give following example from PR114747:

vsetvli a5,a1,e8,m4,ta,mu       # 57, ratio=2, sew=8, lmul=4
vsetvli zero,a5,e16,m8,ta,ma    # 58, ratio=2, sew=16, lmul=8
vle8.v  v8,0(a0)        # 13, demand ratio=2
vzext.vf2       v24,v8  # 14, demand sew=16 and lmul=8

Insn #58 will removed because #57 has satisfied demand of #13, but it's
not consider #14.

It should doing more demand analyze, but this bug only present in GCC 13
branch, and we should not change too much on this release branch, so the best
way is make the check more conservative - remove only if the target
vsetvl_discard_result having same SEW and LMUL as the source vsetvli.

gcc/ChangeLog:

	PR target/114747
	* config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn):
	Check target vsetvl_discard_result and source vsetvli has same
	SEW and LMUL.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/pr114747.c: New.
hubot pushed a commit that referenced this pull request May 14, 2024
This is a manual backport of r14-9840-g1162861439fd3c from master.
Manual because the bits and value range representation in jump
functions have changes during the gcc 14 development cycle.

In PR 113907 comment #58, Honza found a case where ICF thinks bodies
of functions are equivalent but becaise of difference in aliases in a
memory access, different aggregate jump functions are associated with
supposedly equivalent call statements.  This patch adds a way to
compare jump functions and plugs it into ICF to avoid the issue.

gcc/ChangeLog:

2024-05-14  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113907
	* ipa-prop.h (ipa_jump_functions_equivalent_p): Declare.
	(values_equal_for_ipcp_p): Likewise.
	* ipa-prop.cc (ipa_agg_pass_through_jf_equivalent_p): New function.
	(ipa_agg_jump_functions_equivalent_p): Likewise.
	(ipa_jump_functions_equivalent_p): Likewise.
	* ipa-cp.cc (values_equal_for_ipcp_p): Make function public.
	* ipa-icf-gimple.cc: Include alloc-pool.h, symbol-summary.h, sreal.h,
	ipa-cp.h and ipa-prop.h.
	(func_checker::compare_gimple_call): Comapre jump functions.

gcc/testsuite/ChangeLog:

2024-05-10  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113907
	* gcc.dg/lto/pr113907_0.c: New.
	* gcc.dg/lto/pr113907_1.c: Likewise.
	* gcc.dg/lto/pr113907_2.c: Likewise.
Frosty515 pushed a commit to FrostyOS-dev/gcc that referenced this pull request May 23, 2024
vsetvli local eliminate is only consider the current demand instead of
full demand, and it will use that incomplete info to remove vsetvli.

Give following example from PR114747:

vsetvli a5,a1,e8,m4,ta,mu       # 57, ratio=2, sew=8, lmul=4
vsetvli zero,a5,e16,m8,ta,ma    # 58, ratio=2, sew=16, lmul=8
vle8.v  v8,0(a0)        # 13, demand ratio=2
vzext.vf2       v24,v8  # 14, demand sew=16 and lmul=8

Insn gcc-mirror#58 will removed because gcc-mirror#57 has satisfied demand of gcc-mirror#13, but it's
not consider gcc-mirror#14.

It should doing more demand analyze, but this bug only present in GCC 13
branch, and we should not change too much on this release branch, so the best
way is make the check more conservative - remove only if the target
vsetvl_discard_result having same SEW and LMUL as the source vsetvli.

gcc/ChangeLog:

	PR target/114747
	* config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn):
	Check target vsetvl_discard_result and source vsetvli has same
	SEW and LMUL.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/pr114747.c: New.
Frosty515 pushed a commit to FrostyOS-dev/gcc that referenced this pull request May 23, 2024
This is a manual backport of r14-9840-g1162861439fd3c from master.
Manual because the bits and value range representation in jump
functions have changes during the gcc 14 development cycle.

In PR 113907 comment gcc-mirror#58, Honza found a case where ICF thinks bodies
of functions are equivalent but becaise of difference in aliases in a
memory access, different aggregate jump functions are associated with
supposedly equivalent call statements.  This patch adds a way to
compare jump functions and plugs it into ICF to avoid the issue.

gcc/ChangeLog:

2024-05-14  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113907
	* ipa-prop.h (ipa_jump_functions_equivalent_p): Declare.
	(values_equal_for_ipcp_p): Likewise.
	* ipa-prop.cc (ipa_agg_pass_through_jf_equivalent_p): New function.
	(ipa_agg_jump_functions_equivalent_p): Likewise.
	(ipa_jump_functions_equivalent_p): Likewise.
	* ipa-cp.cc (values_equal_for_ipcp_p): Make function public.
	* ipa-icf-gimple.cc: Include alloc-pool.h, symbol-summary.h, sreal.h,
	ipa-cp.h and ipa-prop.h.
	(func_checker::compare_gimple_call): Comapre jump functions.

gcc/testsuite/ChangeLog:

2024-05-10  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113907
	* gcc.dg/lto/pr113907_0.c: New.
	* gcc.dg/lto/pr113907_1.c: Likewise.
	* gcc.dg/lto/pr113907_2.c: Likewise.
hubot pushed a commit that referenced this pull request May 28, 2024
This is a manual backport of r14-9840-g1162861439fd3c from master.
Manual because the bits and value range representation in jump
functions have changes during the gcc 14 development cycle.

In PR 113907 comment #58, Honza found a case where ICF thinks bodies
of functions are equivalent but becaise of difference in aliases in a
memory access, different aggregate jump functions are associated with
supposedly equivalent call statements.  This patch adds a way to
compare jump functions and plugs it into ICF to avoid the issue.

gcc/ChangeLog:

2024-05-14  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113907
	* ipa-prop.h (ipa_jump_functions_equivalent_p): Declare.
	(values_equal_for_ipcp_p): Likewise.
	* ipa-prop.cc (ipa_agg_pass_through_jf_equivalent_p): New function.
	(ipa_agg_jump_functions_equivalent_p): Likewise.
	(ipa_jump_functions_equivalent_p): Likewise.
	* ipa-cp.cc (values_equal_for_ipcp_p): Make function public.
	* ipa-icf-gimple.cc: Include alloc-pool.h, symbol-summary.h, sreal.h,
	ipa-cp.h and ipa-prop.h.
	(func_checker::compare_gimple_call): Comapre jump functions.

gcc/testsuite/ChangeLog:

2024-05-10  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113907
	* gcc.dg/lto/pr113907_0.c: New.
	* gcc.dg/lto/pr113907_1.c: Likewise.
	* gcc.dg/lto/pr113907_2.c: Likewise.

(cherry picked from commit 1db45e8)
MBeijer pushed a commit to AmigaPorts/gcc that referenced this pull request Jun 6, 2025
vsetvli local eliminate is only consider the current demand instead of
full demand, and it will use that incomplete info to remove vsetvli.

Give following example from PR114747:

vsetvli a5,a1,e8,m4,ta,mu       # 57, ratio=2, sew=8, lmul=4
vsetvli zero,a5,e16,m8,ta,ma    # 58, ratio=2, sew=16, lmul=8
vle8.v  v8,0(a0)        # 13, demand ratio=2
vzext.vf2       v24,v8  # 14, demand sew=16 and lmul=8

Insn gcc-mirror#58 will removed because gcc-mirror#57 has satisfied demand of gcc-mirror#13, but it's
not consider gcc-mirror#14.

It should doing more demand analyze, but this bug only present in GCC 13
branch, and we should not change too much on this release branch, so the best
way is make the check more conservative - remove only if the target
vsetvl_discard_result having same SEW and LMUL as the source vsetvli.

gcc/ChangeLog:

	PR target/114747
	* config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn):
	Check target vsetvl_discard_result and source vsetvli has same
	SEW and LMUL.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/pr114747.c: New.
MBeijer pushed a commit to AmigaPorts/gcc that referenced this pull request Jun 6, 2025
This is a manual backport of r14-9840-g1162861439fd3c from master.
Manual because the bits and value range representation in jump
functions have changes during the gcc 14 development cycle.

In PR 113907 comment gcc-mirror#58, Honza found a case where ICF thinks bodies
of functions are equivalent but becaise of difference in aliases in a
memory access, different aggregate jump functions are associated with
supposedly equivalent call statements.  This patch adds a way to
compare jump functions and plugs it into ICF to avoid the issue.

gcc/ChangeLog:

2024-05-14  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113907
	* ipa-prop.h (ipa_jump_functions_equivalent_p): Declare.
	(values_equal_for_ipcp_p): Likewise.
	* ipa-prop.cc (ipa_agg_pass_through_jf_equivalent_p): New function.
	(ipa_agg_jump_functions_equivalent_p): Likewise.
	(ipa_jump_functions_equivalent_p): Likewise.
	* ipa-cp.cc (values_equal_for_ipcp_p): Make function public.
	* ipa-icf-gimple.cc: Include alloc-pool.h, symbol-summary.h, sreal.h,
	ipa-cp.h and ipa-prop.h.
	(func_checker::compare_gimple_call): Comapre jump functions.

gcc/testsuite/ChangeLog:

2024-05-10  Martin Jambor  <mjambor@suse.cz>

	PR ipa/113907
	* gcc.dg/lto/pr113907_0.c: New.
	* gcc.dg/lto/pr113907_1.c: Likewise.
	* gcc.dg/lto/pr113907_2.c: Likewise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants