Skip to content

Commit 1991da9

Browse files
koachantru
authored andcommitted
[SPARC][IAS] Add support for v9 DONE, RETRY, SAVED, & RESTORED
Add support for DONE, RETRY, SAVED, and RESTORED (v9 Section A.11 & Section A.47). Those instructions are used for low-level interrupt handling and register window management by OS kernels. Reviewed By: barannikov88 Differential Revision: https://reviews.llvm.org/D144936 (cherry picked from commit bf499ec)
1 parent b4bb394 commit 1991da9

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

llvm/lib/Target/Sparc/SparcInstrInfo.td

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,22 @@ let hasSideEffects = 1 in {
17431743
}
17441744
}
17451745

1746+
// Section A.11 - DONE and RETRY
1747+
// Section A.47 - SAVED and RESTORED
1748+
let Predicates = [HasV9], rs1 = 0, rs2 = 0 in {
1749+
let rd = 0 in
1750+
def DONE : F3_1<2, 0b111110, (outs), (ins), "done", []>;
1751+
1752+
let rd = 1 in
1753+
def RETRY : F3_1<2, 0b111110, (outs), (ins), "retry", []>;
1754+
1755+
let rd = 0 in
1756+
def SAVED : F3_1<2, 0b110001, (outs), (ins), "saved", []>;
1757+
1758+
let rd = 1 in
1759+
def RESTORED : F3_1<2, 0b110001, (outs), (ins), "restored", []>;
1760+
}
1761+
17461762
// Section A.42 - Prefetch Data
17471763
let Predicates = [HasV9] in {
17481764
def PREFETCHr : F3_1<3, 0b101101,

llvm/test/MC/Disassembler/Sparc/sparc-v9.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,15 @@
137137

138138
# CHECK: prefetch [%i1+%i2], 1
139139
0xc3,0x6e,0x40,0x1a
140+
141+
# CHECK: done
142+
0x81,0xf0,0x00,0x00
143+
144+
# CHECK: retry
145+
0x83,0xf0,0x00,0x00
146+
147+
# CHECK: saved
148+
0x81,0x88,0x00,0x00
149+
150+
# CHECK: restored
151+
0x83,0x88,0x00,0x00

llvm/test/MC/Sparc/sparcv9-instructions.s

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,20 @@
433433
! V8-NEXT: prefetch [ %i1 + %i2 ], 1
434434
! V9: prefetch [%i1+%i2], 1 ! encoding: [0xc3,0x6e,0x40,0x1a]
435435
prefetch [ %i1 + %i2 ], 1
436+
437+
! V8: error: instruction requires a CPU feature not currently enabled
438+
! V8-NEXT: done
439+
! V9: done ! encoding: [0x81,0xf0,0x00,0x00]
440+
done
441+
! V8: error: instruction requires a CPU feature not currently enabled
442+
! V8-NEXT: retry
443+
! V9: retry ! encoding: [0x83,0xf0,0x00,0x00]
444+
retry
445+
! V8: error: instruction requires a CPU feature not currently enabled
446+
! V8-NEXT: saved
447+
! V9: saved ! encoding: [0x81,0x88,0x00,0x00]
448+
saved
449+
! V8: error: instruction requires a CPU feature not currently enabled
450+
! V8-NEXT: restored
451+
! V9: restored ! encoding: [0x83,0x88,0x00,0x00]
452+
restored

0 commit comments

Comments
 (0)