From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 17C4D3858D20 for ; Sat, 21 Oct 2023 02:17:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17C4D3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 17C4D3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2401:2500:203:30b:4000:6bfe:4757:0 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697854658; cv=none; b=UFP5pdZHav6+IjyZh82NMJUf1CSaXHn6CXTnD++CVFjPrhUOVr0yZ+pauwlLaYGomrwBIcnn1Nz3hRvM14EvybYu+ZlgTbK1sqBv5RU/L7FMSi8C744Xb2XVkmunz+laAVrThmLwNmXyGWFniz4E+Fo2U45tNMZUF4ys0frG7AA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697854658; c=relaxed/simple; bh=woVF27ZBZ6ZiiaeUzVJJSivLBuJdDDGjM42pVARM1IA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=SwJx6WoDjqZq6Yl2fsMckMEwkei6MAWorNXVm1oAUav4/4RwfBKjZ8j2V1uYg7DzOww+8GUdpfl8OAWU/vVsO6XZEiteKwGkSsY2vNgLMJRH6FLQB/nRoJIrabVTbDseR/Tw/r70FKe2LRulfCy0mUnHU+sumxh1fmKDONhTpDY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id E91C0300089; Sat, 21 Oct 2023 02:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1697854646; bh=ZbHkM2RN0GeHmJ0U02LrNXVt9IoX5ZJsa3sA9wKRZQ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=GXcHsTV1mY9XdStF+j8ry+FIKFutMwDKSS5SNp0QHcKMHKisi4izRcnkrOjhSRceJ lI3rb3t8vn4K+BCURn4Q7PeF2reVlcjHnXUCc5luwAltQ0B5vDViNoUqGG+dnnI9br J0KkcHgZuXbDs6E1d7fEaZAy82toCZcEKNoa9i7M= From: Tsukasa OI To: Tsukasa OI , Palmer Dabbelt , Andrew Waterman , Jim Wilson , Nelson Chu , Kito Cheng Cc: binutils@sourceware.org Subject: [PATCH v2 0/1] RISC-V: Add 'Zicntr' and 'Zihpm' support with compatibility measures Date: Sat, 21 Oct 2023 02:17:19 +0000 Message-ID: In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KAM_MANYTO,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, This patch adds support for two extensions, split from the RISC-V Unprivileged ISA version 2.2: 1. `Zicntr` Basic hardware performance counters 2. `Zihpm` Platform-specific configurable hardware performance counters but the compatibility is vital. This patch set tries to deal with the compatibility issues as possible. RFC PATCH v1: PATCH v1 (the implementation is detailed in this cover letter): PATCH v2 fixes some test failures when compiled with -with-isa-spec=2.2 just like Nelson found some test failures and fixed in the commit 4352c0ac04a6 ("RISC-V: Make sure rv32q conflict won't affect the zfa gas testcases."). csr-insns-pseudo-nozicntr.d Specified the extension version (without any -misa-spec option) to make sure that we test "no subset" behavior on 'I' >= version 2.1. csr-version-{1p9p1,1p10,1p11,1p12}.d Specified the extension versions to make sure that we are working on the 'I' >= version 2.1 (also specified the version of 'Zicsr' but this is only for consistency). march-imply-i2p0-01.d 'I' version 2.0 effectively imples 'Zicsr' and 'Zifencei' but should not be reflected to the expanded architectural string because features of 'Zicsr' and 'Zifencei' are parts of 'I' version 2.0. This change make sures that we removed the dependency to -misa-spec option and the behavior only depends on the version of 'I' (despite that -misa-spec=20191213). march-ok-reorder.d Use 'I' version 2.1. To test ordering of 'Zi*' extensions, PATCH v2 specifies "zifencei_zicsr" (intentionally reverse of the canonical order) to make sure that the expanded architectural string has "zicsr2p0_zifencei2p0". It also fixes a minor grammar error on the commit message. Thanks, Tsukasa Tsukasa OI (1): RISC-V: Add 'Zicntr' and 'Zihpm' support with compatibility measures bfd/elfxx-riscv.c | 52 +++- gas/config/tc-riscv.c | 25 ++ .../gas/riscv/csr-insns-pseudo-noalias.d | 2 +- .../gas/riscv/csr-insns-pseudo-nozicntr.d | 37 +++ .../gas/riscv/csr-insns-pseudo-nozicntr.l | 7 + .../gas/riscv/csr-insns-pseudo-zfinx.d | 2 +- gas/testsuite/gas/riscv/csr-insns-pseudo.d | 2 +- gas/testsuite/gas/riscv/csr-insns-pseudo.s | 3 +- gas/testsuite/gas/riscv/csr-insns-read-only.d | 2 +- gas/testsuite/gas/riscv/csr-version-1p10.d | 2 +- gas/testsuite/gas/riscv/csr-version-1p10.l | 256 ++++++++++++++++++ gas/testsuite/gas/riscv/csr-version-1p11.d | 2 +- gas/testsuite/gas/riscv/csr-version-1p11.l | 256 ++++++++++++++++++ gas/testsuite/gas/riscv/csr-version-1p12.d | 2 +- gas/testsuite/gas/riscv/csr-version-1p12.l | 256 ++++++++++++++++++ gas/testsuite/gas/riscv/csr-version-1p9p1.d | 2 +- gas/testsuite/gas/riscv/csr-version-1p9p1.l | 256 ++++++++++++++++++ gas/testsuite/gas/riscv/march-imply-i2p0-01.d | 2 +- gas/testsuite/gas/riscv/march-ok-reorder.d | 4 +- include/opcode/riscv-opc.h | 128 ++++----- include/opcode/riscv.h | 1 + opcodes/riscv-opc.c | 12 +- 22 files changed, 1224 insertions(+), 87 deletions(-) create mode 100644 gas/testsuite/gas/riscv/csr-insns-pseudo-nozicntr.d create mode 100644 gas/testsuite/gas/riscv/csr-insns-pseudo-nozicntr.l base-commit: 0e17d3fc080f543d81e6c2520ba0bd8046ea3a95 -- 2.42.0