Tamar Christina 13f44099bc middle-end: Use subregs to expand COMPLEX_EXPR to set the lowpart.
When lowering COMPLEX_EXPR we currently emit two VEC_EXTRACTs.  One for the
lowpart and one for the highpart.

The problem with this is that in RTL the lvalue of the RTX is the only thing
tying the two instructions together.

This means that e.g. combine is unable to try to combine the two instructions
for setting the lowpart and highpart.

For ISAs that have bit extract instructions we can eliminate one of the extracts
if, and only if we're setting the entire complex number.

This change changes the expand code when we're setting the entire complex number
to generate a subreg for the lowpart instead of a vec_extract.

This allows us to optimize sequences such as:

_Complex int f(int a, int b) {
    _Complex int t = a + b * 1i;
    return t;
}

from:

f:
	bfi     x2, x0, 0, 32
	bfi     x2, x1, 32, 32
	mov     x0, x2
	ret

into:

f:
	bfi	x0, x1, 32, 32
	ret

I have also confirmed the codegen for x86_64 did not change.

gcc/ChangeLog:

	* expmed.cc (store_bit_field_1): Add parameter that indicates if value is
	still undefined and if so emit a subreg move instead.
	(store_integral_bit_field): Likewise.
	(store_bit_field): Likewise.
	* expr.h (write_complex_part): Likewise.
	* expmed.h (store_bit_field): Add new parameter.
	* builtins.cc (expand_ifn_atomic_compare_exchange_into_call): Use new
	parameter.
	(expand_ifn_atomic_compare_exchange): Likewise.
	* calls.cc (store_unaligned_arguments_into_pseudos): Likewise.
	* emit-rtl.cc (validate_subreg): Likewise.
	* expr.cc (emit_group_store): Likewise.
	(copy_blkmode_from_reg): Likewise.
	(copy_blkmode_to_reg): Likewise.
	(clear_storage_hints): Likewise.
	(write_complex_part):  Likewise.
	(emit_move_complex_parts): Likewise.
	(expand_assignment): Likewise.
	(store_expr): Likewise.
	(store_field): Likewise.
	(expand_expr_real_2): Likewise.
	* ifcvt.cc (noce_emit_move_insn): Likewise.
	* internal-fn.cc (expand_arith_set_overflow): Likewise.
	(expand_arith_overflow_result_store): Likewise.
	(expand_addsub_overflow): Likewise.
	(expand_neg_overflow): Likewise.
	(expand_mul_overflow): Likewise.
	(expand_arith_overflow): Likewise.

gcc/testsuite/ChangeLog:

	* g++.target/aarch64/complex-init.C: New test.
2022-07-08 07:39:33 +01:00
2022-03-19 00:16:22 +00:00
2022-06-02 00:16:32 +00:00
2022-07-05 00:16:36 +00:00
2022-02-28 00:16:17 +00:00
2021-10-23 00:16:26 +00:00
2022-02-14 00:16:23 +00:00
2022-07-07 00:16:46 +00:00
2021-11-30 00:16:44 +00:00
2022-01-03 10:42:10 +01:00
2022-06-03 00:16:40 +00:00
2022-07-08 00:16:22 +00:00
2022-06-28 00:16:58 +00:00
2022-06-04 00:16:27 +00:00
2022-07-08 00:16:22 +00:00
2022-05-21 00:16:32 +00:00
2021-11-16 00:16:31 +00:00
2022-06-26 00:16:33 +00:00
2022-06-30 00:16:46 +00:00
2022-07-08 00:16:22 +00:00
2022-07-05 00:16:36 +00:00
2022-06-03 00:16:40 +00:00
2022-01-03 10:42:10 +01:00
2022-07-05 00:16:36 +00:00
2022-07-07 00:16:46 +00:00
2022-01-12 00:16:39 +00:00
2022-01-03 10:42:10 +01:00
2022-07-08 00:16:22 +00:00
2022-01-03 10:42:10 +01:00
2022-07-08 00:16:22 +00:00
2022-05-21 00:16:32 +00:00
2021-12-17 00:16:20 +00:00
2022-05-28 09:38:29 -06:00
2022-07-05 00:16:36 +00:00
2021-12-21 09:10:57 +01:00
2022-06-28 09:41:07 -03:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
S
Description
Yggdrasil port of the GNU Compiler Collection
Readme 978 MiB
Languages
C++ 33%
C 27.4%
Ada 13%
Go 7.1%
D 7%
Other 12.1%