003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/lib/Target/RISCV
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
lib
/
Target
/
RISCV
/
📁
..
📁
AsmParser
📁
Disassembler
📁
MCTargetDesc
📄
RISCV.h
(1.82 KB)
📄
RISCV.td
(10.89 KB)
📄
RISCVAsmPrinter.cpp
(6.86 KB)
📄
RISCVCallLowering.cpp
(1.48 KB)
📄
RISCVCallLowering.h
(1.37 KB)
📄
RISCVCallingConv.td
(2.27 KB)
📄
RISCVExpandAtomicPseudoInsts.cpp
(21.27 KB)
📄
RISCVExpandPseudoInsts.cpp
(6.94 KB)
📄
RISCVFrameLowering.cpp
(28.44 KB)
📄
RISCVFrameLowering.h
(3.1 KB)
📄
RISCVISelDAGToDAG.cpp
(22.01 KB)
📄
RISCVISelDAGToDAG.h
(2.21 KB)
📄
RISCVISelLowering.cpp
(114.94 KB)
📄
RISCVISelLowering.h
(10.3 KB)
📄
RISCVInstrFormats.td
(10.36 KB)
📄
RISCVInstrFormatsC.td
(4.98 KB)
📄
RISCVInstrFormatsV.td
(7.57 KB)
📄
RISCVInstrInfo.cpp
(26.69 KB)
📄
RISCVInstrInfo.h
(5.88 KB)
📄
RISCVInstrInfo.td
(45.57 KB)
📄
RISCVInstrInfoA.td
(17.37 KB)
📄
RISCVInstrInfoB.td
(47.16 KB)
📄
RISCVInstrInfoC.td
(33.8 KB)
📄
RISCVInstrInfoD.td
(15.36 KB)
📄
RISCVInstrInfoF.td
(17.58 KB)
📄
RISCVInstrInfoM.td
(4.17 KB)
📄
RISCVInstrInfoV.td
(36.31 KB)
📄
RISCVInstructionSelector.cpp
(3.18 KB)
📄
RISCVLegalizerInfo.cpp
(870 B)
📄
RISCVLegalizerInfo.h
(1000 B)
📄
RISCVMCInstLower.cpp
(4.3 KB)
📄
RISCVMachineFunctionInfo.h
(2.43 KB)
📄
RISCVMergeBaseOffset.cpp
(11.06 KB)
📄
RISCVRegisterBankInfo.cpp
(1.04 KB)
📄
RISCVRegisterBankInfo.h
(1.22 KB)
📄
RISCVRegisterBanks.td
(537 B)
📄
RISCVRegisterInfo.cpp
(7.31 KB)
📄
RISCVRegisterInfo.h
(2.11 KB)
📄
RISCVRegisterInfo.td
(12.85 KB)
📄
RISCVSchedRocket32.td
(8.04 KB)
📄
RISCVSchedRocket64.td
(8.24 KB)
📄
RISCVSchedule.td
(7.34 KB)
📄
RISCVSubtarget.cpp
(2.63 KB)
📄
RISCVSubtarget.h
(5.37 KB)
📄
RISCVSystemOperands.td
(11.83 KB)
📄
RISCVTargetMachine.cpp
(6.17 KB)
📄
RISCVTargetMachine.h
(1.81 KB)
📄
RISCVTargetObjectFile.cpp
(4.13 KB)
📄
RISCVTargetObjectFile.h
(1.66 KB)
📄
RISCVTargetTransformInfo.cpp
(3.06 KB)
📄
RISCVTargetTransformInfo.h
(2.02 KB)
📁
TargetInfo
📁
Utils
Editing: RISCVInstrInfoM.td
//===-- RISCVInstrInfoM.td - RISC-V 'M' instructions -------*- tablegen -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file describes the RISC-V instructions from the standard 'M', Integer // Multiplication and Division instruction set extension. // //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // RISC-V specific DAG Nodes. //===----------------------------------------------------------------------===// def riscv_divw : SDNode<"RISCVISD::DIVW", SDTIntBinOp>; def riscv_divuw : SDNode<"RISCVISD::DIVUW", SDTIntBinOp>; def riscv_remuw : SDNode<"RISCVISD::REMUW", SDTIntBinOp>; //===----------------------------------------------------------------------===// // Instructions //===----------------------------------------------------------------------===// let Predicates = [HasStdExtM] in { def MUL : ALU_rr<0b0000001, 0b000, "mul">, Sched<[WriteIMul, ReadIMul, ReadIMul]>; def MULH : ALU_rr<0b0000001, 0b001, "mulh">, Sched<[WriteIMul, ReadIMul, ReadIMul]>; def MULHSU : ALU_rr<0b0000001, 0b010, "mulhsu">, Sched<[WriteIMul, ReadIMul, ReadIMul]>; def MULHU : ALU_rr<0b0000001, 0b011, "mulhu">, Sched<[WriteIMul, ReadIMul, ReadIMul]>; def DIV : ALU_rr<0b0000001, 0b100, "div">, Sched<[WriteIDiv, ReadIDiv, ReadIDiv]>; def DIVU : ALU_rr<0b0000001, 0b101, "divu">, Sched<[WriteIDiv, ReadIDiv, ReadIDiv]>; def REM : ALU_rr<0b0000001, 0b110, "rem">, Sched<[WriteIDiv, ReadIDiv, ReadIDiv]>; def REMU : ALU_rr<0b0000001, 0b111, "remu">, Sched<[WriteIDiv, ReadIDiv, ReadIDiv]>; } // Predicates = [HasStdExtM] let Predicates = [HasStdExtM, IsRV64] in { def MULW : ALUW_rr<0b0000001, 0b000, "mulw">, Sched<[WriteIMul32, ReadIMul32, ReadIMul32]>; def DIVW : ALUW_rr<0b0000001, 0b100, "divw">, Sched<[WriteIDiv32, ReadIDiv32, ReadIDiv32]>; def DIVUW : ALUW_rr<0b0000001, 0b101, "divuw">, Sched<[WriteIDiv32, ReadIDiv32, ReadIDiv32]>; def REMW : ALUW_rr<0b0000001, 0b110, "remw">, Sched<[WriteIDiv32, ReadIDiv32, ReadIDiv32]>; def REMUW : ALUW_rr<0b0000001, 0b111, "remuw">, Sched<[WriteIDiv32, ReadIDiv32, ReadIDiv32]>; } // Predicates = [HasStdExtM, IsRV64] //===----------------------------------------------------------------------===// // Pseudo-instructions and codegen patterns //===----------------------------------------------------------------------===// let Predicates = [HasStdExtM] in { def : PatGprGpr<mul, MUL>; def : PatGprGpr<mulhs, MULH>; def : PatGprGpr<mulhu, MULHU>; // No ISDOpcode for mulhsu def : PatGprGpr<sdiv, DIV>; def : PatGprGpr<udiv, DIVU>; def : PatGprGpr<srem, REM>; def : PatGprGpr<urem, REMU>; } // Predicates = [HasStdExtM] let Predicates = [HasStdExtM, IsRV64] in { def : Pat<(sext_inreg (mul GPR:$rs1, GPR:$rs2), i32), (MULW GPR:$rs1, GPR:$rs2)>; def : PatGprGpr<riscv_divw, DIVW>; def : PatGprGpr<riscv_divuw, DIVUW>; def : PatGprGpr<riscv_remuw, REMUW>; // Handle the specific cases where using DIVU/REMU would be correct and result // in fewer instructions than emitting DIVUW/REMUW then zero-extending the // result. def : Pat<(zexti32 (riscv_divuw (zexti32 GPR:$rs1), (zexti32 GPR:$rs2))), (DIVU GPR:$rs1, GPR:$rs2)>; def : Pat<(zexti32 (riscv_remuw (zexti32 GPR:$rs1), (zexti32 GPR:$rs2))), (REMU GPR:$rs1, GPR:$rs2)>; // Although the sexti32 operands may not have originated from an i32 srem, // this pattern is safe as it is impossible for two sign extended inputs to // produce a result where res[63:32]=0 and res[31]=1. def : Pat<(srem (sexti32 GPR:$rs1), (sexti32 GPR:$rs2)), (REMW GPR:$rs1, GPR:$rs2)>; def : Pat<(sext_inreg (srem (sexti32 GPR:$rs1), (sexti32 GPR:$rs2)), i32), (REMW GPR:$rs1, GPR:$rs2)>; } // Predicates = [HasStdExtM, IsRV64]
Upload File
Create Folder