53 lines · plain
1//===-- RISCVInstrInfoZicond.td ----------------------------*- tablegen -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// This file describes the RISC-V instructions from the standard Integer10// Conditional operations extension (Zicond).11//12//===----------------------------------------------------------------------===//13 14//===----------------------------------------------------------------------===//15// RISC-V specific DAG Nodes.16//===----------------------------------------------------------------------===//17 18// Branchless select operations, matching the semantics of the instructions19// defined in Zicond or XVentanaCondOps20def riscv_czero_eqz : RVSDNode<"CZERO_EQZ", SDTIntBinOp>; // vt.maskc for XVentanaCondOps.21def riscv_czero_nez : RVSDNode<"CZERO_NEZ", SDTIntBinOp>; // vt.maskcn for XVentanaCondOps.22 23//===----------------------------------------------------------------------===//24// Instructions25//===----------------------------------------------------------------------===//26 27let Predicates = [HasStdExtZicond] in {28def CZERO_EQZ : ALU_rr<0b0000111, 0b101, "czero.eqz">,29 Sched<[WriteIALU, ReadIALU, ReadIALU]>;30def CZERO_NEZ : ALU_rr<0b0000111, 0b111, "czero.nez">,31 Sched<[WriteIALU, ReadIALU, ReadIALU]>;32} // Predicates = [HasStdExtZicond]33 34//===----------------------------------------------------------------------===//35// Pseudo-instructions and codegen patterns36//===----------------------------------------------------------------------===//37 38let Predicates = [HasStdExtZicond] in {39def : Pat<(XLenVT (riscv_czero_eqz GPR:$rs1, GPR:$rc)),40 (CZERO_EQZ GPR:$rs1, GPR:$rc)>;41def : Pat<(XLenVT (riscv_czero_nez GPR:$rs1, GPR:$rc)),42 (CZERO_NEZ GPR:$rs1, GPR:$rc)>;43 44def : Pat<(XLenVT (riscv_czero_eqz GPR:$rs1, (riscv_setne (XLenVT GPR:$rc)))),45 (CZERO_EQZ GPR:$rs1, GPR:$rc)>;46def : Pat<(XLenVT (riscv_czero_eqz GPR:$rs1, (riscv_seteq (XLenVT GPR:$rc)))),47 (CZERO_NEZ GPR:$rs1, GPR:$rc)>;48def : Pat<(XLenVT (riscv_czero_nez GPR:$rs1, (riscv_setne (XLenVT GPR:$rc)))),49 (CZERO_NEZ GPR:$rs1, GPR:$rc)>;50def : Pat<(XLenVT (riscv_czero_nez GPR:$rs1, (riscv_seteq (XLenVT GPR:$rc)))),51 (CZERO_EQZ GPR:$rs1, GPR:$rc)>;52} // Predicates = [HasStdExtZicond]53