-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[RISCV][MC] MC layer support for the experimental zalasr extension #79911
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
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
//===-- RISCVInstrInfoZalasr.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 Zalasr (Load-Acquire | ||
// and Store-Release) extension | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Instruction class templates | ||
//===----------------------------------------------------------------------===// | ||
|
||
let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in | ||
class LAQ_r<bit aq, bit rl, bits<3> funct3, string opcodestr> | ||
: RVInstRAtomic<0b00110, aq, rl, funct3, OPC_AMO, | ||
(outs GPR:$rd), (ins GPRMemZeroOffset:$rs1), | ||
opcodestr, "$rd, $rs1"> { | ||
let rs2 = 0; | ||
} | ||
|
||
let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in | ||
class SRL_r<bit aq, bit rl, bits<3> funct3, string opcodestr> | ||
: RVInstRAtomic<0b00111, aq, rl, funct3, OPC_AMO, | ||
(outs ), (ins GPRMemZeroOffset:$rs1, GPR:$rs2), | ||
opcodestr, "$rs2, $rs1"> { | ||
let rd = 0; | ||
} | ||
multiclass LAQ_r_aq_rl<bits<3> funct3, string opcodestr> { | ||
def _AQ : LAQ_r<1, 0, funct3, opcodestr # ".aq">; | ||
def _AQ_RL : LAQ_r<1, 1, funct3, opcodestr # ".aqrl">; | ||
} | ||
|
||
multiclass SRL_r_aq_rl<bits<3> funct3, string opcodestr> { | ||
def _RL : SRL_r<0, 1, funct3, opcodestr # ".rl">; | ||
def _AQ_RL : SRL_r<1, 1, funct3, opcodestr # ".aqrl">; | ||
} | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Instructions | ||
//===----------------------------------------------------------------------===// | ||
|
||
let Predicates = [HasStdExtZalasr] in { | ||
defm LB : LAQ_r_aq_rl<0b000, "lb">; | ||
defm LH : LAQ_r_aq_rl<0b001, "lh">; | ||
defm LW : LAQ_r_aq_rl<0b010, "lw">; | ||
defm SB : SRL_r_aq_rl<0b000, "sb">; | ||
defm SH : SRL_r_aq_rl<0b001, "sh">; | ||
defm SW : SRL_r_aq_rl<0b010, "sw">; | ||
} // Predicates = [HasStdExtZalasr] | ||
|
||
let Predicates = [HasStdExtZalasr, IsRV64] in { | ||
defm LD : LAQ_r_aq_rl<0b011, "ld">; | ||
defm SD : SRL_r_aq_rl<0b011, "sd">; | ||
} // Predicates = [HasStdExtZalasr, IsRV64] |
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,40 @@ | ||
# RUN: not llvm-mc -triple riscv32 -mattr=+experimental-zalasr < %s 2>&1 | FileCheck -check-prefixes=CHECK %s | ||
|
||
# CHECK: error: instruction requires the following: RV64I Base Instruction Set{{$}} | ||
ld.aq a1, (t0) | ||
|
||
# CHECK: error: instruction requires the following: RV64I Base Instruction Set{{$}} | ||
ld.aqrl a1, (t0) | ||
|
||
# CHECK: error: instruction requires the following: RV64I Base Instruction Set{{$}} | ||
sd.rl a1, (t0) | ||
|
||
# CHECK: error: instruction requires the following: RV64I Base Instruction Set{{$}} | ||
sd.aqrl a1, (t0) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
lw. a1, (t0) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
lw.rl t3, 0(t5) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
lh.rlaq t4, (t6) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
sb. a1, (t0) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
sh.aq t3, 0(t5) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
sh.rlaq t4, (t6) | ||
|
||
# CHECK: error: optional integer offset must be 0 | ||
lw.aq zero, 1(a0) | ||
|
||
# CHECK: error: optional integer offset must be 0 | ||
sw.rl t1, 2(s0) | ||
|
||
# CHECK: error: optional integer offset must be 0 | ||
sb.aqrl sp, 3(s2) |
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,78 @@ | ||
# RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-zalasr -riscv-no-aliases -show-encoding \ | ||
topperc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s | ||
# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+experimental-zalasr < %s \ | ||
# RUN: | llvm-objdump --mattr=+experimental-zalasr -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s | ||
# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zalasr -riscv-no-aliases -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s | ||
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zalasr < %s \ | ||
# RUN: | llvm-objdump --mattr=+experimental-zalasr -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s | ||
# | ||
# RUN: not llvm-mc -triple riscv32 \ | ||
# RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ | ||
# RUN: | FileCheck --check-prefixes=CHECK-NO-EXT %s | ||
# RUN: not llvm-mc -triple riscv64 \ | ||
# RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ | ||
# RUN: | FileCheck --check-prefixes=CHECK-NO-EXT %s | ||
|
||
# CHECK-ASM-AND-OBJ: lb.aq t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x03,0x05,0x34] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
lb.aq t1, 0(a0) | ||
|
||
# CHECK-ASM-AND-OBJ: lh.aq t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x13,0x05,0x34] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
lh.aq t1, 0(a0) | ||
|
||
# CHECK-ASM-AND-OBJ: lw.aq t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x23,0x05,0x34] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
lw.aq t1, (a0) | ||
|
||
# CHECK-ASM-AND-OBJ: lb.aqrl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x03,0x05,0x36] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
lb.aqrl t1, 0(a0) | ||
|
||
# CHECK-ASM-AND-OBJ: lh.aqrl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x13,0x05,0x36] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
lh.aqrl t1, (a0) | ||
|
||
# CHECK-ASM-AND-OBJ: lw.aqrl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x23,0x05,0x36] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
lw.aqrl t1, (a0) | ||
|
||
|
||
# CHECK-ASM-AND-OBJ: sb.rl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x00,0x65,0x3a] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
sb.rl t1, (a0) | ||
|
||
# CHECK-ASM-AND-OBJ: sh.rl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x10,0x65,0x3a] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
sh.rl t1, 0(a0) | ||
|
||
# CHECK-ASM-AND-OBJ: sw.rl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x20,0x65,0x3a] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
sw.rl t1, (a0) | ||
|
||
# CHECK-ASM-AND-OBJ: sb.aqrl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x00,0x65,0x3e] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
sb.aqrl t1, (a0) | ||
|
||
# CHECK-ASM-AND-OBJ: sh.aqrl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x10,0x65,0x3e] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
sh.aqrl t1, 0(a0) | ||
|
||
# CHECK-ASM-AND-OBJ: sw.aqrl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x20,0x65,0x3e] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
sw.aqrl t1, 0(a0) |
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,28 @@ | ||
# RUN: not llvm-mc -triple riscv64 -mattr=+experimental-zalasr < %s 2>&1 | FileCheck -check-prefixes=CHECK %s | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
lw. a1, (t0) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
lw.rl t3, 0(t5) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
lh.rlaq t4, (t6) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
sb. a1, (t0) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
sh.aq t3, 0(t5) | ||
|
||
# CHECK: error: unrecognized instruction mnemonic | ||
sh.rlaq t4, (t6) | ||
|
||
# CHECK: error: optional integer offset must be 0 | ||
lw.aq zero, 1(a0) | ||
|
||
# CHECK: error: optional integer offset must be 0 | ||
sw.rl t1, 2(s0) | ||
|
||
# CHECK: error: optional integer offset must be 0 | ||
sb.aqrl sp, 3(s2) |
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,31 @@ | ||
# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zalasr -riscv-no-aliases -show-encoding \ | ||
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s | ||
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zalasr < %s \ | ||
# RUN: | llvm-objdump --mattr=+experimental-zalasr -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s | ||
# | ||
# RUN: not llvm-mc -triple riscv64 \ | ||
# RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \ | ||
# RUN: | FileCheck --check-prefixes=CHECK-NO-EXT %s | ||
|
||
|
||
# CHECK-ASM-AND-OBJ: ld.aq t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x33,0x05,0x34] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
ld.aq t1, (a0) | ||
|
||
# CHECK-ASM-AND-OBJ: ld.aqrl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x33,0x05,0x36] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
ld.aqrl t1, 0(a0) | ||
|
||
|
||
# CHECK-ASM-AND-OBJ: sd.rl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x30,0x65,0x3a] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
sd.rl t1, 0(a0) | ||
|
||
# CHECK-ASM-AND-OBJ: sd.aqrl t1, (a0) | ||
# CHECK-ASM: encoding: [0x2f,0x30,0x65,0x3e] | ||
# CHECK-NO-EXT: error: instruction requires the following: 'Zalasr' (Load-Acquire and Store-Release Instructions){{$}} | ||
sd.aqrl t1, (a0) |
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 |
---|---|---|
|
@@ -857,6 +857,7 @@ Experimental extensions | |
zaamo 0.2 | ||
zabha 1.0 | ||
zacas 1.0 | ||
zalasr 0.1 | ||
zalrsc 0.2 | ||
zfbfmin 1.0 | ||
zcmop 0.2 | ||
|
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.