public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Tamar Christina <Tamar.Christina@arm.com>
Cc: "gcc-patches\@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	nd <nd@arm.com>, "rguenther\@suse.de" <rguenther@suse.de>,
	Jeff Law <jeffreyalaw@gmail.com>
Subject: Re: [PATCH]middle-end Use subregs to expand COMPLEX_EXPR to set the lowpart.
Date: Tue, 05 Jul 2022 17:11:36 +0100	[thread overview]
Message-ID: <mpta69n35fr.fsf@arm.com> (raw)
In-Reply-To: <VI1PR08MB5325F3F77908820066457D83FF819@VI1PR08MB5325.eurprd08.prod.outlook.com> (Tamar Christina's message of "Tue, 5 Jul 2022 15:05:49 +0000")

Tamar Christina <Tamar.Christina@arm.com> writes:
>> > so that the multiple_p test is skipped if the structure is undefined.
>> 
>> Actually, we should probably skip the constant_multiple_p test as well.
>> Keeping it would only be meaningful for little-endian.
>> 
>> simplify_gen_subreg should alread do the necessary checks to make sure
>> that the subreg can be formed (via validate_subreg).
>> 
>
> Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu
> and no issues.
>
> Ok for master?
>
> Thanks,
> Tamar
>
> gcc/ChangeLog:
>
> 	* expmed.cc (store_bit_field):
>         * 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.
>
> --- inline copy of patch ---
>
> […]
> diff --git a/gcc/testsuite/g++.target/aarch64/complex-init.C b/gcc/testsuite/g++.target/aarch64/complex-init.C
> new file mode 100644
> index 0000000000000000000000000000000000000000..d3fd3e88d04a87bacf1c4ee74ce25282c6ff81e8
> --- /dev/null
> +++ b/gcc/testsuite/g++.target/aarch64/complex-init.C
> @@ -0,0 +1,40 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2" } */
> +/* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */
> +
> +/*
> +** _Z1fii:
> +** ...
> +** 	bfi	x0, x1, 32, 32
> +** 	ret
> +** ...

Sorry for the test nit, but: it shouldn't be necessary to add ...
after the ret.  Same for the other tests.

OK with that change, thanks.

Richard

> +*/
> +_Complex int f(int a, int b) {
> +    _Complex int t = a + b * 1i;
> +    return t;
> +}
> +
> +/*
> +** _Z2f2ii:
> +** ...
> +** 	bfi	x0, x1, 32, 32
> +** 	ret
> +** ...
> +*/
> +_Complex int f2(int a, int b) {
> +    _Complex int t = {a, b};
> +    return t;
> +}
> +
> +/* 
> +** _Z12f_convolutedii:
> +** ...
> +** 	bfi	x0, x1, 32, 32
> +** 	ret
> +** ...
> +*/
> +_Complex int f_convoluted(int a, int b) {
> +    _Complex int t = (_Complex int)a;
> +    __imag__ t = b;
> +    return t;
> +}

  reply	other threads:[~2022-07-05 16:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  7:52 Tamar Christina
2022-06-12 17:27 ` Jeff Law
2022-06-13 10:19   ` Tamar Christina
2022-06-13 17:42     ` Jeff Law
2022-06-13 11:54   ` Richard Biener
2022-06-13 17:34     ` Jeff Law
2022-06-15 11:36       ` Richard Sandiford
2022-06-16 11:22         ` Tamar Christina
2022-06-24 21:54         ` Jeff Law
2022-06-13  8:40 ` Richard Sandiford
2022-06-16 11:28   ` Tamar Christina
2022-06-17 17:13     ` Richard Sandiford
2022-06-20  8:00       ` Richard Sandiford
2022-07-05 15:05         ` Tamar Christina
2022-07-05 16:11           ` Richard Sandiford [this message]
2022-08-29 10:52             ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mpta69n35fr.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=Tamar.Christina@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=nd@arm.com \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).