From patchwork Sat Nov 25 07:18:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 169637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp1784252vqx; Fri, 24 Nov 2023 23:19:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUx6/LTuxvJ03Ik0uRMZ0CbskerRd2OB0DdvfGtCEOg4q6cUubDO2KwnzWrektINxbeskQ X-Received: by 2002:a05:620a:3f04:b0:77d:87e9:70d3 with SMTP id tx4-20020a05620a3f0400b0077d87e970d3mr2037146qkn.60.1700896765865; Fri, 24 Nov 2023 23:19:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700896765; cv=pass; d=google.com; s=arc-20160816; b=athe/NN8Y96DQLtceHn4rH6tvdIL68/laYdLkH2wvHp9hyEHzYJKlD2rbyH4vWA2M0 YbazYHumnm/SgmkEGhTG/+O/oj6q5J4Oz9h2Xj37v9B7jaAWh68F9LwTAJdwevKwPrZt rHhn+XjzDCoi0AT2qxa/sE36sxRRdCT4Yg+sxZc3TD+3+pYNL13annqFvTY1FjD11ZSP YwaAmQsZqyz1AiDZYytwTAfmXvkLqN2yEap1XTbdZztJVvdC4NjOli2p1QkkIMr4LIDa j7PguNIk5rFh3Z+L9M8t6KNahJV9gwSx2EoX7sAC8rTrYZwwpcr1YVbqCR5MN+dCdLOh uE9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=u+u9e033f/XGlGPI/TpomC0ZTymxJaIiiAXpYNA3Zl4=; fh=h2iPLTLlSKmpj4PWOaJAO8af6hiH/htLInOT1vU8M+E=; b=ugZnUtkFSLSH/jmCka6X8OjWkm98j+5hicI7UCR0Szo4RPV3eQ1FimOg4RTEl6hI/3 r2Bpt9wow0CayiwjqObRSTPXbFoUunbNs8T834cuqCcEhKnrOBr5weEofioHmays2tcy ayCgpnIeTUpXAkaruvsw5HoDPFXrbyBWWtRAYJfqSPjRRbjJHN2KDsxM4sKs26YdaZ4y ytDx/NNdJFVF9B1cFK335Dp1iOGsPA1gDF0023fJ8mIzP8OnrH7KDdC9wWSQMyg1cx6u JS6XuL+b8+qo7CMW1/K5mYf7uSxzWbUI6bZ/RBVDsDkys1Hb7DeBVmutKJz2yhISxz+y MOKg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Qd/wvKlG"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id h4-20020a05620a244400b0076d86b5d4ffsi5159909qkn.693.2023.11.24.23.19.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 23:19:25 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Qd/wvKlG"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9EB953858412 for ; Sat, 25 Nov 2023 07:19:25 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 84DBA3858CD1 for ; Sat, 25 Nov 2023 07:19:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 84DBA3858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 84DBA3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700896742; cv=none; b=Dc7/pPPBqcBtjucPoiGQXwGvYqgQSjB2ScF22HJsd01gBPFrjowNDP/ca9TlYpQVHlOIgNSiS3cohAZtQMtZe3zhPQjd1RZ/gCDS/Pc6YFIBLGENFrcdwcJSPQa9SOvdKn57jw8u+wr593lBcyrJdWQeNdiZ0AUq3HC1/uTohFM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700896742; c=relaxed/simple; bh=Z08wv1AsasGeYBV6igaijubmIyCJCaYKk8/Amv7ISfQ=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=voh8RoB53OhMFx8+aNnByDg9/JMlH7hT1zk1EeIy9A9hzhI0KqPUm3zpZGw41kOzrH7I0aTuTFuC0H1DxshULJarTXp6+2g+LTfPD2BA4hC08hiFPHUDGLqlfeuERdy5kOF4LQI7wkFe+qt0EFN9ur1RdtjzRcmqBKoWtTdU1Ek= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700896740; 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; bh=u+u9e033f/XGlGPI/TpomC0ZTymxJaIiiAXpYNA3Zl4=; b=Qd/wvKlG/5wNimBf6mHc1ZS/IgaRPJPzKOALSd30bjerMD4wllpzqEM/giaU35v9rUuX+u TZXnaHSLdHbNbfFewrZORiPJ0/rI3UgtkTb6uE7MGY/k3tN1S7p2Zo/wqGppdvEoV3f/NU Ow4ILsiO9EENKvEjMtoUJuB7o45lSlA= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-kYn2VCX2MoWdD9-cEDHyRw-1; Sat, 25 Nov 2023 02:18:58 -0500 X-MC-Unique: kYn2VCX2MoWdD9-cEDHyRw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C73A31C05AAD; Sat, 25 Nov 2023 07:18:57 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 89B3E492BFA; Sat, 25 Nov 2023 07:18:57 +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 3AP7It6B1782140 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 08:18:55 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3AP7IsD61782139; Sat, 25 Nov 2023 08:18:54 +0100 Date: Sat, 25 Nov 2023 08:18:54 +0100 From: Jakub Jelinek To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Fix up *jcc_bt*_mask{,_1} [PR111408] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783519527214906300 X-GMAIL-MSGID: 1783519527214906300 Hi! The following testcase is miscompiled in GCC 14 because the *jcc_bt_mask and *jcc_bt_mask_1 patterns have just one argument in (match_operator 0 "bt_comparison_operator" [...]) but as bt_comparison_operator is eq,ne, we need two. The md readers don't warn about it, after all, some checks can be done in the predicate rather than specified explicitly, and the behavior is that anything is accepted as the second argument. I went through all other i386.md match_operator uses and all others looked right (extract_operator using 3 operands, all others 2). Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? I think we'll want to fix this at different spots in older releases because I think the bug was introduced already in 2008, though most likely just latent. 2023-11-25 Jakub Jelinek PR target/111408 * config/i386/i386.md (*jcc_bt_mask, *jcc_bt_mask_1): Add (const_int 0) as expected second operand of bt_comparison_operator. * gcc.c-torture/execute/pr111408.c: New test. Jakub --- gcc/config/i386/i386.md.jj 2023-11-24 08:43:31.892529819 +0100 +++ gcc/config/i386/i386.md 2023-11-24 14:26:38.645009163 +0100 @@ -16879,7 +16879,8 @@ (define_insn_and_split "*jcc_bt_ma (const_int 1) (and:QI (match_operand:QI 2 "register_operand") - (match_operand 3 "const_int_operand")))]) + (match_operand 3 "const_int_operand"))) + (const_int 0)]) (label_ref (match_operand 4)) (pc))) (clobber (reg:CC FLAGS_REG))] @@ -16915,7 +16916,8 @@ (define_insn_and_split "*jcc_bt