From patchwork Mon Oct 23 07:22:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsukasa OI X-Patchwork-Id: 156696 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1127736vqx; Mon, 23 Oct 2023 00:24:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJ4hiVT3Cc9BBX0dYPLlh6fxXbjIQatvL0wcEylyJVlqukaRIz7/05gHX+bgP7tovrzP1h X-Received: by 2002:a05:6830:2b2a:b0:6c4:9fda:a1e2 with SMTP id l42-20020a0568302b2a00b006c49fdaa1e2mr7615432otv.4.1698045892427; Mon, 23 Oct 2023 00:24:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698045892; cv=pass; d=google.com; s=arc-20160816; b=Y3g2rrf+nrWlP5hnQWyzEo6oUum36tzCJuUmMk/PuwEVSeKL0oIM2m+PyXQC2YEg/R c1ARgJIScOpTMQsK6grVLDsYdMelHKM5tWiS2GjrJVwfevPxcdBvQUs8xAMY7ujHo+w4 VgmMOM0ZETxU4BWFK54tyrbswZVBVJ9mlk+UH0uWqfhdS73Ll58hNrnjk+4RSfHu+3cN cQHXpH06nQijjFIuHH/IkHbm6JTo0rmcN3E/KQnxzBK6Nv1Nm8MdiHsi9fYji9pmTlqt Rvnra7FQwGB71Eq+RLYNMQQV4Lr8DCfrWMyOk4ne4U8+IboNCrJBJ4zrEM9LkT4f8Y+f yt+w== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=/sByrfCqrpew7oPmI2LSfvIOCwoFsZr3LOzXBRvp3Pw=; fh=HKgiOHUFLyfVG2npWMLYE8/3Ecp4EiEdadhQOzpm3aI=; b=yGtu9KrCzVrvpn8ZKT9TzPQFnTWAiM9N5v/CrQ8bWcaYlt3j1mt8zMo4twt+c0rdtr UHgDFJbyiuDy1tyfw6XDBzsx9As/qAPOrGCztV+Y6yp10aShCJFqRwIGuqlRGaWE1img Tc5jAbpRYcW2e/0o4aycq9TZBUV/Gd6zIBT8yXisscbLnP5lenV0YmLG+ThjYtViH0Cr 2NJJFyTQz+CLjQdD1GUJ5SBTFX4HW5ZgSQwaTFF011CC5wehKuIJgQjMOivg7IyDxYBb YDi6Uq9/vbx30gMlhyN7daNzX8Z6Kp6J4LWKzZAO2Vhgi+vr4goMAiWo11jbJ8C0k1Yt 7dvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@irq.a4lg.com header.s=2017s01 header.b=DIRBwGXS; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s19-20020a05622a179300b004181127a232si5148865qtk.651.2023.10.23.00.24.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 00:24:52 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.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=@irq.a4lg.com header.s=2017s01 header.b=DIRBwGXS; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 50E363861938 for ; Mon, 23 Oct 2023 07:24:38 +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 F0F033857806 for ; Mon, 23 Oct 2023 07:24:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F0F033857806 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 F0F033857806 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=1698045854; cv=none; b=SEG8IXVkXN9W5+HA+7/M10Ynm3BQQYisba6YDkzxtV1ZNH50CK+AtzDLW17jJ4dgWtPOLqHc3c4pCQPGbrz0PbkAnlaON6c86IZz40txGz1BWf2lsFJdy5kDaxV3IC+slvjgGbNjqvZ9gpcy/9D6xCXNZd6ebgSYN+1NJhI3s0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698045854; c=relaxed/simple; bh=TPJyI7T6QGh26ngygK2EMlwu0c0W51fIvfuzy4QlDb8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=cAdB/EoeLxR1IodhXnUyXshWuFFsQRt62SurQwkq6d9C3kdwfvA21EQzv3Zqh8vwmDBGYsq2kZcWuaYjdR5jNxJBSNwhKYsOsCZRDrrDrOE04JTYK4KtqziAwEo++yIiTJnskDXmrgcmYjeYoRbnlAnMov9wLphqWR1uqsGtArI= 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 10C63300089; Mon, 23 Oct 2023 07:24:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1698045851; bh=/sByrfCqrpew7oPmI2LSfvIOCwoFsZr3LOzXBRvp3Pw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=DIRBwGXSUesomGE6HoT1LGKNp7q4arJ9LJE4UQyHjEh3wAwmhXD0BSvpiBsmwcLOD HlUTQV7jiUkHNl9v339ZjV9OgHeey05ayARbukrumsP23cGpQDokf8J7xk+wkIiNEg Jr5EgmQF+MuLcn7pZUmwhi0/ZRrN/2sbjaHwfAAk= From: Tsukasa OI To: Tsukasa OI , Kito Cheng , Palmer Dabbelt , Andrew Waterman , Jim Wilson , Jeff Law Cc: gcc-patches@gcc.gnu.org Subject: [PATCH 2/4] RISC-V: Remove broken __builtin_riscv_zicbop_cbo_prefetchi Date: Mon, 23 Oct 2023 07:22:53 +0000 Message-ID: <68ebe422ceb2c408006b2acab94de569cf8d0e78.1698045769.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, KAM_MANYTO, KAM_SHORT, SPF_HELO_NONE, 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: 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: 1780530169617896313 X-GMAIL-MSGID: 1780530169617896313 From: Tsukasa OI __builtin_riscv_zicbop_cbo_prefetchi (corresponding "prefetch.i" instruction from the 'Zicbop' extension) is completely broken (not even functional) and should be removed rather than fixing it because it has no good way to "fix" this built-in function. gcc/ChangeLog: * config/riscv/riscv-cmo.def (__builtin_riscv_zicbop_cbo_prefetchi): Remove since it's broken. * config/riscv/riscv.md (unspecv) Remove UNSPECV_PREI. (riscv_prefetchi_): Remove. gcc/testsuite/ChangeLog: * gcc.target/riscv/cmo-zicbop-1.c: Remove references to __builtin_riscv_zicbop_cbo_prefetchi. * gcc.target/riscv/cmo-zicbop-2.c: Ditto with minor tidying. --- gcc/config/riscv/riscv-cmo.def | 4 ---- gcc/config/riscv/riscv.md | 9 --------- gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c | 6 ------ gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c | 8 +------- 4 files changed, 1 insertion(+), 26 deletions(-) diff --git a/gcc/config/riscv/riscv-cmo.def b/gcc/config/riscv/riscv-cmo.def index 017370d1d0e3..dbd5d2f0d9eb 100644 --- a/gcc/config/riscv/riscv-cmo.def +++ b/gcc/config/riscv/riscv-cmo.def @@ -12,10 +12,6 @@ RISCV_BUILTIN (inval_di, "zicbom_cbo_inval", RISCV_BUILTIN_DIRECT_NO_TARGET, RIS RISCV_BUILTIN (zero_si, "zicboz_cbo_zero", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE_VOID_PTR, zero32), RISCV_BUILTIN (zero_di, "zicboz_cbo_zero", RISCV_BUILTIN_DIRECT_NO_TARGET, RISCV_VOID_FTYPE_VOID_PTR, zero64), -// zicbop -RISCV_BUILTIN (prefetchi_si, "zicbop_cbo_prefetchi", RISCV_BUILTIN_DIRECT, RISCV_USI_FTYPE_USI, prefetch32), -RISCV_BUILTIN (prefetchi_di, "zicbop_cbo_prefetchi", RISCV_BUILTIN_DIRECT, RISCV_UDI_FTYPE_UDI, prefetch64), - // zbkc or zbc RISCV_BUILTIN (clmul_si, "clmul", RISCV_BUILTIN_DIRECT, RISCV_USI_FTYPE_USI_USI, clmul_zbkc32_or_zbc32), RISCV_BUILTIN (clmul_di, "clmul", RISCV_BUILTIN_DIRECT, RISCV_UDI_FTYPE_UDI_UDI, clmul_zbkc64_or_zbc64), diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index 23d91331290b..4b445cb8be9c 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -118,7 +118,6 @@ UNSPECV_FLUSH UNSPECV_INVAL UNSPECV_ZERO - UNSPECV_PREI ;; Zihintpause unspec UNSPECV_PAUSE @@ -3493,14 +3492,6 @@ } [(set_attr "type" "cbo")]) -(define_insn "riscv_prefetchi_" - [(unspec_volatile:X [(match_operand:X 0 "address_operand" "r") - (match_operand:X 1 "imm5_operand" "i")] - UNSPECV_PREI)] - "TARGET_ZICBOP" - "prefetch.i\t%a0" - [(set_attr "type" "cbo")]) - (define_expand "extv" [(set (match_operand:GPR 0 "register_operand" "=r") (sign_extract:GPR (match_operand:GPR 1 "register_operand" "r") diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c index c5d78c1763d3..54b764fb7452 100644 --- a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c @@ -13,11 +13,5 @@ void foo (char *p) __builtin_prefetch (p, 1, 3); } -int foo1() -{ - return __builtin_riscv_zicbop_cbo_prefetchi(1); -} - -/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */ /* { dg-final { scan-assembler-times "prefetch.r" 4 } } */ /* { dg-final { scan-assembler-times "prefetch.w" 4 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c index 6576365b39ca..917adc8f2008 100644 --- a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c @@ -13,11 +13,5 @@ void foo (char *p) __builtin_prefetch (p, 1, 3); } -int foo1() -{ - return __builtin_riscv_zicbop_cbo_prefetchi(1); -} - -/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */ /* { dg-final { scan-assembler-times "prefetch.r" 4 } } */ -/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */ +/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */