Skip to content

Commit 9d9d2b4

Browse files
authored
[RISCV] Rename XCValu cv.slet(u) to cv.sle(u). (#108481)
According to openhwgroup/cv32e40p#833 this instruction was renamed last year to remove the 't'. I used MnemonicAlias to support the old name. Unfortunately, this gives a generic error if XCValu is not enabled. Since its an old name I hope this isn't too big of an issue. CC: @jeremybennett
1 parent d04c2ed commit 9d9d2b4

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ let Predicates = [HasVendorXCValu, IsRV32],
203203
// General ALU Operations
204204
def CV_ABS : CVInstAluR<0b0101000, 0b011, "cv.abs">,
205205
Sched<[]>;
206-
def CV_SLET : CVInstAluRR<0b0101001, 0b011, "cv.slet">,
206+
def CV_SLE : CVInstAluRR<0b0101001, 0b011, "cv.sle">,
207207
Sched<[]>;
208-
def CV_SLETU : CVInstAluRR<0b0101010, 0b011, "cv.sletu">,
208+
def CV_SLEU : CVInstAluRR<0b0101010, 0b011, "cv.sleu">,
209209
Sched<[]>;
210210
def CV_MIN : CVInstAluRR<0b0101011, 0b011, "cv.min">,
211211
Sched<[]>;
@@ -276,6 +276,10 @@ let Predicates = [HasVendorXCValu, IsRV32],
276276
// hasSideEffects = 0, mayLoad = 0, mayStore = 0,
277277
// Constraints = "$rd = $rd_wb"
278278

279+
let Predicates = [HasVendorXCValu, IsRV32] in {
280+
def : MnemonicAlias<"cv.slet", "cv.sle">;
281+
def : MnemonicAlias<"cv.sletu", "cv.sleu">;
282+
}
279283

280284
class CVInstSIMDRR<bits<5> funct5, bit F, bit funct1, bits<3> funct3,
281285
RISCVOpcode opcode, dag outs,
@@ -778,8 +782,8 @@ multiclass PatCoreVAluGprGprImm<Intrinsic intr> {
778782

779783
let Predicates = [HasVendorXCValu, IsRV32], AddedComplexity = 1 in {
780784
def : PatGpr<abs, CV_ABS>;
781-
def : PatGprGpr<setle, CV_SLET>;
782-
def : PatGprGpr<setule, CV_SLETU>;
785+
def : PatGprGpr<setle, CV_SLE>;
786+
def : PatGprGpr<setule, CV_SLEU>;
783787
def : PatGprGpr<smin, CV_MIN>;
784788
def : PatGprGpr<umin, CV_MINU>;
785789
def : PatGprGpr<smax, CV_MAX>;

llvm/test/CodeGen/RISCV/xcvalu.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ define i32 @abs(i32 %a) {
2020
define i1 @slet(i32 %a, i32 %b) {
2121
; CHECK-LABEL: slet:
2222
; CHECK: # %bb.0:
23-
; CHECK-NEXT: cv.slet a0, a0, a1
23+
; CHECK-NEXT: cv.sle a0, a0, a1
2424
; CHECK-NEXT: ret
2525
%1 = icmp sle i32 %a, %b
2626
ret i1 %1
@@ -29,7 +29,7 @@ define i1 @slet(i32 %a, i32 %b) {
2929
define i1 @sletu(i32 %a, i32 %b) {
3030
; CHECK-LABEL: sletu:
3131
; CHECK: # %bb.0:
32-
; CHECK-NEXT: cv.sletu a0, a0, a1
32+
; CHECK-NEXT: cv.sleu a0, a0, a1
3333
; CHECK-NEXT: ret
3434
%1 = icmp ule i32 %a, %b
3535
ret i1 %1

llvm/test/MC/RISCV/corev/XCValu-valid.s

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,25 @@ cv.subrnr a0, a1, a2
3636
# CHECK-ENCODING: [0x2b,0xb5,0xc5,0x8c]
3737
# CHECK-NO-EXT: instruction requires the following: 'XCValu' (CORE-V ALU Operations){{$}}
3838

39+
cv.sle t0, t1, t2
40+
# CHECK-INSTR: cv.sle t0, t1, t2
41+
# CHECK-ENCODING: [0xab,0x32,0x73,0x52]
42+
# CHECK-NO-EXT: instruction requires the following: 'XCValu' (CORE-V ALU Operations){{$}}
43+
3944
cv.slet t0, t1, t2
40-
# CHECK-INSTR: cv.slet t0, t1, t2
45+
# CHECK-INSTR: cv.sle t0, t1, t2
4146
# CHECK-ENCODING: [0xab,0x32,0x73,0x52]
47+
# CHECK-NO-EXT: unrecognized instruction mnemonic
48+
49+
cv.sle a0, a1, a2
50+
# CHECK-INSTR: cv.sle a0, a1, a2
51+
# CHECK-ENCODING: [0x2b,0xb5,0xc5,0x52]
4252
# CHECK-NO-EXT: instruction requires the following: 'XCValu' (CORE-V ALU Operations){{$}}
4353

4454
cv.slet a0, a1, a2
45-
# CHECK-INSTR: cv.slet a0, a1, a2
55+
# CHECK-INSTR: cv.sle a0, a1, a2
4656
# CHECK-ENCODING: [0x2b,0xb5,0xc5,0x52]
47-
# CHECK-NO-EXT: instruction requires the following: 'XCValu' (CORE-V ALU Operations){{$}}
57+
# CHECK-NO-EXT: unrecognized instruction mnemonic
4858

4959
cv.subrn t0, t1, t2, 0
5060
# CHECK-INSTR: cv.subrn t0, t1, t2, 0
@@ -261,15 +271,25 @@ cv.extbs a0, a1
261271
# CHECK-ENCODING: [0x2b,0xb5,0x05,0x64]
262272
# CHECK-NO-EXT: instruction requires the following: 'XCValu' (CORE-V ALU Operations){{$}}
263273

274+
cv.sleu t0, t1, t2
275+
# CHECK-INSTR: cv.sleu t0, t1, t2
276+
# CHECK-ENCODING: [0xab,0x32,0x73,0x54]
277+
# CHECK-NO-EXT: instruction requires the following: 'XCValu' (CORE-V ALU Operations){{$}}
278+
264279
cv.sletu t0, t1, t2
265-
# CHECK-INSTR: cv.sletu t0, t1, t2
280+
# CHECK-INSTR: cv.sleu t0, t1, t2
266281
# CHECK-ENCODING: [0xab,0x32,0x73,0x54]
282+
# CHECK-NO-EXT: unrecognized instruction mnemonic
283+
284+
cv.sleu a0, a1, a2
285+
# CHECK-INSTR: cv.sleu a0, a1, a2
286+
# CHECK-ENCODING: [0x2b,0xb5,0xc5,0x54]
267287
# CHECK-NO-EXT: instruction requires the following: 'XCValu' (CORE-V ALU Operations){{$}}
268288

269289
cv.sletu a0, a1, a2
270-
# CHECK-INSTR: cv.sletu a0, a1, a2
290+
# CHECK-INSTR: cv.sleu a0, a1, a2
271291
# CHECK-ENCODING: [0x2b,0xb5,0xc5,0x54]
272-
# CHECK-NO-EXT: instruction requires the following: 'XCValu' (CORE-V ALU Operations){{$}}
292+
# CHECK-NO-EXT: unrecognized instruction mnemonic
273293

274294
cv.min t0, t1, t2
275295
# CHECK-INSTR: cv.min t0, t1, t2

0 commit comments

Comments
 (0)