public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/113065] New: [ARM][NEON] Compiler crashes when doing shift on data with NEON intrinsic type
@ 2023-12-18 12:37 clh960524+gcc at gmail dot com
2023-12-18 12:41 ` [Bug c/113065] " clh960524+gcc at gmail dot com
2023-12-18 16:31 ` [Bug target/113065] " acoplan at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: clh960524+gcc at gmail dot com @ 2023-12-18 12:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113065
Bug ID: 113065
Summary: [ARM][NEON] Compiler crashes when doing shift on data
with NEON intrinsic type
Product: gcc
Version: 11.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: clh960524+gcc at gmail dot com
Target Milestone: ---
Created attachment 56900
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56900&action=edit
preprocessor result
Hi developers,
Currently I am working on adding ARMv8-A 32-bit test environment.
However, compiler outputs an internal error when it tries to do shifting on
NEON intrinsic data type.
This bug is confirmed on arm-linux-gnueabihf-gcc version 10.5.0, 11.4.0, and
12.3.0.
For your ease, here is the code to reproduce the issue (test.c):
#include <stddef.h>
#include <arm_neon.h>
#include <arm_acle.h>
#define HEDLEY_STATIC_CAST(T, expr) ((T) (expr))
#define SIMDE_POLY64_TYPE poly64_t
#define SIMDE_POLY64_C(value) (HEDLEY_STATIC_CAST(poly64_t, value ## ull))
typedef SIMDE_POLY64_TYPE simde_poly64;
typedef simde_poly64 simde_poly64_t;
typedef poly128_t simde_poly128_t;
simde_poly128_t
simde_vaddq_p128(simde_poly128_t a, simde_poly128_t b) {
simde_poly128_t mask = 0xFFFFFFFFFFFFFFFFull;
mask = mask << 64;
mask = mask | 0xFFFFFFFFFFFFFFFFull;
return b ^ ((0 ^ a) & mask);
}
static int
simde_assert_equal_p64(simde_poly64 a, simde_poly64 b) {
uint64_t a_ = HEDLEY_STATIC_CAST(uint64_t, a);
uint64_t b_ = HEDLEY_STATIC_CAST(uint64_t, b);
if (a_ != b_) {
return 1;
}
return 0;
}
static int
test_simde_vaddq_p128 () {
struct {
simde_poly64_t a[2];
simde_poly64_t b[2];
simde_poly64_t r[2];
} test_vec[] = {
{ { SIMDE_POLY64_C( 2773134259082670592), SIMDE_POLY64_C(
9031857671464751104) },
{ SIMDE_POLY64_C(15408611317451976704), SIMDE_POLY64_C(
5314471842361763840) },
{ SIMDE_POLY64_C(17557921622677996032), SIMDE_POLY64_C(
3789586984176121856) } },
{ { SIMDE_POLY64_C(14363410812027238400), SIMDE_POLY64_C(
7751777860661664768) },
{ SIMDE_POLY64_C( 4070846577912177664), SIMDE_POLY64_C(
8033403141717473280) },
{ SIMDE_POLY64_C(18386960794487266304), SIMDE_POLY64_C(
355706841938420736) } },
{ { SIMDE_POLY64_C(17019201421568192512), SIMDE_POLY64_C(
9077731670917768192) },
{ SIMDE_POLY64_C( 1093803490337685888),
SIMDE_POLY64_C(12690135020377692160) },
{ SIMDE_POLY64_C(16365414741193798016),
SIMDE_POLY64_C(14836825620528675840) } },
{ { SIMDE_POLY64_C( 8834005665657798656), SIMDE_POLY64_C(
7315692870291161088) },
{ SIMDE_POLY64_C( 3583172236868845568),
SIMDE_POLY64_C(14913079096527761408) },
{ SIMDE_POLY64_C( 5413693383775240192),
SIMDE_POLY64_C(12354334249137418240) } },
{ { SIMDE_POLY64_C(16318651152855345152),
SIMDE_POLY64_C(15283972988033570816) },
{ SIMDE_POLY64_C( 4795255037585536000),
SIMDE_POLY64_C(17815911970323484672) },
{ SIMDE_POLY64_C(11599959615349332992), SIMDE_POLY64_C(
2532502929754736640) } },
{ { SIMDE_POLY64_C(16540936757178476544), SIMDE_POLY64_C(
4596081763017794560) },
{ SIMDE_POLY64_C(15120265319048798208), SIMDE_POLY64_C(
3251201193519464448) },
{ SIMDE_POLY64_C( 3771992723781634048), SIMDE_POLY64_C(
1357279216665519104) } },
{ { SIMDE_POLY64_C( 7991373722374909952),
SIMDE_POLY64_C(17418001980645539840) },
{ SIMDE_POLY64_C( 303154826827825408), SIMDE_POLY64_C(
9983013542091358208) },
{ SIMDE_POLY64_C( 7697238601746657536), SIMDE_POLY64_C(
8877691528758722560) } },
{ { SIMDE_POLY64_C(14668463690243614720), SIMDE_POLY64_C(
4370163632906065408) },
{ SIMDE_POLY64_C( 3236423722687647744), SIMDE_POLY64_C(
6051015495717347328) },
{ SIMDE_POLY64_C(16679868711160412160), SIMDE_POLY64_C(
8024418529387197952) } },
};
for (size_t i = 0 ; i < (sizeof(test_vec) / sizeof(test_vec[0])) ; i++) {
simde_poly128_t a = test_vec[i].a[0];
simde_poly128_t b = test_vec[i].b[0];
simde_poly128_t r, mask;
simde_poly64_t top_r, bottom_r;
a = a << 64;
a = a | test_vec[i].a[1];
b = b << 64;
b = b | test_vec[i].b[1];
r = simde_vaddq_p128(a, b);
mask = HEDLEY_STATIC_CAST(simde_poly128_t, 0xFFFFFFFFFFFFFFFFull);
top_r = HEDLEY_STATIC_CAST(simde_poly64_t, (r >> 64) & mask);
bottom_r = HEDLEY_STATIC_CAST(simde_poly64_t, (r << 64) >> 64);
simde_assert_equal_p64(top_r, test_vec[i].r[0]);
simde_assert_equal_p64(bottom_r, test_vec[i].r[1]);
}
return 0;
}
int main() {
test_simde_vaddq_p128();
return 0;
}
Here's the command for compiling:
arm-linux-gnueabihf-gcc -v -save-temps -mcpu=cortex-a32
-mfpu=crypto-neon-fp-armv8 -Wextra -Werror -Wall -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations test.c
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/113065] [ARM][NEON] Compiler crashes when doing shift on data with NEON intrinsic type
2023-12-18 12:37 [Bug c/113065] New: [ARM][NEON] Compiler crashes when doing shift on data with NEON intrinsic type clh960524+gcc at gmail dot com
@ 2023-12-18 12:41 ` clh960524+gcc at gmail dot com
2023-12-18 16:31 ` [Bug target/113065] " acoplan at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: clh960524+gcc at gmail dot com @ 2023-12-18 12:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113065
--- Comment #1 from 陳履軒 <clh960524+gcc at gmail dot com> ---
Here's the result after compiling:
$ arm-linux-gnueabihf-gcc -mcpu=cortex-a32 -mfpu=crypto-neon-fp-armv8 -Wextra
-Werror -Wall -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations
test.c
during RTL pass: expand
test.c: In function ‘simde_vaddq_p128’:
test.c:18:8: internal compiler error: in expand_shift_1, at expmed.c:2668
18 | mask = mask << 64;
| ~~~~~^~~~~~~~~~~~
0x7f9d29bf4d8f __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7f9d29bf4e3f __libc_start_main_impl
../csu/libc-start.c:392
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/113065] [ARM][NEON] Compiler crashes when doing shift on data with NEON intrinsic type
2023-12-18 12:37 [Bug c/113065] New: [ARM][NEON] Compiler crashes when doing shift on data with NEON intrinsic type clh960524+gcc at gmail dot com
2023-12-18 12:41 ` [Bug c/113065] " clh960524+gcc at gmail dot com
@ 2023-12-18 16:31 ` acoplan at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: acoplan at gcc dot gnu.org @ 2023-12-18 16:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113065
Alex Coplan <acoplan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-12-18
Keywords| |ice-on-valid-code
CC| |acoplan at gcc dot gnu.org
--- Comment #2 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Confirmed, here is a reduced testcase:
$ cat t.c
typedef __builtin_neon_poly128 poly128_t;
poly128_t test_simde_vaddq_p128(poly128_t a) { return a << 4; }
$ ./xgcc -B . -c t.c -S -o /dev/null -march=armv8-a+simd -mfloat-abi=hard
during RTL pass: expand
t.c: In function ‘test_simde_vaddq_p128’:
t.c:2:57: internal compiler error: in expand_shift_1, at expmed.cc:2686
2 | poly128_t test_simde_vaddq_p128(poly128_t a) { return a << 4; }
| ~~^~~~
0x225b687 expand_shift_1
/home/alecop01/toolchain/src/gcc/gcc/expmed.cc:2686
0x225b7a0 expand_variable_shift(tree_code, machine_mode, rtx_def*, tree_node*,
rtx_def*, int)
/home/alecop01/toolchain/src/gcc/gcc/expmed.cc:2727
0x229007d expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
/home/alecop01/toolchain/src/gcc/gcc/expr.cc:10256
0x207a203 expand_gimple_stmt_1
/home/alecop01/toolchain/src/gcc/gcc/cfgexpand.cc:3983
0x207a44c expand_gimple_stmt
/home/alecop01/toolchain/src/gcc/gcc/cfgexpand.cc:4044
0x20824cc expand_gimple_basic_block
/home/alecop01/toolchain/src/gcc/gcc/cfgexpand.cc:6100
0x208487d execute
/home/alecop01/toolchain/src/gcc/gcc/cfgexpand.cc:6835
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-18 16:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-18 12:37 [Bug c/113065] New: [ARM][NEON] Compiler crashes when doing shift on data with NEON intrinsic type clh960524+gcc at gmail dot com
2023-12-18 12:41 ` [Bug c/113065] " clh960524+gcc at gmail dot com
2023-12-18 16:31 ` [Bug target/113065] " acoplan at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).