From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 8A8A43858C2F for ; Tue, 5 Jul 2022 16:11:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A8A43858C2F Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7A0FFD6E; Tue, 5 Jul 2022 09:11:38 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 53FBB3F66F; Tue, 5 Jul 2022 09:11:37 -0700 (PDT) From: Richard Sandiford To: Tamar Christina Mail-Followup-To: Tamar Christina , "gcc-patches\@gcc.gnu.org" , nd , "rguenther\@suse.de" , Jeff Law , richard.sandiford@arm.com Cc: "gcc-patches\@gcc.gnu.org" , nd , "rguenther\@suse.de" , Jeff Law Subject: Re: [PATCH]middle-end Use subregs to expand COMPLEX_EXPR to set the lowpart. References: Date: Tue, 05 Jul 2022 17:11:36 +0100 In-Reply-To: (Tamar Christina's message of "Tue, 5 Jul 2022 15:05:49 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-55.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2022 16:11:40 -0000 Tamar Christina writes: >> > so that the multiple_p test is skipped if the structure is undefined. >>=20 >> Actually, we should probably skip the constant_multiple_p test as well. >> Keeping it would only be meaningful for little-endian. >>=20 >> simplify_gen_subreg should alread do the necessary checks to make sure >> that the subreg can be formed (via validate_subreg). >>=20 > > 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 --- > > [=E2=80=A6] > diff --git a/gcc/testsuite/g++.target/aarch64/complex-init.C b/gcc/testsu= ite/g++.target/aarch64/complex-init.C > new file mode 100644 > index 0000000000000000000000000000000000000000..d3fd3e88d04a87bacf1c4ee74= ce25282c6ff81e8 > --- /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 =3D a + b * 1i; > + return t; > +} > + > +/* > +** _Z2f2ii: > +** ... > +** bfi x0, x1, 32, 32 > +** ret > +** ... > +*/ > +_Complex int f2(int a, int b) { > + _Complex int t =3D {a, b}; > + return t; > +} > + > +/*=20 > +** _Z12f_convolutedii: > +** ... > +** bfi x0, x1, 32, 32 > +** ret > +** ... > +*/ > +_Complex int f_convoluted(int a, int b) { > + _Complex int t =3D (_Complex int)a; > + __imag__ t =3D b; > + return t; > +}