From patchwork Mon Aug 7 07:00:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 131694 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1268699vqr; Mon, 7 Aug 2023 00:00:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeSTVG3pvHSq8p6VuQG01yEdAAs+dMzQ+bYwgL1PMPhwWltrsmTFPwI47/jlBe/6tEvmy6 X-Received: by 2002:a05:6512:2827:b0:4f8:5e21:a3a9 with SMTP id cf39-20020a056512282700b004f85e21a3a9mr6702730lfb.45.1691391624701; Mon, 07 Aug 2023 00:00:24 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id n22-20020aa7db56000000b0052229b7a96asi5440055edt.684.2023.08.07.00.00.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 00:00:24 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=jX489fu4; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3841C3858417 for ; Mon, 7 Aug 2023 07:00:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3841C3858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691391623; bh=2Nx3wiFIAF1nU/kHPqWVniDMoMSWk+NcI4AZIPK42XA=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=jX489fu4g0xDXm9rPsL6ekMa//uKbDCqeS/g8zkE/VvT4yEMoa2lxo1CET/OC2tk9 +9DiNttVFwkjncSgod+CjkzbFTKT2EXZwmb8GFumj3gfAId0Oo7utFtKlFyztOHZ4t TX94zfbzc2dZg+BcTQNg0mM7yXTzV0q6NcVjgwds= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2087.outbound.protection.outlook.com [40.107.15.87]) by sourceware.org (Postfix) with ESMTPS id D0F613858D28 for ; Mon, 7 Aug 2023 07:00:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0F613858D28 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UWG3XraxDNKVdxjsmLzyy20ycB4H1Q6q3MZy7S9bXCjc/sm/3+dN1QPR0Akj03jC9f3Z9GUpeklXeuQSLEeGFHkZS10XMv1txD45pQIJA4/wcUowCn6G4Jik8F2cPw79sajW4tRt9TkYVgyy3pvo5I0H26LMprI4K1m4h5DBZJftySxQBQxvHpoADoJ+YTyeN6nZnIuxlAcDLPv3A/MTcf96OXhQdqmDEAYX+92Z7OiPQuJuSHXSnP78ngscyxO5Jc+qJFMe4qMvcUWXq0Vx2aAFPOc3BGEIQUaw/FQFky6HKAynsuN0Ihe7tKpDlVfCJeiYxShPWwCcjD9mmLH0BQ== 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=2Nx3wiFIAF1nU/kHPqWVniDMoMSWk+NcI4AZIPK42XA=; b=Gotvosa2L852+2tfdt/r6nICqyzxJ0VtRAvA+ef+50z6FRe+2/ovtoEinSrh5F9WQf9zHqlBNW6kjm6d+TSiHSccaSnQV6Sw2pIlkcAGzufzZw5HHX6MtKAUIujAlsR+JteVaEfutMwrpAGtmgqRJ36keUsqF7FtVzvuZf7tSMBv2mjel0z6u4J5TsJVahRF4Vv6KtwMeIwgZC1LuKqWFmlHOzobrc2AAHC/qaUe8f60QkkoLBeJX6RzyUBuCjT0G7bCJOela/ai282nya3roz7cN2kchQHJZUoni3nzuGebe9jw4aRyP1BDxFl8v8UvdS/o11QiJUtJNSoLQKOS5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by VI1PR04MB9738.eurprd04.prod.outlook.com (2603:10a6:800:1dc::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.44; Mon, 7 Aug 2023 07:00:11 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::e5cf:5743:ab60:b14e]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::e5cf:5743:ab60:b14e%5]) with mapi id 15.20.6652.025; Mon, 7 Aug 2023 07:00:10 +0000 Message-ID: <296de87b-cb6d-004e-bedc-d509c6361080@suse.com> Date: Mon, 7 Aug 2023 09:00:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Content-Language: en-US To: Binutils Cc: Palmer Dabbelt , Andrew Waterman , Jim Wilson , Nelson Chu Subject: [PATCH] RISC-V: move comment describing rules for riscv_opcodes[] X-ClientProxiedBy: FR2P281CA0134.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9e::13) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|VI1PR04MB9738:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e40118b-6cc4-4bad-b536-08db9713f0d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +nePbarJJehIBDVRppBPrpBbKPwpcBeGVG8K9dy1vEA36vCd054oG/MaNzCoVE9P/8FnGbypn0djtAVCfjmWme0e/MI0Q+K3L9yPV5GCkQc5YEcX0aMvnxZRO6y1z34jsJLKDYV/VyWT02IFPM/y1ewN4VnRAEfkAYpAghK/y2Mqjx/WqpQjUVuJ3pEilvcy8l9t7SubmynbODW6ytOMjLs7rJXk2q1e6o3S4TJnz2QDLKqORom45itxDB8Mned4DnRirdZXQ1ff1VYhGXpaqDmtMJNCEs/M0jSZXWm8aMqFlHjh4TPGjEK0gxsPs08eFDzHaaml/44iY1QpJnh95tHHSOjsMdcIfmkgFKuJMsBGD67hCHuj6m0rSFQzZ4F0ijhwIAg/wR31i7jqoD1KMTIRctdF4DyD52qo8Jop32QiXMhz2Ps/qvSZ3S/nwyObm40BTjLtyEIWKWa+DTCnSx47coOMDjC2NEBONBxTMFRRHPWgZF350hYy0Ri55DmIw3jK49pgL3M8X2PJh5kRdZZGt6A9zN2iDzza4k9ebXYovUywJsyyNunCfgZwSFCtZ46tmPMf2RzAQWyH3hF59oljIYrvqVZ631BYCCw9lMjYqGhh8sqw9tCjLYcMK8zxGc8Xk35V7FLLuVZMYYnwUg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8790.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(376002)(396003)(39850400004)(366004)(346002)(1800799003)(186006)(451199021)(31686004)(36756003)(6486002)(8676002)(41300700001)(31696002)(478600001)(8936002)(2906002)(2616005)(83380400001)(26005)(316002)(86362001)(6506007)(5660300002)(38100700002)(6512007)(54906003)(6916009)(4326008)(66556008)(66476007)(66946007)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?HZsY5XTvzY/PaHUEXG0IBZ6mrbOw?= =?utf-8?q?Dnt4lYjfRZUKdKQxKl9/ncmSElhGWl+VXSCOx8syz+8u8zKkA0ouWfhBYQdzB9luE?= =?utf-8?q?f/m5m3yAsbGVVC5s13n516VpX2+zrAP0lMm//KVNrVsY0DZu6FV5PvKCLHVDXJPV6?= =?utf-8?q?Hka0FIE858bNkEIsaETxtRHRpwt1gUR6UYXZFWO96m95QmIE8N7NQv7wLte2a1+gk?= =?utf-8?q?ogyUi5ohnxSwi54epmxMhxH8PANKnJW7fa8mJNTli66tXcxGaPHtWH74MLBPGh2B1?= =?utf-8?q?MEfmqUf/Dgz6huGYYpqC3MUkFelWDUOiNBVwdTVp0TcS2mtb1biOh1ZWZXHuOcxaI?= =?utf-8?q?OG7/pU39V/f3U4ZvzGG9UtuyuIEGPzzbB+xi/iNpCJZbE2Hxo/G79sEK4Fa+J6tkp?= =?utf-8?q?O9aLtlF5flN2jDfa56S+zz2PcXi+RI3AogRucf395jsO9sm19ka6+c7i8V1Yaej3x?= =?utf-8?q?gH9fOng1kMYk6xDftqtoFqRmeAW/OR8WuMFUcDbcgmz2Dii8ujKlUXzkW1bWiNW5V?= =?utf-8?q?Cc77w/jKo9C2hTqUbMt6FruEUTv2FZX4E4Y0V0nWvsq1ao0ZBenLBbJUQivfj0jJg?= =?utf-8?q?pDbpKLRMoYjQjhzSNuNpvDsEwKj5JmP7dfyl7M+HOC1Q7DdFxpZ1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xerqkmBr1A1JK6I0NYiJco?= =?utf-8?q?IEcm35Urvsp9?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e40118b-6cc4-4bad-b536-08db9713f0d7 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 07:00:10.5477 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +qx66W78Lh7SHtunAZ0d+fa0rk1Fb9n0+H4km4bOsOE6GWBi/z8GA5zzsrV1n7O/E85WrIS812PSIgwYbfg5hQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9738 X-Spam-Status: No, score=-3027.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jan Beulich via Binutils From: Jan Beulich Reply-To: Jan Beulich Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773552663862882484 X-GMAIL-MSGID: 1773552663862882484 It makes little sense to have this comment meanwhile over a hundred lines ahead of the array. In fact until spotting the comment, I was wondering why those pretty important aspects aren't spelled out anywhere. --- a/opcodes/riscv-opc.c +++ b/opcodes/riscv-opc.c @@ -131,16 +131,6 @@ const float riscv_fli_numval[32] = 0x1p+3, 0x1p+4, 0x1p+7, 0x1p+8, 0x1p+15, 0x1p+16, 0x0p+0, 0x0p+0 }; -/* The order of overloaded instructions matters. Label arguments and - register arguments look the same. Instructions that can have either - for arguments must apear in the correct order in this table for the - assembler to pick the right one. In other words, entries with - immediate operands must apear after the same instruction with - registers. - - Because of the lookup algorithm used, entries with the same opcode - name must be contiguous. */ - #define MASK_RS1 (OP_MASK_RS1 << OP_SH_RS1) #define MASK_RS2 (OP_MASK_RS2 << OP_SH_RS2) #define MASK_RD (OP_MASK_RD << OP_SH_RD) @@ -329,6 +319,16 @@ match_th_load_pair(const struct riscv_op return rd1 != rd2 && rd1 != rs && rd2 != rs && match_opcode (op, insn); } +/* The order of overloaded instructions matters. Label arguments and + register arguments look the same. Instructions that can have either + for arguments must apear in the correct order in this table for the + assembler to pick the right one. In other words, entries with + immediate operands must apear after the same instruction with + registers. + + Because of the lookup algorithm used, entries with the same opcode + name must be contiguous. */ + const struct riscv_opcode riscv_opcodes[] = { /* name, xlen, isa, operands, match, mask, match_func, pinfo. */