From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 282553858D32 for ; Mon, 29 Aug 2022 10:52:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 282553858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 71AE61F86C; Mon, 29 Aug 2022 10:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661770343; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nKK8nhISfLbyT0zUtrgDcG8r9rAi83k9ZLN+UDN1drs=; b=SMtfUJh6GRWJTkibTCsdemKjjL9MD2GTriYe+B6p3Qfe2m5RYkHJwsb7lrGkzqJAauBWRb AWP9YqDCObMB0JOsYFoRrKf8kLn7pYY9GC25rr0A+yP+WdOfYdya6GAtTIhQAp5GV5uVVI QkcsxuUq7PQxJODd6k10j9OURFGlPew= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661770343; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nKK8nhISfLbyT0zUtrgDcG8r9rAi83k9ZLN+UDN1drs=; b=4Ne0Hmgk9DWVxmv9vChs8wuVAM1ImMylt0HZ+A9VfCooISI8vnk7LgdykUwcn+Bnua4g8X xMQiwhUSk6Li4zAg== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 515172C141; Mon, 29 Aug 2022 10:52:23 +0000 (UTC) Date: Mon, 29 Aug 2022 10:52:23 +0000 (UTC) From: Richard Biener To: Richard Sandiford cc: Tamar Christina , "gcc-patches@gcc.gnu.org" , nd , Jeff Law Subject: Re: [PATCH]middle-end Use subregs to expand COMPLEX_EXPR to set the lowpart. In-Reply-To: Message-ID: References: User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,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 List-Id: On Tue, 5 Jul 2022, Richard Sandiford wrote: > Tamar Christina 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. This has HOST_WIDE_INT regnum; ... else if (((constant_multiple_p (bitnum, regsize * BITS_PER_UNIT, ®num) && multiple_p (bitsize, regsize * BITS_PER_UNIT)) || undefined_p) && known_ge (GET_MODE_BITSIZE (GET_MODE (op0)), bitsize)) { sub = simplify_gen_subreg (fieldmode, op0, GET_MODE (op0), regnum * regsize); where regnum is used uninitialized when undefined_p. An uninit improvement of mine will diagnose this now. What's the intended behavior here? Use regnum = 0? Please fix. Thanks, Richard. > 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; > > +} > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman; HRB 36809 (AG Nuernberg)