public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/94678] New: aarch64: unexpected result with -mgeneral-regs-only and sve
@ 2020-04-21 7:11 felix.yang at huawei dot com
2020-04-21 7:12 ` [Bug target/94678] " felix.yang at huawei dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: felix.yang at huawei dot com @ 2020-04-21 7:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94678
Bug ID: 94678
Summary: aarch64: unexpected result with -mgeneral-regs-only
and sve
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: felix.yang at huawei dot com
CC: richard.sandiford at arm dot com
Target Milestone: ---
Target: aarch64
It looks like there are several issues out there for aarch64 sve codegen with
-mgeneral-regs-only.
>> test1.c:
#pragma GCC aarch64 "arm_sve.h"
svbool_t
f1()
{
return svptrue_b8 ();
}
$aarch64-linux-gnu-gcc -S -march=armv8.2-a+sve -mgeneral-regs-only test1.c
Assembly output:
f1:
.LFB0:
.cfi_startproc
ptrue p0.b, all <==== predicate register is used here even with
-mgeneral-regs-only
ret
.cfi_endproc
.LFE0:
>> test2.c:
#pragma GCC aarch64 "arm_sve.h"
svint8_t
f2 (svbool_t *x, svint8_t *y)
{
return svadd_m (*x, *y, 1);
}
$aarch64-linux-gnu-gcc -S -march=armv8.2-a+sve -mgeneral-regs-only test2.c
This will trigger an ICE.
We do ISA extension checks for SVE in
check_required_extensions(aarch64-sve-builtins.cc), I think we may also need to
check -mgeneral-regs-only there and issue an error message when this option is
specified. This would be cheap as compared with adding &&
TARGET_GENERAL_REGS_ONLY to TARGET_SVE and similar macros. I have created a
patch for that.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/94678] aarch64: unexpected result with -mgeneral-regs-only and sve
2020-04-21 7:11 [Bug target/94678] New: aarch64: unexpected result with -mgeneral-regs-only and sve felix.yang at huawei dot com
@ 2020-04-21 7:12 ` felix.yang at huawei dot com
2020-04-22 17:25 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: felix.yang at huawei dot com @ 2020-04-21 7:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94678
--- Comment #1 from Fei Yang <felix.yang at huawei dot com> ---
crash log for test2.c:
during RTL pass: expand
foo.c: In function 'f2':
foo.c:14:10: internal compiler error: in emit_move_insn, at expr.c:3815
14 | return svadd_m (*x, *y, 1);
| ^~~~~~~~~~~~~~~~~~~
0xd21797 emit_move_insn(rtx_def*, rtx_def*)
../../gcc-git/gcc/expr.c:3814
0xcf52cb copy_to_mode_reg(machine_mode, rtx_def*)
../../gcc-git/gcc/explow.c:634
0x11021f7 maybe_legitimize_operand
../../gcc-git/gcc/optabs.c:7283
0x1102caf maybe_legitimize_operands(insn_code, unsigned int, unsigned int,
expand_operand*)
../../gcc-git/gcc/optabs.c:7415
0x1102d9b maybe_gen_insn(insn_code, unsigned int, expand_operand*)
../../gcc-git/gcc/optabs.c:7434
0x1103223 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
../../gcc-git/gcc/optabs.c:7477
0x11032c3 expand_insn(insn_code, unsigned int, expand_operand*)
../../gcc-git/gcc/optabs.c:7508
0x10edec3 expand_vector_broadcast(machine_mode, rtx_def*)
../../gcc-git/gcc/optabs.c:419
0x1859ec3 aarch64_sve::function_expander::add_input_operand(insn_code,
rtx_def*)
../../gcc-git/gcc/config/aarch64/aarch64-sve-builtins.cc:2790
0x185b1b3 aarch64_sve::function_expander::use_cond_insn(insn_code, unsigned
int)
../../gcc-git/gcc/config/aarch64/aarch64-sve-builtins.cc:3078
0x185b753 aarch64_sve::function_expander::map_to_rtx_codes(rtx_code, rtx_code,
int, unsigned int)
../../gcc-git/gcc/config/aarch64/aarch64-sve-builtins.cc:3224
0x18768d7
aarch64_sve::rtx_code_function::expand(aarch64_sve::function_expander&) const
../../gcc-git/gcc/config/aarch64/aarch64-sve-builtins-functions.h:211
0x185b9fb aarch64_sve::function_expander::expand()
../../gcc-git/gcc/config/aarch64/aarch64-sve-builtins.cc:3281
0x185dcab aarch64_sve::expand_builtin(unsigned int, tree_node*, rtx_def*)
../../gcc-git/gcc/config/aarch64/aarch64-sve-builtins.cc:3569
0x17c0ceb aarch64_expand_builtin
../../gcc-git/gcc/config/aarch64/aarch64.c:13147
0xb3782f expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
../../gcc-git/gcc/builtins.c:7736
0xd4039b expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc-git/gcc/expr.c:11132
0xd3338f expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
../../gcc-git/gcc/expr.c:8359
0xd28337 store_expr(tree_node*, rtx_def*, int, bool, bool)
../../gcc-git/gcc/expr.c:5755
0xd26d27 expand_assignment(tree_node*, tree_node*, bool)
../../gcc-git/gcc/expr.c:5514
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/94678] aarch64: unexpected result with -mgeneral-regs-only and sve
2020-04-21 7:11 [Bug target/94678] New: aarch64: unexpected result with -mgeneral-regs-only and sve felix.yang at huawei dot com
2020-04-21 7:12 ` [Bug target/94678] " felix.yang at huawei dot com
@ 2020-04-22 17:25 ` cvs-commit at gcc dot gnu.org
2020-04-22 17:26 ` rsandifo at gcc dot gnu.org
2020-04-23 15:08 ` cvs-commit at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-22 17:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94678
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>:
https://gcc.gnu.org/g:154ae7d4e921d704118d6a16ee5cc2a10b9047da
commit r10-7891-g154ae7d4e921d704118d6a16ee5cc2a10b9047da
Author: Fei Yang <felix.yang@huawei.com>
Date: Wed Apr 22 18:24:59 2020 +0100
aarch64: unexpected result with -mgeneral-regs-only and sve [PR94678]
As the two testcases for PR94678 show, -mgeneral-regs-only is handled
properly with SVE. We should issue an error message instead of expanding
SVE builtin funtions when -mgeneral-regs-only option is specified.
The middle end should never try to use vector patterns when the vector
modes have been disabled by !have_regs_of_mode. But it's still wrong
for the target to provide patterns that would inevitably lead to spill
failure due to lack of registers. So we should also add check for
!TARGET_GENERAL_REGS_ONLY in TARGET_SVE and other SVE related macros.
2020-04-22 Felix Yang <felix.yang@huawei.com>
gcc/
PR target/94678
* config/aarch64/aarch64.h (TARGET_SVE):
Add && !TARGET_GENERAL_REGS_ONLY.
(TARGET_SVE2): Add && TARGET_SVE.
(TARGET_SVE2_AES, TARGET_SVE2_BITPERM, TARGET_SVE2_SHA3,
TARGET_SVE2_SM4): Add && TARGET_SVE2.
* config/aarch64/aarch64-sve-builtins.h
(sve_switcher::m_old_general_regs_only): New member.
* config/aarch64/aarch64-sve-builtins.cc
(check_required_registers):
New function.
(reported_missing_registers_p): New variable.
(check_required_extensions): Call check_required_registers before
return if all required extenstions are present.
(sve_switcher::sve_switcher): Save TARGET_GENERAL_REGS_ONLY in
m_old_general_regs_only and clear MASK_GENERAL_REGS_ONLY in
global_options.x_target_flags.
(sve_switcher::~sve_switcher): Set MASK_GENERAL_REGS_ONLY in
global_options.x_target_flags if m_old_general_regs_only is true.
gcc/testsuite/
PR target/94678
* gcc.target/aarch64/sve/acle/general/nosve_6.c: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/94678] aarch64: unexpected result with -mgeneral-regs-only and sve
2020-04-21 7:11 [Bug target/94678] New: aarch64: unexpected result with -mgeneral-regs-only and sve felix.yang at huawei dot com
2020-04-21 7:12 ` [Bug target/94678] " felix.yang at huawei dot com
2020-04-22 17:25 ` cvs-commit at gcc dot gnu.org
@ 2020-04-22 17:26 ` rsandifo at gcc dot gnu.org
2020-04-23 15:08 ` cvs-commit at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2020-04-22 17:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94678
rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rsandifo at gcc dot gnu.org
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #3 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Fixed on master. Thanks for the patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/94678] aarch64: unexpected result with -mgeneral-regs-only and sve
2020-04-21 7:11 [Bug target/94678] New: aarch64: unexpected result with -mgeneral-regs-only and sve felix.yang at huawei dot com
` (2 preceding siblings ...)
2020-04-22 17:26 ` rsandifo at gcc dot gnu.org
@ 2020-04-23 15:08 ` cvs-commit at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-23 15:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94678
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>:
https://gcc.gnu.org/g:857d1fa3f0a04569382bab12829e5bfd3725ecbf
commit r10-7917-g857d1fa3f0a04569382bab12829e5bfd3725ecbf
Author: Fei Yang <felix.yang@huawei.com>
Date: Thu Apr 23 16:08:03 2020 +0100
testsuite: Add extra aarch64 predefine tests
Add extra testing in the following two tests to make sure CPP predefines
redefinitions on #pragma works as expected when -mgeneral-regs-only
option is specified (See PR94678):
gcc.target/aarch64/pragma_cpp_predefs_2.c
gcc.target/aarch64/pragma_cpp_predefs_3.c
2020-04-23 Felix Yang <felix.yang@huawei.com>
gcc/testsuite/
PR target/94678
* gcc.target/aarch64/pragma_cpp_predefs_2.c: Fix typos, pop_pragma
->
pop_options. Add tests for general-regs-only.
* gcc.target/aarch64/pragma_cpp_predefs_3.c: Add tests for
general-regs-only.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-23 15:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 7:11 [Bug target/94678] New: aarch64: unexpected result with -mgeneral-regs-only and sve felix.yang at huawei dot com
2020-04-21 7:12 ` [Bug target/94678] " felix.yang at huawei dot com
2020-04-22 17:25 ` cvs-commit at gcc dot gnu.org
2020-04-22 17:26 ` rsandifo at gcc dot gnu.org
2020-04-23 15:08 ` cvs-commit 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).