From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id A29F73858D38 for ; Tue, 6 Jun 2023 22:39:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A29F73858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686091165; h=from:from:reply-to:reply-to:subject:subject: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=Y1QeJt+PABpJ/XO4Y/pbbCOdxd+4w4lfH43WmhftOfQ=; b=BrXCyzwA8HWa5AsTYkIq9BXFFtCTmU0LWN/DDFDJOkiuO0mi6K4ldjal7Dc5T7abs/AHzl tM88a1GBiinxSDwxABdBP6fsfOhhhtalPOUrF4tLMk9RuNpchmO36Vll7mtf2dYDCZhAHA zbD15sUR+klvbo/2zdxnKizoNg+CN5k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-277-NF9LLlxoMpiMdXGqbdzwGw-1; Tue, 06 Jun 2023 18:39:20 -0400 X-MC-Unique: NF9LLlxoMpiMdXGqbdzwGw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE073185A78E; Tue, 6 Jun 2023 22:39:19 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 70AFF403367; Tue, 6 Jun 2023 22:39:19 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 356MdGeN1356824 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 7 Jun 2023 00:39:17 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 356MdFIG1356823; Wed, 7 Jun 2023 00:39:15 +0200 Date: Wed, 7 Jun 2023 00:39:15 +0200 From: Jakub Jelinek To: Roger Sayle Cc: gcc-patches@gcc.gnu.org, "'Uros Bizjak'" Subject: Re: [x86_64 PATCH] PR target/110104: Missing peephole2 for addcarry. Message-ID: Reply-To: Jakub Jelinek References: <030901d998c6$ac062250$041266f0$@nextmovesoftware.com> MIME-Version: 1.0 In-Reply-To: <030901d998c6$ac062250$041266f0$@nextmovesoftware.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,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 List-Id: On Tue, Jun 06, 2023 at 11:31:42PM +0100, Roger Sayle wrote: > > This patch resolves PR target/110104, a missed optimization on x86 around > adc with memory operands. In i386.md, there's a peephole2 after the > pattern for *add3_cc_overflow_1 that converts the sequence > reg = add(reg,mem); mem = reg [where the reg is dead afterwards] into > the equivalent mem = add(mem,reg). The equivalent peephole2 for adc > is missing (after addcarry), and is added by this patch. > > For the example code provided in the bugzilla PR: Seems to be pretty much the same as one of the 12 define_peephole2 patterns I've posted in https://gcc.gnu.org/pipermail/gcc-patches/2023-June/620821.html > 2023-06-07 Roger Sayle > > gcc/ChangeLog > PR target/110104 > * config/i386/i386.md (define_peephole2): Transform reg=adc(reg,mem) > followed by mem=reg into mem=adc(mem,reg) when applicable. > > gcc/testsuite/ChangeLog > PR target/110104 > * gcc.target/i386/pr110104.c: New test case. The testcase will be useful though (but I'd go with including the intrin header and using the intrinsic rather than builtin). Jakub