[Bug target/111403] LoongArch: Wrong code with -O -mlasx -fopenmp-simd

2024-01-31 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111403

--- Comment #8 from Chenghui Pan  ---
(In reply to Xi Ruoyao from comment #4)
> After r14-5545 this issue became latent.
> 
> And at some point before r14-5545 this issue became nondeterministic: a
> compiled program *sometimes* crashes.  Really strange...

After applying this commit, GCC does not apply loop peeling while processing
the openmp reduction directive, which I think is the spawn point of the
problematic codes (According to Guo Jie's sample).

[Bug target/111424] LoongArch: Enable vect test suite

2023-10-12 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111424

--- Comment #3 from Chenghui Pan  ---
vect.exp is enabled in master branch for now, but there's some
check_effective_target procs in gcc/testsuite/lib/target-supports.exp that
seems need modifying for enabling more vectorization tests.

[Bug target/111424] LoongArch: Enable vect test suite

2023-09-17 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111424

--- Comment #1 from Chenghui Pan  ---
I also addressed some failed testcases with -mlsx/-mlasx enabled and try to
resolve them by adding dg-options and etc. or editing target-supports.exp to
append loongarch directives. (May submit to maillist later). 
Bug 111403's problem is a little complicated and still under investigation...

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #10 from Chenghui Pan  ---
(In reply to Stefan Schulze Frielinghaus from comment #9)
> Thanks for the reproducer and sorry for the hassle.
> 
> The normal form of a constant for a mode with fewer bits than in
> HOST_WIDE_INT is a sign extended version of the original constant.  This
> even holds for unsigned constants which I missed.  The following should fix
> this:
> 
> diff --git a/gcc/combine.cc b/gcc/combine.cc
> index e46d202d0a7..9e5bf96a09d 100644
> --- a/gcc/combine.cc
> +++ b/gcc/combine.cc
> @@ -12059,7 +12059,7 @@ simplify_compare_const (enum rtx_code code,
> machine_mode mode,
>: (GET_MODE_SIZE (int_mode)
>   - GET_MODE_SIZE (narrow_mode_iter)));
>   *pop0 = adjust_address_nv (op0, narrow_mode_iter, offset);
> - *pop1 = GEN_INT (n);
> + *pop1 = gen_int_mode (n, narrow_mode_iter);
>   return adjusted_code;
> }
>  }
> 
> Can you give this a try?

Bootstrapping is successful with this, thank you!

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #8 from Chenghui Pan  ---
(In reply to Stefan Schulze Frielinghaus from comment #6)
> I tried to reproduce it with a cross compiler while using the reproducer
> from PR110867 without getting an ICE.  Can you attach a pre processed source
> file and a corresponding gcc invocation?

I attach the a preprocessed file that ICE happening when bootstrapping. Sorry
for not adding it at first. 

The command that uses to compile this file is:
/home/panchenghui/upstream-unmodded/stuff/gcc/./prev-gcc/xg++ -save-temps
-B/home/panchenghui/upstream-unmodded/stuff/gcc/./prev-gcc/
-B/home/panchenghui/upstream-unmodded/install/loongarch64-unknown-linux-gnu/bin/
-nostdinc++
-B/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/src/.libs
-B/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs

-I/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/include/loongarch64-unknown-linux-gnu

-I/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/include
 -I/home/panchenghui/upstream-unmodded/gcc/libstdc++-v3/libsupc++
-L/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/src/.libs
-L/home/panchenghui/upstream-unmodded/stuff/gcc/prev-loongarch64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
 -fno-PIE -c   -g -O2 -fno-checking -gtoggle -DIN_GCC-fno-exceptions
-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Wconditionally-supported
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -fno-PIE -I. -I.
-I/home/panchenghui/upstream-unmodded/gcc/gcc
-I/home/panchenghui/upstream-unmodded/gcc/gcc/.
-I/home/panchenghui/upstream-unmodded/gcc/gcc/../include 
-I/home/panchenghui/upstream-unmodded/gcc/gcc/../libcpp/include
-I/home/panchenghui/upstream-unmodded/gcc/gcc/../libcody 
-I/home/panchenghui/upstream-unmodded/gcc/gcc/../libdecnumber
-I/home/panchenghui/upstream-unmodded/gcc/gcc/../libdecnumber/dpd
-I../libdecnumber -I/home/panchenghui/upstream-unmodded/gcc/gcc/../libbacktrace
  -o tree-cfgcleanup.o -MT tree-cfgcleanup.o -MMD -MP -MF
./.deps/tree-cfgcleanup.TPo
/home/panchenghui/upstream-unmodded/gcc/gcc/tree-cfgcleanup.cc

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #7 from Chenghui Pan  ---
Created attachment 55706
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55706=edit
preprocessed file of gcc/tree-cfgcleanup.cc, ICE occurred in this place.

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #4 from Chenghui Pan  ---
(In reply to Richard Biener from comment #1)
> I think this was reported before (and fixed by r14-2932-g41ef5a34161356). 
> Can you try again with updated GCC?

I still get the exact same ICE message with updated GCC. (The commit I use for
now is 25c4b1620ebc10fceabd86a34fdbbaf8037e7e82, with same configure options.)

[Bug rtl-optimization/110939] [14 Regression] 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-08 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

--- Comment #2 from Chenghui Pan  ---
(In reply to Richard Biener from comment #1)
> I think this was reported before (and fixed by r14-2932-g41ef5a34161356). 
> Can you try again with updated GCC?

Ok, I clone a new copy of codes and is bootstrapping on loongarch64 now.

[Bug bootstrap/110939] New: 14.0 ICE at rtl.h:2297 while bootstrapping on loongarch64

2023-08-07 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939

Bug ID: 110939
   Summary: 14.0 ICE at rtl.h:2297 while bootstrapping on
loongarch64
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: bootstrap
  Assignee: unassigned at gcc dot gnu.org
  Reporter: panchenghui at loongson dot cn
  Target Milestone: ---

since commit 7cdd0860949c6c3232e6cff1d7ca37bb5234074c, I get ICE at rtl.h:2297
when I try to bootstrap on loongarch64. 
I have seen the similar case in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 and try to build with the
latest commits in master branch but the problem still exists.

Configure:
../gcc/configure --prefix=/home/panchenghui/upstream-unmodded/build/install
--disable-libsanitizer --disable-gcov --disable-multilib

ICE output:
during RTL pass: combine
/home/panchenghui/upstream-unmodded/gcc/gcc/tree-cfgcleanup.cc: In function
'bool want_merge_blocks_p(basic_block, basic_block)':
/home/panchenghui/upstream-unmodded/gcc/gcc/tree-cfgcleanup.cc:761:1: internal
compiler error: in decompose, at rtl.h:2297
  761 | }
  | ^
0x1210c7997 wi::int_traits
>::decompose(long*, unsigned int, std::pair const&)
/home/panchenghui/upstream-unmodded/gcc/gcc/rtl.h:2297
0x1211478cb wide_int_ref_storage::wide_int_ref_storage
>(std::pair const&)
/home/panchenghui/upstream-unmodded/gcc/gcc/wide-int.h:1030
0x121146bab generic_wide_int
>::generic_wide_int >(std::pair const&)
/home/panchenghui/upstream-unmodded/gcc/gcc/wide-int.h:788
0x12177d13b simplify_const_unary_operation(rtx_code, machine_mode, rtx_def*,
machine_mode)
/home/panchenghui/upstream-unmodded/gcc/gcc/simplify-rtx.cc:2131
0x1217774e7 simplify_context::simplify_unary_operation(rtx_code, machine_mode,
rtx_def*, machine_mode)
/home/panchenghui/upstream-unmodded/gcc/gcc/simplify-rtx.cc:889
0x12177568f simplify_context::simplify_gen_unary(rtx_code, machine_mode,
rtx_def*, machine_mode)
/home/panchenghui/upstream-unmodded/gcc/gcc/simplify-rtx.cc:360
0x120f6e79f simplify_gen_unary(rtx_code, machine_mode, rtx_def*, machine_mode)
/home/panchenghui/upstream-unmodded/gcc/gcc/rtl.h:3520
0x12227818b simplify_comparison
/home/panchenghui/upstream-unmodded/gcc/gcc/combine.cc:13129
0x1222607c7 combine_simplify_rtx
/home/panchenghui/upstream-unmodded/gcc/gcc/combine.cc:6176
0x12225e30f subst
/home/panchenghui/upstream-unmodded/gcc/gcc/combine.cc:5609
0x12225df23 subst
/home/panchenghui/upstream-unmodded/gcc/gcc/combine.cc:5536
0x12225df23 subst
/home/panchenghui/upstream-unmodded/gcc/gcc/combine.cc:5536
0x122256ac7 try_combine
/home/panchenghui/upstream-unmodded/gcc/gcc/combine.cc:3369
0x1222506fb combine_instructions
/home/panchenghui/upstream-unmodded/gcc/gcc/combine.cc:1357
0x12227da6b rest_of_handle_combine
/home/panchenghui/upstream-unmodded/gcc/gcc/combine.cc:15063
0x12227db83 execute
/home/panchenghui/upstream-unmodded/gcc/gcc/combine.cc:15107