From patchwork Wed Nov 22 03:31:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongyu Wang X-Patchwork-Id: 1867122 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=djUOAUwj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SZmxX3HYRz1yRq for ; Wed, 22 Nov 2023 14:31:28 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9F34F3858D35 for ; Wed, 22 Nov 2023 03:31:25 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by sourceware.org (Postfix) with ESMTPS id F14CF3858D33 for ; Wed, 22 Nov 2023 03:31:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F14CF3858D33 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F14CF3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700623875; cv=none; b=AmrbpagJpetvuFlfq7RnPZajdAKGO+bkEdm0rp0ZBBC4HeaySNzvv6QOBqKuNme+DsiB8QOC2I1hP+cCOmN39jsWtUbIvV3ss1ccPQurF4+ZHleQcFpN/GDpAF12AOsW3FDoxsjv3wWc8FFr98618fecK/DVP6gAtjpF3mgFVVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700623875; c=relaxed/simple; bh=/ebBWh8ajrL2SBk7FBcdNhaUYS/DzgKyxGPwF6Ncj2k=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ot0cmRXDfBATes+daq7/H1PdfyiMCw6MEw6B+7vyuTHQjhpVwe/OaFDW/sEdkcTaGrKWYp4tzCV/8H+dCioEcnn9l9ED9opOZ5zi4cHy3Gst2ljoMu5Fmy+aIJ/maMQTW9zeLWoYE7BPvBLwi+JAzqDXK/lehUrzEBC5EgtcqhI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700623873; x=1732159873; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=/ebBWh8ajrL2SBk7FBcdNhaUYS/DzgKyxGPwF6Ncj2k=; b=djUOAUwj+riSIvZN/9zkH4dQeT4E8YbHxhjVtCDPS8rFjnbQX3BBHQn6 DJ5oV79CvU6K/T4UAG99O8YFcKmYLgATDg6hiH0HsRiYDLhyh8sK6MkqC L9yJwq/19dKUM2p4d0kPYrggawDhHn8QnbysI57sNrU6EM17MjLU5ETI9 FXXGWULGD5JFzp/08nN+nAsWFIZKZ89MSVGGXsDf+/DoXcf1F2pJxbJqt lHOsReYIByF90iGlEYJ/LyrbwujvQq6oAKQInv4/8SUJphovAb/wkmyfs h3AeCA3gQOWR7t6CMwMUTxQxKFdQo8dBmVNCrHxodmoQzUuTIG22DuKHo Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="5169861" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="5169861" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 19:31:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="890434419" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="890434419" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by orsmga004.jf.intel.com with ESMTP; 21 Nov 2023 19:31:09 -0800 Received: from shliclel4217.sh.intel.com (shliclel4217.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id D5338100569E; Wed, 22 Nov 2023 11:31:08 +0800 (CST) From: Hongyu Wang To: gcc-patches@gcc.gnu.org Cc: hongtao.liu@intel.com Subject: [PATCH] [APX PUSH2POP2] Adjust operand order for PUSH2POP2 Date: Wed, 22 Nov 2023 11:31:08 +0800 Message-Id: <20231122033108.3654950-1-hongyu.wang@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_SOFTFAIL, 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, The push2/pop2 operand order does not match the binutils implementation for AT&T syntax that it will first push operands[2] then operands[1]. Correct it by reverse operand order for AT&T syntax. Bootstrapped/regtested on x86-64-linux-pc-gnu{-m32,} Ok for master? gcc/ChangeLog: * config/i386/i386.md (push2_di): Adjust operand order for AT&T syntax. (pop2_di): Likewise. (push2p_di): Likewise. (pop2p_di): Likewise. gcc/testsuite/ChangeLog: * gcc.target/i386/apx-push2pop2-1.c: Adjust output scan. * gcc.target/i386/apx-push2pop2_force_drap-1.c: Likewise. --- gcc/config/i386/i386.md | 8 ++++---- gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c | 8 ++++---- .../gcc.target/i386/apx-push2pop2_force_drap-1.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 03e4ddd3037..99bb909b244 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -3772,7 +3772,7 @@ (define_insn "push2_di" (match_operand:DI 2 "register_operand" "r")] UNSPEC_APXPUSH2))] "TARGET_APX_PUSH2POP2" - "push2\t%1, %2" + "push2\t{%2, %1|%1, %2}" [(set_attr "mode" "TI") (set_attr "type" "multi") (set_attr "prefix" "evex")]) @@ -3784,7 +3784,7 @@ (define_insn "pop2_di" (set (match_operand:DI 2 "register_operand" "=r") (unspec:DI [(const_int 0)] UNSPEC_APXPOP2_HIGH))])] "TARGET_APX_PUSH2POP2" - "pop2\t%0, %2" + "pop2\t{%2, %0|%0, %2}" [(set_attr "mode" "TI") (set_attr "prefix" "evex")]) @@ -3811,7 +3811,7 @@ (define_insn "push2p_di" UNSPEC_APXPUSH2)) (unspec:DI [(const_int 0)] UNSPEC_APX_PPX)] "TARGET_APX_PUSH2POP2 && TARGET_APX_PPX" - "push2p\t%1, %2" + "push2p\t{%2, %1|%1, %2}" [(set_attr "mode" "TI") (set_attr "type" "multi") (set_attr "prefix" "evex")]) @@ -3824,7 +3824,7 @@ (define_insn "pop2p_di" (unspec:DI [(const_int 0)] UNSPEC_APXPOP2_HIGH)) (unspec:DI [(const_int 0)] UNSPEC_APX_PPX)])] "TARGET_APX_PUSH2POP2 && TARGET_APX_PPX" - "pop2p\t%0, %2" + "pop2p\t{%2, %0|%0, %2}" [(set_attr "mode" "TI") (set_attr "prefix" "evex")]) diff --git a/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c b/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c index c53112758a5..d78c96d36a3 100644 --- a/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c +++ b/gcc/testsuite/gcc.target/i386/apx-push2pop2-1.c @@ -24,11 +24,11 @@ void foo () /* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 16" 2 } } */ /* { dg-final { scan-assembler-times "pushq\[^\n\r]*%r15(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 15, -16(?:\n|\[ \\t\]+#)" 1 } } */ -/* { dg-final { scan-assembler-times "push2\[\\t \]*\[^\n\r]*%r14\[^\n\r]*%r13\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "push2\[\\t \]*\[^\n\r]*%r13\[^\n\r]*%r14\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 32" 2 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 14, -24(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 13, -32(?:\n|\[ \\t\]+#)" 1 } } */ -/* { dg-final { scan-assembler-times "push2\[\\t \]*\[^\n\r]*%r12\[^\n\r]*%rbp\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "push2\[\\t \]*\[^\n\r]*%rbp\[^\n\r]*%r12\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 48" 2 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 12, -40(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 6, -48(?:\n|\[ \\t\]+#)" 1 } } */ @@ -36,10 +36,10 @@ void foo () /* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 56" 2 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 3, -56(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "popq\[^\n\r]*rbx(?:\n|\[ \\t\]+#)" 1 } } */ -/* { dg-final { scan-assembler-times "pop2\[\\t \]*\[^\n\r]*%rbp\[^\n\r]*%r12\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "pop2\[\\t \]*\[^\n\r]*%r12\[^\n\r]*%rbp\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_restore 12(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_restore 6(?:\n|\[ \\t\]+#)" 1 } } */ -/* { dg-final { scan-assembler-times "pop2\[\\t \]*\[^\n\r]*%r13\[^\n\r]*%r14\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "pop2\[\\t \]*\[^\n\r]*%r14\[^\n\r]*%r13\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_restore 14(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_restore 13(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "popq\[^\n\r]*%r15(?:\n|\[ \\t\]+#)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c b/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c index 022113bb1e2..3cac7b10769 100644 --- a/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c +++ b/gcc/testsuite/gcc.target/i386/apx-push2pop2_force_drap-1.c @@ -8,11 +8,11 @@ /* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 16" 2 } } */ /* { dg-final { scan-assembler-times "pushq\[^\n\r]*%r15(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 15, -16(?:\n|\[ \\t\]+#)" 1 } } */ -/* { dg-final { scan-assembler-times "push2\[\\t \]*\[^\n\r]*%r14\[^\n\r]*%r13\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "push2\[\\t \]*\[^\n\r]*%r13\[^\n\r]*%r14\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 32" 2 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 14, -24(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 13, -32(?:\n|\[ \\t\]+#)" 1 } } */ -/* { dg-final { scan-assembler-times "push2\[\\t \]*\[^\n\r]*%r12\[^\n\r]*%rbp\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "push2\[\\t \]*\[^\n\r]*%rbp\[^\n\r]*%r12\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 48" 2 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 12, -40(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 6, -48(?:\n|\[ \\t\]+#)" 1 } } */ @@ -20,10 +20,10 @@ /* { dg-final { scan-assembler-times ".cfi_def_cfa_offset 56" 2 } } */ /* { dg-final { scan-assembler-times ".cfi_offset 3, -56(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "popq\[^\n\r]*rbx(?:\n|\[ \\t\]+#)" 1 } } */ -/* { dg-final { scan-assembler-times "pop2\[\\t \]*\[^\n\r]*%rbp\[^\n\r]*%r12\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "pop2\[\\t \]*\[^\n\r]*%r12\[^\n\r]*%rbp\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_restore 12(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_restore 6(?:\n|\[ \\t\]+#)" 1 } } */ -/* { dg-final { scan-assembler-times "pop2\[\\t \]*\[^\n\r]*%r13\[^\n\r]*%r14\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "pop2\[\\t \]*\[^\n\r]*%r14\[^\n\r]*%r13\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_restore 14(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times ".cfi_restore 13(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "popq\[^\n\r]*%r15(?:\n|\[ \\t\]+#)" 1 } } */