From patchwork Mon Oct 23 07:22:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsukasa OI X-Patchwork-Id: 15738 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1127580vqx; Mon, 23 Oct 2023 00:24:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAP14lVtYL3G909g9G7UhzDOimLtOXcTwjs/Jjrp2rpMqZtudDIPc14iNYoTPOhPewSiJu X-Received: by 2002:ad4:5f86:0:b0:66d:5ea8:a7ba with SMTP id jp6-20020ad45f86000000b0066d5ea8a7bamr11238058qvb.1.1698045860559; Mon, 23 Oct 2023 00:24:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698045860; cv=pass; d=google.com; s=arc-20160816; b=OQjEl8LIiA2EKbbFmSXDWb4DiyzieK9zlqa8tG94Amdjg0smWyy4WwjAiRwG9wCHum f5w6GCDeIZ8/OxQqpxOzem5wYO6nmVN48LRoQlOJMONViS1V7XpR0wmMfuF8v4ug+kum 8sbPA8eD8Hmioo555DiUpgA6AUF052wh3POkuR2OaYKLGx92kV7zaL6O8oRvbMzto4Qz mkQfYiPACqTq65rjkqK1HgFj1JhFgs98BW7bhl/nJnDY0AdUOKFkFTFxennSEnXH4qsn gg98RPSNMLZh7xclI3FIeDAMwtuqyRNuhwWrUuqPVfIHGBxYGILC69Y/6TMDFTDrSRru 7gOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=BEKlq3PUubjWsU/PQL6lSd51+EtQ0j/2en6vGjCB5+8=; fh=HKgiOHUFLyfVG2npWMLYE8/3Ecp4EiEdadhQOzpm3aI=; b=1Kvad7v7rrSW9inG4blOl1CwhtwixcSRAWzDVsmP2Go3ZDdyqg03ICq0RUKPekfNYa J2Lqik+R8FSDPNLM0+AAXUrMKaiAZVtjAPmyGG2AhsHgX+0EsdhLLKVUw6s1jtCw6O6J 6yiNeREMC/40wPQwhtegQyj5AgVs52nmnR2FKLvtGXmlzWSoaKwEY0otfJJMdJekqgAw erpFi0FTcuQieExMEcuiRLWvk6SLku2Ya8GmlX8/AA5pMA7ey/adbjl7gtoCAzkqiO/9 auQkESkULfoanybllQaAEtDfhp2e0PCTowyr9rNOTLnE2VaTDrQzTmSJLPTRzZ5EIJJw cQ1w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@irq.a4lg.com header.s=2017s01 header.b=XOGtphVb; 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=irq.a4lg.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id mf9-20020a0562145d8900b0065cffe26762si5264462qvb.319.2023.10.23.00.24.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 00:24:20 -0700 (PDT) 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=@irq.a4lg.com header.s=2017s01 header.b=XOGtphVb; 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=irq.a4lg.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 047BB3857006 for ; Mon, 23 Oct 2023 07:24:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 95E783858D39 for ; Mon, 23 Oct 2023 07:23:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 95E783858D39 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 95E783858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=153.120.152.154 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698045835; cv=none; b=q45DJc4r+UZA8DDhhBznXZYxpikpDUR069HmS727zsmcC3Z1cTsVolLcd2NWaTOwVnmDovuproYk1C/tIdnDukbI+CybDRs+sZKcKFo6DdgfHT5H5A3DOBA+YxPQj+MQbLLuegVushxOPENImHVbvXHGnGErSGrxwukJ0YegJE8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698045835; c=relaxed/simple; bh=AOnbnnYOpuJugjLVuPWL6gv4cVNDAiTyFCRaTM+SYeI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=AiQfDM1kkmvFedLB6g/0WbtXABxoSTiho/q9oBJIj0rAfH9l4/CtVNklBF6vFZBjCRd5DDuZpnESdDlC1QgLu2rZiplftQsCzItCRWu/ZhrnDk9Z/vToJaWeXETkiEmDWjDoO68T9wAds82JmCPi2vriWGZ7pDsSw2ES76UggPU= 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 8766D300089; Mon, 23 Oct 2023 07:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1698045829; bh=BEKlq3PUubjWsU/PQL6lSd51+EtQ0j/2en6vGjCB5+8=; h=From:To:Cc:Subject:Date:Message-ID:Mime-Version: Content-Transfer-Encoding; b=XOGtphVb1iMXJIME/PM9+/ZBCKTZ2RCrr5d5eHzIFpjYPSBKwtkev3YlQzQAHNFds lFUO6CsA3tMxRkClYCZ/JoGjJrWiXzRBiSydP1O4ae3Z+jyGbB9sOK0ghUIKrJ/rK3 Dir35m0ssK6F29BAhqBVlqCiTC102844MQk0Oe3U= From: Tsukasa OI To: Tsukasa OI , Kito Cheng , Palmer Dabbelt , Andrew Waterman , Jim Wilson , Jeff Law Cc: gcc-patches@gcc.gnu.org Subject: [PATCH 0/4] RISC-V: Fix 'Zicbop'-related bugs (fix ICE and remove broken built-in) Date: Mon, 23 Oct 2023 07:22:51 +0000 Message-ID: Mime-Version: 1.0 X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KAM_MANYTO, KAM_SHORT, 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 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780530136485311760 X-GMAIL-MSGID: 1780530136485311760 Hello, As I explained earlier: , the builtin function for RISC-V "__builtin_riscv_zicbop_cbo_prefetchi" is completely broken and should be removed. Also, I noted that: __builtin_prefetch built-in function with the first argument NULL or (not all but) some fixed addresses (like ((void*)0x20)) can cause an ICE. Instead of making not broken prefetch built-in functions, this patch set focuses on fixing those major bugs and intended for fast approval to make it to GCC 14 (except renaming "prefetch" availabilities for built-in functions). Thanks, Tsukasa Tsukasa OI (4): RISC-V: Recategorize "prefetch" availabilities RISC-V: Remove broken __builtin_riscv_zicbop_cbo_prefetchi RISC-V: Add not broken RW prefetch RTL instructions without offsets RISC-V: Fix ICE by expansion and register coercion gcc/config/riscv/riscv-builtins.cc | 4 +- gcc/config/riscv/riscv-cmo.def | 4 -- gcc/config/riscv/riscv.md | 56 +++++++++++++------ gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c | 6 -- gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c | 8 +-- .../riscv/cmo-zicbop-by-common-ice-1.c | 13 +++++ .../riscv/cmo-zicbop-by-common-ice-2.c | 7 +++ 7 files changed, 61 insertions(+), 37 deletions(-) create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-by-common-ice-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-by-common-ice-2.c base-commit: c2d41cdfeadb82d921b01c0e104d83f47e2262a2