From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 231883858C52 for ; Tue, 25 Jul 2023 22:49:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 231883858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36PJIX2p010691 for ; Tue, 25 Jul 2023 22:49:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=SV44XJp45iyKbEu4f8ghb+HOQwioTsUKASnq44WJeDw=; b=DXxuvznff5ppU4QIZZ3duYncBWTgN+JVH8yju7ADF6xNmaxZAojaILWxIpa6/4gZG+As 4lkStXxiPVvGcX2QYfphb/VNCJFNuGQg2Q8qC+nTZPPsAGZpJLytO07YZ2oxsp8GZusG B/Z3k+cXX/613bVcHorhX+2yLejng8801319jfbCKSy7ebAJBItiJSg3veei9tR3NK1E umT0SfQLV2ncOxiFTQnI9mizz0GkdNb3gC8DYOoUrxJCAankgKby4jMvIxLS5iI+sqyJ pEUvIqZvGQ6Pv6bQ5wq4+ICpaKMDW4dC+je7ohpL3Xw5Oa6gOiHlvEOUkZio29t8DUu9 Iw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s07nup71w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 Jul 2023 22:49:33 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36PLkObv029502 for ; Tue, 25 Jul 2023 22:49:33 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s05j5e6uu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 Jul 2023 22:49:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bUQFg7Sf0il7U2sImQnW8xBZyY1er/IexE2Sc7D0JKpghEP/oyx6RepkBOqZCZqm5Xz5v2Bpl6PxDt9opmK/mawbcy8P/S06HluxY2esnk8urGRTgXcljFw2zOJg+jDb6JPpRzKMI1PIQN6WGAg3NxAqxCS9FcCeYoQnoIFTD3xalchJCHJ8jDpaZoiXYKMX/I4qmQT22B1Yucfm4padJDCgbsMl4DeMkei80j4JSuBXlTafPMQmI/V+YdiAdPTb5COhr636M/U8D7IFfhSsRqw4NXlm25tTso+WGLzjU0mqLsmKOREQkiBIIGYlGi80e5+ib0NRN3huNUKoojXYtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SV44XJp45iyKbEu4f8ghb+HOQwioTsUKASnq44WJeDw=; b=M3j3g8sU4rTX9wVtAWSHDGhR1RNrez9fntBZxK4HaZYde9yHd05M+ZqHgtOzNIDbEyxQ6PvBZsu9VxbSN9scKiCMHIwEekkNZSt9chodB149H6r8zodZoX3cPUcF7LjHO2ijdpUwFpFbZshVCL/VM5pYx49OyHO4x6Okmv9sUthVhgxsy/zFdzIrg4Ltp2j1r09xM3QTXVwlLXGKv+2BD3PCGOTCI4mC8k1onqxedVuQeNpm8//qaTgCRca6FldYWyxN1JnAsv8fNIfqH5bo9g5AWCHEoeD48qmYGAlc7aw2qo2u0z2iAcFSgYUkvqO5XOARvD1P6x+t1BhHL7zAEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SV44XJp45iyKbEu4f8ghb+HOQwioTsUKASnq44WJeDw=; b=Nj1/ApU88zMvKqyD/B0VJaciz/6kc+PygIRoQ3Gfhq93VjU5s0Urfk1qXTdAa/L25jXprBzZWIuYQuO0hIHBDWYEdg8MerWAKsa3vlSmf4JQmJm8dF1Ckz4YauBApDzcdxpeu351c69/8Iz06AWFhqqp9nmBZ/kYf7viRAKsNQU= Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by SN4PR10MB5800.namprd10.prod.outlook.com (2603:10b6:806:20f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33; Tue, 25 Jul 2023 22:49:30 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::827f:8665:2052:16c5]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::827f:8665:2052:16c5%4]) with mapi id 15.20.6609.032; Tue, 25 Jul 2023 22:49:30 +0000 From: David Faust To: jose.marchesi@oracle.com Cc: gcc-patches@gcc.gnu.org Subject: [COMMITTED v2 1/2] bpf: don't print () in bpf_print_operand_address Date: Tue, 25 Jul 2023 15:49:20 -0700 Message-Id: <20230725224920.12392-1-david.faust@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <2e869548-5613-5f84-7210-490b23a789d9@oracle.com> References: <2e869548-5613-5f84-7210-490b23a789d9@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BY5PR13CA0018.namprd13.prod.outlook.com (2603:10b6:a03:180::31) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR10MB3213:EE_|SN4PR10MB5800:EE_ X-MS-Office365-Filtering-Correlation-Id: b0dc3c6d-7d30-4277-8c86-08db8d616815 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zFWzrdhSKjaieb8agZ0ipUVyFYH8fESVOYEnvtnWp/bj4wscmfzML/3HM4d4F3UMtVKHjP4FA37NYrzAZPiaLO8n+c71m6yuhX8ZR0Hv2zy3e3EIcQCn5MWa2xXjgvyg/gNYcY1knVPySDnq0tKG5YWr4aauoCkTT/Qta7cScBK+59TkkRgz/MLrYD9ajeoIvAMcsF2naEA59GyT5JTXaqBcmE9xpghiMm1yoNZKq3EWHXDT5C/VLVZ5Z9TI38dgoYrYm+5AwotZuJ7ZXuh3BixGxvVU2hLhjbf55yndoJqtP/xn5agxmLzdxpDT5/klgRh+aIv4i72r7SRbPhR91yv4Hb6KkS5Fic5fxvSZRB8ZWvLB7KRxjzIp2pvWqFsAXsdfmqHeJHXgzji5UIswSzHV5FSEOz57MpCGJnM1lUO94gHq6bSXCnVS27k4E6gSyObmYNzobHLM8QK4rQ45HX1D2QdwKn2ukpUWU7F+RfYvWu/ENutb5dKkurSykAhbhLIR881M9jcFWXnki98Xftm2W0iYPoQvGZ+K2MERROAWSqWbTwWH8jRTKGxDqZj/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB3213.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(136003)(39860400002)(346002)(376002)(396003)(451199021)(6512007)(186003)(2616005)(1076003)(26005)(6506007)(316002)(66946007)(66556008)(6486002)(36756003)(41300700001)(44832011)(5660300002)(34206002)(38100700002)(2906002)(4326008)(6636002)(66476007)(8936002)(8676002)(83380400001)(478600001)(37006003)(6666004)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uy7ZrhI0Zm/3uyd3gK8uV0iWH/v5yK5D+2v5PGaj1fNhCyuLbXsbVnu/tzwj?= =?us-ascii?Q?0n9SYT1M1NFq1plHatzCwC8Ngp80Xjdh0J3qcmQChV4+Lr3ou8djsVT6L9rz?= =?us-ascii?Q?ozWv4w7VGim/yO8txjlLAH7wZxKIoN1SvS8J1n+KddnuXS/yMYWoINSShRUn?= =?us-ascii?Q?kSD/+WFxQPLC2JEQD3OXRiDm1klUFyczvOQnXi2WKV4H+jdUgDiwDXtAiD9y?= =?us-ascii?Q?uAdBA8icD/qojQXHdJSV1ztnSDS6xUClM+c/Co3jE40ZV1y+emzHL6Gf6Wgo?= =?us-ascii?Q?yzHLKZNB8VN0YiXTNSs8I+litKUKY+S3DtXJMlgEhYVU5wzX1wqUzvK5I9y+?= =?us-ascii?Q?fg+Et48NmbBluCjplepm/pKyBFOwK38N6lBrj0SYfbrQuJUbuQNclb/CFunk?= =?us-ascii?Q?tx821vu620Rp9KvP333PZGhxy+dS3AaUZn3mDZrhuuQL46KjnkR9DYTzp8Fa?= =?us-ascii?Q?nESlX5zGDGTntCmha2bdynrsQbwx+TbfhJ6vtpX1LrBnmuDUDKaVke3Z8vDM?= =?us-ascii?Q?3A3tBbju8lfZFKqZ6Jg+WGAMB3zXi+SqG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q?dCxrhs0xpzrnGlkAsZGOYkJpD2dGNNLCMPd+gDMBqEszWhl+Jp9VpFu+XkD6?= =?us-ascii?Q?yy8cWJ8FP04fH10G6H+0tCk4L2HHqsMkwM1AxEGZL5w3wDh1DkCNS69EG958?= =?us-ascii?Q?ybj3/no71j7BWOAD18TLml+3l2O1KutdPW6/nhsh?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: FPyhP0NVKRMv6Aj9YsptSAKM1v07ibCP1kkCRhVJMR1k6hbcNowOL3TtpvkLo9WGAgOgX1M/4Tf4cbpNHhWq3awKaW2lI//VYG3wHC7bcyMHb99V4WQ7uSvL8bQegV1S1gtmE8ccqm7qXfFnw4rGqx8zuaDMyshagFBs4UwdD2JogPgtm+rjhZ73smUjCggkSJMRqjJzxVqeHXuPd3aAyvwUuupS7lIaWYh+5khjGmnixdCw+iYjQxdGPMpFD7cs3rlW0ZuxW7w/0kvkescGyTgq29aC5VpcPZWsbStdiJHgYbWpS1ORU8s3cSrBFQ8RrRsAowF9R4PRjU4qARQIr3wGStqJOZJAF12OlNojiL5v1F3jLnEzduU6Yukemy908fBZHYHTPbXDKXUl2vLAl9QE2rI8hPjIhY76/XlQq3XXkR0EbuDIlMksT5vBzHzRuYoynRh1giUoAFkiAN8UhHucXbJAxvd4HWJnS+FYnsnNYCVC+uEeba0h+OBJdQ4V8erAZtSPzZUMs7GdNbT0/opscVyIfeBVFZR43tZW4zG+MB/cb9t/Rwn5vnPdwZxyWLUQfLJfGCPAfBOV4alCwkAYbYsmCn9V6qKmTKVeEkYdlVhJRcck43Pv7iyoyHbOfJdHqkkGpRcfX0QhIr/S2SQlgOA5wZVFFyI9bbMfdJU0uGfzMu8+R+KLzDxMJTct5w7jEFR2xTVUxhoFyo0OZZn6kiR3FSa2pybHY/W95lQUu6Sf8fLVrpAdjfgFN2MP X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0dc3c6d-7d30-4277-8c86-08db8d616815 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2023 22:49:30.2197 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x2FI4iXaChOMnWEvwjPgJhHenOIAEoLemgoC33NUE7qK75g3+E8C3FUtVZP8AevwVusLJR0xIG97vAIeiHluCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR10MB5800 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-25_12,2023-07-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307250194 X-Proofpoint-ORIG-GUID: PVAfGG0F6LimJuWL8vqM7KLnbu4-Glik X-Proofpoint-GUID: PVAfGG0F6LimJuWL8vqM7KLnbu4-Glik X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,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 List-Id: [Changes from v1: save calls to fprintf] Unfortunately, the pseudo-C dialect syntax used for some of the v3 atomic instructions clashes with unconditionally printing the surrounding parentheses in bpf_print_operand_address. Instead, place the parentheses in the output templates where needed. gcc/ * config/bpf/bpf.cc (bpf_print_operand_address): Don't print enclosing parentheses for pseudo-C dialect. * config/bpf/bpf.md (zero_exdendhidi2): Add parentheses around operands of pseudo-C dialect output templates where needed. (zero_extendqidi2): Likewise. (zero_extendsidi2): Likewise. (*mov): Likewise. --- gcc/config/bpf/bpf.cc | 11 +++++++---- gcc/config/bpf/bpf.md | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc index 55b6927a62f..2e1e3e3abcf 100644 --- a/gcc/config/bpf/bpf.cc +++ b/gcc/config/bpf/bpf.cc @@ -933,9 +933,10 @@ bpf_print_operand_address (FILE *file, rtx addr) switch (GET_CODE (addr)) { case REG: - fprintf (file, asm_dialect == ASM_NORMAL ? "[" : "("); + if (asm_dialect == ASM_NORMAL) + fprintf (file, "["); bpf_print_register (file, addr, 0); - fprintf (file, asm_dialect == ASM_NORMAL ? "+0]" : "+0)"); + fprintf (file, asm_dialect == ASM_NORMAL ? "+0]" : "+0"); break; case PLUS: { @@ -944,11 +945,13 @@ bpf_print_operand_address (FILE *file, rtx addr) if (GET_CODE (op0) == REG && GET_CODE (op1) == CONST_INT) { - fprintf (file, asm_dialect == ASM_NORMAL ? "[" : "("); + if (asm_dialect == ASM_NORMAL) + fprintf (file, "["); bpf_print_register (file, op0, 0); fprintf (file, "+"); output_addr_const (file, op1); - fprintf (file, asm_dialect == ASM_NORMAL ? "]" : ")"); + if (asm_dialect == ASM_NORMAL) + fprintf (file, "]"); } else fatal_insn ("invalid address in operand", addr); diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md index 64342ea1de2..579a8213b09 100644 --- a/gcc/config/bpf/bpf.md +++ b/gcc/config/bpf/bpf.md @@ -260,7 +260,7 @@ (define_insn "zero_extendhidi2" "@ {and\t%0,0xffff|%0 &= 0xffff} {mov\t%0,%1\;and\t%0,0xffff|%0 = %1;%0 &= 0xffff} - {ldxh\t%0,%1|%0 = *(u16 *) %1}" + {ldxh\t%0,%1|%0 = *(u16 *) (%1)}" [(set_attr "type" "alu,alu,ldx")]) (define_insn "zero_extendqidi2" @@ -270,7 +270,7 @@ (define_insn "zero_extendqidi2" "@ {and\t%0,0xff|%0 &= 0xff} {mov\t%0,%1\;and\t%0,0xff|%0 = %1;%0 &= 0xff} - {ldxh\t%0,%1|%0 = *(u8 *) %1}" + {ldxh\t%0,%1|%0 = *(u8 *) (%1)}" [(set_attr "type" "alu,alu,ldx")]) (define_insn "zero_extendsidi2" @@ -280,7 +280,7 @@ (define_insn "zero_extendsidi2" "" "@ * return bpf_has_alu32 ? \"{mov32\t%0,%1|%0 = %1}\" : \"{mov\t%0,%1\;and\t%0,0xffffffff|%0 = %1;%0 &= 0xffffffff}\"; - {ldxw\t%0,%1|%0 = *(u32 *) %1}" + {ldxw\t%0,%1|%0 = *(u32 *) (%1)}" [(set_attr "type" "alu,ldx")]) ;;; Sign-extension @@ -319,11 +319,11 @@ (define_insn "*mov" (match_operand:MM 1 "mov_src_operand" " q,rI,B,r,I"))] "" "@ - {ldx\t%0,%1|%0 = *( *) %1} + {ldx\t%0,%1|%0 = *( *) (%1)} {mov\t%0,%1|%0 = %1} {lddw\t%0,%1|%0 = %1 ll} - {stx\t%0,%1|*( *) %0 = %1} - {st\t%0,%1|*( *) %0 = %1}" + {stx\t%0,%1|*( *) (%0) = %1} + {st\t%0,%1|*( *) (%0) = %1}" [(set_attr "type" "ldx,alu,alu,stx,st")]) ;;;; Shifts -- 2.40.1