From patchwork Sat Nov 12 21:29:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Tomsich X-Patchwork-Id: 1556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1434512wru; Sat, 12 Nov 2022 13:31:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf7jBSYMAYbjcm/0nh6uMPeeFbcDY6kXJW823RzF9sZ14+PW4T21G1niQ3oAf3xb+F0bx32d X-Received: by 2002:a17:906:5f8d:b0:7ad:917b:61ec with SMTP id a13-20020a1709065f8d00b007ad917b61ecmr6132411eju.513.1668288673318; Sat, 12 Nov 2022 13:31:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668288673; cv=none; d=google.com; s=arc-20160816; b=B6OyteWYzRo41j6vySpGarVQlzSwIo88iY4G9aMiqRVxTgRGK8++opWLu2Cs/kxaUB QZR6QFHbMwMsWlwWUjvQxu4P/KD+e2wG6/gDwJacipyHeXmycnYW65UrSMBzhXeMuLpW HdOtiAYHfbB42snFqSeBB7JKjpW0jjxcQUotU23LTpT0ixeDN+K1dmvYdjrL6AODgj/4 oYQXqInVq4IpDHsx3wQ/+zI4SElZf4GjEV6p9LhhWstfCZCSsD4ggyqclot7b7LVSlCe W9jblKjO4hflD5UtrgHXwxi0HBf6qTpVZlhbX96KV6xxTUSwaPH1QOpAdbuufdFwCmB3 KI6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender: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 :dmarc-filter:delivered-to; bh=ha1Kn3UyZtODs5gWk8IKG4z9QLwd+DexszL03GuNSl0=; b=echjOi29jJntvaK5IUdN+0Zqm2w7B7fDOnUeFeCnNNNU3Ac2TVXctji7PcneWiofwi +hfLJh9kgasB6whWqx5RAyRvI73NfnQ793Vl6/+vBzpeaR/Ikx1RYHz8fat+CnDa1TLA 0tmZtmXgWJgXCF+6PRl/N4wYoDNYS9igaSNZEA1HxD/SHnvFS0bEknG8ChCfINZt3YZr /WYDN4YZi5Bb0EsXvCHb2+mgnQkZqMoILQbcnTaKIywpplu+IVmcSSbB/2xArhrBEn1V KsbRTtMoSrbgtzH9AOVCBWgESojUicK6+iFyaaFlhD/DMupmg30yW+lhAQC1d5zzIeve T5ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=rxJ2gWpt; 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" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ho30-20020a1709070e9e00b0078e9ca562d8si5902425ejc.879.2022.11.12.13.31.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 13:31:13 -0800 (PST) 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=@vrull.eu header.s=google header.b=rxJ2gWpt; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A94453895FE3 for ; Sat, 12 Nov 2022 21:30:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id 56937385842C for ; Sat, 12 Nov 2022 21:29:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 56937385842C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-lj1-x22f.google.com with SMTP id s24so8353445ljs.11 for ; Sat, 12 Nov 2022 13:29:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ha1Kn3UyZtODs5gWk8IKG4z9QLwd+DexszL03GuNSl0=; b=rxJ2gWptkj3L2OpGXtowj34m98zIFPh2pFDPFLDjRe5L9X7G/+7tvGpesqZKvRdFsS f36mNDXz6pphtr/u/wDq3PeCyjcgrK2mrNsmUdUV6EJdlxi783pILY3A2277UJGkFF20 GOzcStR+1YjFwjP2Rn9m4JBPMcyJDVm/YR4B6CqS+b7QRGYAl5gyKOvewaxgkgJYCi0Z pHYvrslS/0PFJbSl4tABPbLTQ6l9RHSxsioRUoff8ZZy1gYz68hFpb0tlyIAAjG3Lafm FE6vWz3AnWQXzZHZfzeVMsGf8pj7fP9yf+DIH0hTrv1xvgJsWJh3poef5GFpojAH4hQU 1U3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ha1Kn3UyZtODs5gWk8IKG4z9QLwd+DexszL03GuNSl0=; b=kkxwPXNHwRBeslGjcfmu/8g+bC8MuRuUCnTQeguq+B9b6cFkTewQt9+kukn05RM35j /JcT0yeqNOZRiifFBMSTl8UbJ2khpGAhYfqm+p5Hbp+fBkLEsSUrmDd2Gu/6VOytNRrC YlD/uZpGtCZ84f76lgYbTt0b1KlOnBSIpC4QU6KMdR1P5WYHc3daK2JpBWty15UU5J2Y Dtu9S1dd7uoKBrHo7USiVnw5rd2/dx/xqBpioKElgp1bcU3lnl6xAqq+nSmUhg0GLPTY gixquVX9hw7qUKOQ+UHeXeJetL8/pfsB7aHKjYB9egkKQj6WUmzHHnHJeCCnMCbVbG4R YEnA== X-Gm-Message-State: ANoB5pkJ7BNfg/dzMjSjFcCQMBQRegYnQNGJA47JvxOcpOYI0rR7f/jG IbIZks0vFWz5S44jfGBOFG48B4Qktk7UMCcY X-Received: by 2002:a2e:b706:0:b0:277:d75:f1de with SMTP id j6-20020a2eb706000000b002770d75f1demr2471325ljo.272.1668288587243; Sat, 12 Nov 2022 13:29:47 -0800 (PST) Received: from ubuntu-focal.. ([2a01:4f9:3a:1e26::2]) by smtp.gmail.com with ESMTPSA id b9-20020a0565120b8900b004a4251c7f75sm1042967lfv.202.2022.11.12.13.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 13:29:46 -0800 (PST) From: Philipp Tomsich To: gcc-patches@gcc.gnu.org Cc: Vineet Gupta , Palmer Dabbelt , Christoph Muellner , Kito Cheng , Jeff Law , Philipp Tomsich Subject: [PATCH 0/7] RISC-V: Backend support for XVentanaCondOps/ZiCondops Date: Sat, 12 Nov 2022 22:29:36 +0100 Message-Id: <20221112212943.3068249-1-philipp.tomsich@vrull.eu> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, JMQ_SPF_NEUTRAL, KAM_SHORT, RCVD_IN_DNSWL_NONE, 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.29 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 Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749327464111340999?= X-GMAIL-MSGID: =?utf-8?q?1749327464111340999?= Both the XVentanaCondOps (a vendor-defined extension from Ventana Microsystems) and the proposed ZiCondOps extensions define a conditional-zero(-or-value) instruction, which is similar to the following C construct: rd = rc ? rs : 0 This functionality can be tied back into if-convertsion and also match some typical programming idioms. This series includes backend support for XVentanaCondops and infrastructure to handle conditional-zero constructions in if-conversion. Tested against SPEC CPU 2017. Philipp Tomsich (7): RISC-V: Recognize xventanacondops extension RISC-V: Generate vt.maskc on noce_try_store_flag_mask if-conversion RISC-V: Support noce_try_store_flag_mask as vt.maskc RISC-V: Recognize sign-extract + and cases for XVentanaCondOps RISC-V: Recognize bexti in negated if-conversion RISC-V: Support immediates in XVentanaCondOps ifcvt: add if-conversion to conditional-zero instructions gcc/common/config/riscv/riscv-common.cc | 2 + gcc/config/riscv/predicates.md | 12 + gcc/config/riscv/riscv-opts.h | 3 + gcc/config/riscv/riscv.cc | 14 ++ gcc/config/riscv/riscv.md | 27 +++ gcc/config/riscv/riscv.opt | 3 + gcc/config/riscv/xventanacondops.md | 150 ++++++++++++ gcc/ifcvt.cc | 214 ++++++++++++++++++ .../gcc.target/riscv/xventanacondops-and-01.c | 16 ++ .../gcc.target/riscv/xventanacondops-and-02.c | 15 ++ .../gcc.target/riscv/xventanacondops-eq-01.c | 11 + .../gcc.target/riscv/xventanacondops-eq-02.c | 14 ++ .../riscv/xventanacondops-ifconv-imm.c | 19 ++ .../gcc.target/riscv/xventanacondops-le-01.c | 17 ++ .../gcc.target/riscv/xventanacondops-lt-01.c | 16 ++ .../gcc.target/riscv/xventanacondops-lt-03.c | 17 ++ .../gcc.target/riscv/xventanacondops-ne-01.c | 11 + .../gcc.target/riscv/xventanacondops-ne-03.c | 15 ++ .../gcc.target/riscv/xventanacondops-ne-04.c | 15 ++ .../gcc.target/riscv/xventanacondops-xor-01.c | 14 ++ 20 files changed, 605 insertions(+) create mode 100644 gcc/config/riscv/xventanacondops.md create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-and-01.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-and-02.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-eq-01.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-eq-02.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-ifconv-imm.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-le-01.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-lt-01.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-lt-03.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-ne-01.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-ne-03.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-ne-04.c create mode 100644 gcc/testsuite/gcc.target/riscv/xventanacondops-xor-01.c