From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 80AF83857BAD for ; Tue, 9 Jan 2024 08:58:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 80AF83857BAD Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 80AF83857BAD Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704790719; cv=none; b=fdjy9g8LqWxvlWaKHjy4yHh3pt2eU+zBiZyL4akHqfXUnWrrIj56Ad2KqMY0p4QFR9uR+pyyZjoYhuE8fM3AbWpynCKtFcOb9FZrmE3o4TbV+g3QwtA7nb1cfV7DwuXnVGMpCrx3JcP+x2C8JBFOwmJ8ODB8r2wQqgrQWi8So2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704790719; c=relaxed/simple; bh=xhcDNUWBlH3PmHU3Jfp7+2taC4EjFBOGDUoKQks3Ppg=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=nZNJHUJZc2TOQWT5UmvV5SGLPJpXDSSlumTEzdiOKvWTqd3meMi+wch0WiEw3sV2tVnPWSYfc5PQE2TX4GMpXIVDSxuelqznZR+uU2XZtoDn6GtkgiW9Ip3w1Daap+VF1mKgitPJMrhMUDX1puf5Y/e1X0x6Fqx196XoNTig7c4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.168.4.150] (unknown [10.168.4.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E49421F7EE; Tue, 9 Jan 2024 08:58:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1704790707; 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=VCkmV/eDKBwkD86oB0C53QVuUM+Ck9B+dfeShtt5/OA=; b=FF3ruihGtYR5QWsO/S/dsyymql0Jpyv/TFUvYZYkNgNjxSElQFFV/qe2JaHmrxtqYYOGJM YZMC+m17Boi3klsNxWfamF66Jw1vCLi710yVn+U+WbT3x9/PXTS3Bik1GlyKq4duzuey11 tWDu2nSZy+hPMAQeY6DaljPV0thf/qU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1704790707; 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=VCkmV/eDKBwkD86oB0C53QVuUM+Ck9B+dfeShtt5/OA=; b=vFtIhj90UrfZnEcl5UmO3SRJkNyaGTJZEun4DObUaTNtO3Fp25mCp5xTCuJAX8UssBONXe 0/QP8fTcct60gRCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1704790706; 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=VCkmV/eDKBwkD86oB0C53QVuUM+Ck9B+dfeShtt5/OA=; b=xvL+oO+fQfSftBRI2g7wMJ8IriXlvek9Gc/EdTiGyu/F2bGpreka81gjn1hBZE/lC5cdLp jI9mf5eV5I7jy40vkmoF7xKquIbrL9z4ok5aFvfyBzGhFSSlZlZ+fnUGFBjmf0HxpQgNMN MiiFzzuJHuCb/IhYy1bT4JtHqlIg7nk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1704790706; 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=VCkmV/eDKBwkD86oB0C53QVuUM+Ck9B+dfeShtt5/OA=; b=+d48RjFo5J2UhEFIzyqcHnZ8ylXCQGtgDWuNg4AB2R61UiBJJ6pFKyB5vo5SAM1An5ny0k na7Z+2o6LtOzcRAA== Date: Tue, 9 Jan 2024 09:53:27 +0100 (CET) From: Richard Biener To: Uros Bizjak cc: Andrew Pinski , "gcc-patches@gcc.gnu.org" , Jeff Law Subject: Re: [PATCH] match.pd: Convert {I, X}OR of two values ANDed with alien CSTs to PLUS [PR108477] In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: 3.20 X-Spamd-Result: default: False [3.20 / 50.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; NEURAL_SPAM_LONG(3.50)[1.000]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[gmail.com,gcc.gnu.org]; FUZZY_BLOCKED(0.00)[rspamd.com]; BAYES_HAM(-0.00)[14.06%] X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Mon, 8 Jan 2024, Uros Bizjak wrote: > On Mon, Jan 8, 2024 at 5:57?PM Andrew Pinski wrote: > > > > On Mon, Jan 8, 2024 at 6:44?AM Uros Bizjak wrote: > > > > > > Instead of converting XOR or PLUS of two values, ANDed with two constants that > > > have no bits in common, to IOR expression, convert IOR or XOR of said two > > > ANDed values to PLUS expression. > > > > I think this only helps targets which have leal like instruction. Also > > I think it is the same issue as I recorded as PR 111763 . I suspect > > BIT_IOR is more of a Canonical form for GIMPLE while we should handle > > this in expand to decide if we want to use PLUS or IOR. > > For the pr108477.c testcase, expand pass expands: > > r_3 = a_2(D) & 1; > p_5 = b_4(D) & 4294967292; > _1 = r_3 | p_5; > _6 = _1 + 2; > return _6; > > The transformation ( | -> + ) is valid only when CST1 & CST2 == 0, so > we need to determine values of constants. Is this information > available in the expand pass? If there's single-uses then TER makes this info available. > IMO, the transformation from (ra | rb | cst) to (ra + rb + cst) as in > the shown testcase would be beneficial when constructing control > register values (see e.g. mesa-3d). We can use LEA instead of OR+ADD > sequence in this case. The other possibility is to expose LEA as optab and making GIMPLE instruction selection generate a direct internal function for that (that would be the "better" way). There is LEA-like &TARGET_MEM_REF but that has constraints on the addends mode (ptr_mode) which might not fit what the target can do? Otherwise that would be an existing way to do this computation as well. Richard.