-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV] Add Zilsd and Zclsd Extensions #131094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
bcdf964
Update RISCVSystemOperands.td
dong-miao 30e3fbe
Update rv32-hypervisor-csr-names.s
dong-miao e41e745
Update rv32-machine-csr-names.s
dong-miao ea2c1af
Update RISCVSystemOperands.td
dong-miao 6b074f3
Update rv32-only-csr-names.s
dong-miao f77d8e3
Update RISCVSystemOperands.td
dong-miao 58a1fe2
Merge branch 'main' into main
dong-miao 17b994b
Merge branch 'main' into main
dong-miao 6f57575
Merge branch 'llvm:main' into main
dong-miao 2c3440f
add extensions
dong-miao faa59c9
Update RISCVDisassembler.cpp
dong-miao 4442de0
Delete $<TARGET_LINKER_FILE:cxx_shared>
dong-miao 20fd842
Update RISCVDisassembler.cpp
dong-miao 1fb709c
Update RISCVDisassembler.cpp
dong-miao 5a6103d
Update RISCVRegisterInfo.td
dong-miao f7c4cf4
Update RISCVAsmParser.cpp
dong-miao 54780fa
Update riscv-target-features.c
dong-miao 1387e89
Update RISCVUsage.rst
dong-miao fc52464
Update print-supported-extensions-riscv.c
dong-miao 7f61fd6
Update RISCVDisassembler.cpp
dong-miao 2df1bbf
Update RISCVDisassembler.cpp
dong-miao ff30cde
Update RISCVRegisterInfo.td
dong-miao 10c800c
Modify relevant files
dong-miao f7cf00f
Update RISCVDisassembler.cpp
dong-miao b07f830
Modify disassembly information
dong-miao e478e03
Update RISCVDisassembler.cpp
dong-miao 2262393
Merge branch 'main' into develop
dong-miao 8a2fd1d
Update rv64c-valid.s
dong-miao 9972069
Merge branch 'llvm:main' into develop
dong-miao 613cf3a
Update RISCVInstrInfo.td
dong-miao 95ddfa1
Merge branch 'main' into develop
dong-miao a61e604
Merge branch 'main' into develop
dong-miao bf6ea39
Update print-supported-extensions-riscv.c
dong-miao 4158069
Update print-supported-extensions-riscv.c
dong-miao cc7a33c
Update print-supported-extensions-riscv.c
dong-miao 1c59ebc
Update RISCVFeatures.td
dong-miao 3b7e25e
Improve the format of test files
dong-miao faec63f
Modify relevant content
dong-miao dfda4ae
Update ReleaseNotes.md
dong-miao e17ca63
Update rv64c-valid.s
dong-miao 4b1709e
Change conflict test file
dong-miao 68c3845
Conflict Resolution
dong-miao d0a4e32
Merge branch 'main' into develop
dong-miao 89f5a20
Formatting
dong-miao 31b55e8
Rename DecoderNamespace
dong-miao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
//===-- RISCVInstrInfoZclsd.td -----------------------------*- 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 'Zclsd', | ||
// Compressed Load/Store pair instructions extension. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Instruction Class Templates | ||
dong-miao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//===----------------------------------------------------------------------===// | ||
|
||
def GPRPairNoX0RV32Operand : AsmOperandClass { | ||
let Name = "GPRPairNoX0RV32"; | ||
let ParserMethod = "parseGPRPair<false>"; | ||
let PredicateMethod = "isGPRPairNoX0"; | ||
let RenderMethod = "addRegOperands"; | ||
} | ||
|
||
def GPRPairNoX0RV32 : RegisterOperand<GPRPairNoX0> { | ||
let ParserMatchClass = GPRPairNoX0RV32Operand; | ||
} | ||
|
||
def GPRPairCRV32Operand : AsmOperandClass { | ||
let Name = "GPRPairCRV32"; | ||
let ParserMethod = "parseGPRPair<false>"; | ||
let PredicateMethod = "isGPRPairC"; | ||
let RenderMethod = "addRegOperands"; | ||
} | ||
|
||
def GPRPairCRV32 : RegisterOperand<GPRPairC> { | ||
let ParserMatchClass = GPRPairCRV32Operand; | ||
} | ||
|
||
let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in | ||
class PairCStackLoad<bits<3> funct3, string OpcodeStr, | ||
DAGOperand RC, DAGOperand opnd> | ||
: RVInst16CI<funct3, 0b10, (outs RC:$rd), (ins SPMem:$rs1, opnd:$imm), | ||
OpcodeStr, "$rd, ${imm}(${rs1})">; | ||
|
||
let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in | ||
class PairCStackStore<bits<3> funct3, string OpcodeStr, | ||
DAGOperand RC, DAGOperand opnd> | ||
: RVInst16CSS<funct3, 0b10, (outs), (ins RC:$rs2, SPMem:$rs1, opnd:$imm), | ||
OpcodeStr, "$rs2, ${imm}(${rs1})">; | ||
|
||
let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in | ||
class PairCLoad_ri<bits<3> funct3, string OpcodeStr, | ||
DAGOperand RC, DAGOperand opnd> | ||
: RVInst16CL<funct3, 0b00, (outs RC:$rd), (ins GPRCMem:$rs1, opnd:$imm), | ||
OpcodeStr, "$rd, ${imm}(${rs1})">; | ||
|
||
let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in | ||
class PairCStore_rri<bits<3> funct3, string OpcodeStr, | ||
DAGOperand RC, DAGOperand opnd> | ||
: RVInst16CS<funct3, 0b00, (outs), (ins RC:$rs2,GPRCMem:$rs1, opnd:$imm), | ||
OpcodeStr, "$rs2, ${imm}(${rs1})">; | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Instructions | ||
//===----------------------------------------------------------------------===// | ||
|
||
let Predicates = [HasStdExtZclsd, IsRV32], DecoderNamespace = "ZcOverlap" in { | ||
def C_LDSP_RV32 : PairCStackLoad<0b011, "c.ldsp", GPRPairNoX0RV32, uimm9_lsb000>, | ||
Sched<[WriteLDD, ReadMemBase]> { | ||
let Inst{4-2} = imm{8-6}; | ||
} | ||
|
||
def C_SDSP_RV32 : PairCStackStore<0b111, "c.sdsp", GPRPairRV32, uimm9_lsb000>, | ||
Sched<[WriteSTD, ReadStoreData, ReadMemBase]> { | ||
let Inst{9-7} = imm{8-6}; | ||
} | ||
|
||
def C_LD_RV32 : PairCLoad_ri<0b011, "c.ld", GPRPairCRV32, uimm8_lsb000>, | ||
Sched<[WriteLDD, ReadMemBase]> { | ||
bits<8> imm; | ||
let Inst{12-10} = imm{5-3}; | ||
let Inst{6-5} = imm{7-6}; | ||
} | ||
|
||
def C_SD_RV32 : PairCStore_rri<0b111, "c.sd", GPRPairCRV32, uimm8_lsb000>, | ||
Sched<[WriteSTD, ReadStoreData, ReadMemBase]> { | ||
bits<8> imm; | ||
let Inst{12-10} = imm{5-3}; | ||
let Inst{6-5} = imm{7-6}; | ||
} | ||
}// Predicates = [HasStdExtZclsd, IsRV32], DecoderNamespace = "ZcOverlap" | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Compress Instruction tablegen backend. | ||
//===----------------------------------------------------------------------===// | ||
|
||
let Predicates = [HasStdExtZclsd, IsRV32] in { | ||
def : CompressPat<(LD_RV32 GPRPairNoX0RV32:$rd, SPMem:$rs1, uimm9_lsb000:$imm), | ||
(C_LDSP_RV32 GPRPairNoX0RV32:$rd, SPMem:$rs1, uimm9_lsb000:$imm)>; | ||
def : CompressPat<(SD_RV32 GPRPairRV32:$rs2, SPMem:$rs1, uimm9_lsb000:$imm), | ||
(C_SDSP_RV32 GPRPairRV32:$rs2, SPMem:$rs1, uimm9_lsb000:$imm)>; | ||
def : CompressPat<(LD_RV32 GPRPairCRV32:$rd, GPRCMem:$rs1, uimm8_lsb000:$imm), | ||
(C_LD_RV32 GPRPairCRV32:$rd, GPRCMem:$rs1, uimm8_lsb000:$imm)>; | ||
def : CompressPat<(SD_RV32 GPRPairCRV32:$rs2, GPRCMem:$rs1, uimm8_lsb000:$imm), | ||
(C_SD_RV32 GPRPairCRV32:$rs2, GPRCMem:$rs1, uimm8_lsb000:$imm)>; | ||
} // Predicates = [HasStdExtZclsd, IsRV32] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//===-- RISCVInstrInfoZilsd.td -----------------------------*- 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 'Zilsd', | ||
// Load/Store pair instructions extension. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Instruction Class Templates | ||
//===----------------------------------------------------------------------===// | ||
|
||
let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in | ||
class PairLoad_ri<string opcodestr, DAGOperand RC> | ||
: RVInstI<0b011, OPC_LOAD, (outs RC:$rd), | ||
(ins GPRMem:$rs1, simm12:$imm12), | ||
opcodestr, "${rd}, ${imm12}(${rs1})">; | ||
|
||
let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in | ||
class PairStore_rri<string opcodestr, DAGOperand RC> | ||
: RVInstS<0b011, OPC_STORE, (outs), | ||
(ins RC:$rs2, GPRMem:$rs1, simm12:$imm12), | ||
opcodestr, "${rs2}, ${imm12}(${rs1})">; | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Instructions | ||
//===----------------------------------------------------------------------===// | ||
|
||
let Predicates = [HasStdExtZilsd, IsRV32], DecoderNamespace = "RV32Only" in { | ||
def LD_RV32 : PairLoad_ri<"ld", GPRPairRV32>, Sched<[WriteLDD, ReadMemBase]>; | ||
def SD_RV32 : PairStore_rri<"sd", GPRPairRV32>, Sched<[WriteSTD, ReadStoreData, | ||
ReadMemBase]>; | ||
} // Predicates = [HasStdExtZilsd, IsRV32], DecoderNamespace = "RV32Only" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# RUN: not llvm-mc -triple=riscv32 -mattr=+zclsd < %s 2>&1 | FileCheck %s | ||
|
||
## GPRPairC | ||
c.ld t1, 4(sp) # CHECK: :[[@LINE]]:6: error: invalid operand for instruction | ||
c.sd s2, 4(sp) # CHECK: :[[@LINE]]:6: error: invalid operand for instruction | ||
|
||
## GPRPairNoX0 | ||
c.ldsp x0, 4(sp) # CHECK: :[[@LINE]]:9: error: invalid operand for instruction | ||
c.ldsp zero, 4(sp) # CHECK: :[[@LINE]]:9: error: invalid operand for instruction | ||
|
||
## uimm9_lsb000 | ||
c.ldsp t1, 512(sp) # CHECK: :[[@LINE]]:12: error: immediate must be a multiple of 8 bytes in the range [0, 504] | ||
c.sdsp t1, -8(sp) # CHECK: :[[@LINE]]:12: error: immediate must be a multiple of 8 bytes in the range [0, 504] | ||
## uimm8_lsb000 | ||
c.ld s0, -8(sp) # CHECK: :[[@LINE]]:11: error: immediate must be a multiple of 8 bytes in the range [0, 248] | ||
c.sd s0, 256(sp) # CHECK: :[[@LINE]]:11: error: immediate must be a multiple of 8 bytes in the range [0, 248] | ||
|
||
# Invalid register names | ||
c.ld a1, 4(sp) # CHECK: :[[@LINE]]:6: error: register must be even | ||
c.sd a3, 4(sp) # CHECK: :[[@LINE]]:6: error: register must be even | ||
c.ldsp ra, 4(sp) # CHECK: :[[@LINE]]:8: error: register must be even | ||
c.ldsp t0, 4(sp) # CHECK: :[[@LINE]]:8: error: register must be even |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.