From patchwork Sun Nov 13 21:20:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Tomsich X-Patchwork-Id: 55290 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5B80038A909E for ; Sun, 13 Nov 2022 21:21:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by sourceware.org (Postfix) with ESMTPS id 95F753857BB3 for ; Sun, 13 Nov 2022 21:20:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 95F753857BB3 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-lf1-x129.google.com with SMTP id p8so16327920lfu.11 for ; Sun, 13 Nov 2022 13:20:34 -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=2nEgGvUrQQLXIwM9qS9z8NYUlQJNh056cvAH81+oJQM=; b=YZbidUMerY02+0HRTroDIg5C9QSWSC/w18Mo2BTT7w4kEUpO9kGyp1mWOVGFQnC1cb 7tKuTZS35QgC+dgmvQxX7LI3bW7teT0Kp9zperMcfIVUq3O6LumOR5ePybkSwBGqcFlX Vv/8vgAiA9jmyINIIZauYqydDc7FdZYaojygJmz5jkC1MP8gKolSwhGfckh3s95OiOsq PTz/lXHP7+SgcM8+tGaSCcioBK4VxQY1MBBl09zswVHtt07FHGJ38pxcgm2PPAANaMX+ kPBrPmJ4pj4QObFQ2SaejW4eJHIrFTaPT6bVYOp2wxjjYjp1QnmWfTKHrtwnhROZwYtk Qd3Q== 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=2nEgGvUrQQLXIwM9qS9z8NYUlQJNh056cvAH81+oJQM=; b=TIW2WTqtcyrbMFh5BFvmM3PpC5OfOUO8vzqNUMj7grgvc7DopGJrmgm0u6QAb3A8vc M3MNaOzEAwOwQUAM+kZ2rUGS9VWangd/cU4qF0zW23RBght8kCOCLT+CmTkNrF8WNKt3 /l75943UbsJkcNR/IvMDnfdV9UBx6i/XIPPsqL+YnTc6vvlgD9+tmjQ7F6F0wfKAO+8S 1kTfB0QQfE9WyTNQSY1AXBbNOYVuAHokWy+9YBMF7RWwOv+2UoTvBswgfz1XtOOfmguq Udy4yVKIu0BJvl1f1gFLlL/UquJp9dkmZj7JArnR6iyePKu/oKQ++9+03jc65qa61xxf OEcw== X-Gm-Message-State: ANoB5pm+RxBtvXAV60/BNr09DlgVlCVAXVr4Byrose9oPVsW3QD/sEYW i6vQsvo0wkeR8FT8Zkw81meeXyi6Fw556HxY X-Google-Smtp-Source: AA0mqf5pAKdxoQOedpvjqKD35FyBa/+VMTh64FiiUMOIjKlNeBGa2Ih2/neEP6otrYcctqPtaUINlQ== X-Received: by 2002:ac2:51b6:0:b0:494:842e:3f6 with SMTP id f22-20020ac251b6000000b00494842e03f6mr3277156lfk.225.1668374432613; Sun, 13 Nov 2022 13:20:32 -0800 (PST) Received: from ubuntu-focal.. ([2a01:4f9:3a:1e26::2]) by smtp.gmail.com with ESMTPSA id d5-20020a0565123d0500b004948ddb4e4dsm1529079lfv.301.2022.11.13.13.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Nov 2022 13:20:31 -0800 (PST) From: Philipp Tomsich To: gcc-patches@gcc.gnu.org Cc: Jeff Law , Vineet Gupta , Kito Cheng , Christoph Muellner , Palmer Dabbelt , Philipp Tomsich Subject: [PATCH v2 0/8] RISC-V: Backend support for XVentanaCondOps/ZiCondops Date: Sun, 13 Nov 2022 22:20:21 +0100 Message-Id: <20221113212030.4078815-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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. Changes in v2: - Restore a (during rebase) dropped line to xventanacondops.md - Include the change to add xventanacondops to the VT1 code definition] as a separate patch. Philipp Tomsich (8): 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 RISC-V: Ventana-VT1 supports 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-cores.def | 2 +- 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 | 151 ++++++++++++ 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 | 16 ++ .../gcc.target/riscv/xventanacondops-lt-01.c | 16 ++ .../gcc.target/riscv/xventanacondops-lt-03.c | 16 ++ .../gcc.target/riscv/xventanacondops-ne-01.c | 10 + .../gcc.target/riscv/xventanacondops-ne-03.c | 13 ++ .../gcc.target/riscv/xventanacondops-ne-04.c | 13 ++ .../gcc.target/riscv/xventanacondops-xor-01.c | 14 ++ 21 files changed, 600 insertions(+), 1 deletion(-) 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