Skip to content

Commit 36a78bb

Browse files
committed
[MIPS] Add FeatureMSA to i6400 and i6500 cores
i6400 and i6500 cores support MIPS SIMD Architecture (MSA) instructions
1 parent 27b4928 commit 36a78bb

File tree

2 files changed

+71
-2
lines changed

2 files changed

+71
-2
lines changed

llvm/lib/Target/Mips/Mips.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,11 @@ def ImplP5600 : SubtargetFeature<"p5600", "ProcImpl",
242242
// same CPU architecture.
243243
def ImplI6400
244244
: SubtargetFeature<"i6400", "ProcImpl", "MipsSubtarget::CPU::I6400",
245-
"MIPS I6400 Processor", [FeatureMips64r6]>;
245+
"MIPS I6400 Processor", [FeatureMips64r6, FeatureMSA]>;
246246

247247
def ImplI6500
248248
: SubtargetFeature<"i6500", "ProcImpl", "MipsSubtarget::CPU::I6500",
249-
"MIPS I6500 Processor", [FeatureMips64r6]>;
249+
"MIPS I6500 Processor", [FeatureMips64r6, FeatureMSA]>;
250250

251251
class Proc<string Name, list<SubtargetFeature> Features>
252252
: ProcessorModel<Name, MipsGenericModel, Features>;

llvm/test/CodeGen/Mips/msa/i6500.ll

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
; Test the MSA intrinsics that are encoded with the SPECIAL instruction format.
2+
3+
; RUN: llc -mtriple=mips-elf -mcpu=i6500 < %s | \
4+
; RUN: FileCheck %s --check-prefix=MIPS32
5+
; RUN: llc -mtriple=mips64-elf -mcpu=i6500 < %s | \
6+
; RUN: FileCheck %s --check-prefix=MIPS64
7+
; RUN: llc -mtriple=mips-elf -mcpu=i6500 < %s | \
8+
; RUN: FileCheck %s --check-prefix=MIPS32
9+
; RUN: llc -mtriple=mips64-elf -mcpu=i6500 < %s | \
10+
; RUN: FileCheck %s --check-prefix=MIPS64
11+
; RUN: llc -mtriple=mips64-elf -mcpu=i6500 -mattr=-msa < %s | \
12+
; RUN: FileCheck %s --check-prefix=NO-DSLA
13+
; RUN: llc -mtriple=mips-elf -mcpu=i6400 < %s | \
14+
; RUN: FileCheck %s --check-prefix=MIPS32
15+
; RUN: llc -mtriple=mips64-elf -mcpu=i6400 < %s | \
16+
; RUN: FileCheck %s --check-prefix=MIPS64
17+
; RUN: llc -mtriple=mips-elf -mcpu=i6400 < %s | \
18+
; RUN: FileCheck %s --check-prefix=MIPS32
19+
; RUN: llc -mtriple=mips64-elf -mcpu=i6400 < %s | \
20+
; RUN: FileCheck %s --check-prefix=MIPS64
21+
; RUN: llc -mtriple=mips64-elf -mcpu=i6400 -mattr=-msa < %s | \
22+
; RUN: FileCheck %s --check-prefix=NO-DSLA
23+
24+
define i32 @llvm_mips_lsa_test(i32 %a, i32 %b) nounwind {
25+
entry:
26+
%0 = tail call i32 @llvm.mips.lsa(i32 %a, i32 %b, i32 2)
27+
ret i32 %0
28+
}
29+
30+
declare i32 @llvm.mips.lsa(i32, i32, i32) nounwind
31+
32+
; MIPS32: llvm_mips_lsa_test:
33+
; MIPS32: lsa {{\$[0-9]+}}, $5, $4, 2
34+
; MIPS32: .size llvm_mips_lsa_test
35+
36+
define i32 @lsa_test(i32 %a, i32 %b) nounwind {
37+
entry:
38+
%0 = shl i32 %b, 2
39+
%1 = add i32 %a, %0
40+
ret i32 %1
41+
}
42+
43+
; MIPS32: lsa_test:
44+
; MIPS32: lsa {{\$[0-9]+}}, $5, $4, 2
45+
; MIPS32: .size lsa_test
46+
47+
define i64 @llvm_mips_dlsa_test(i64 %a, i64 %b) nounwind {
48+
entry:
49+
%0 = tail call i64 @llvm.mips.dlsa(i64 %a, i64 %b, i32 2)
50+
ret i64 %0
51+
}
52+
53+
declare i64 @llvm.mips.dlsa(i64, i64, i32) nounwind
54+
55+
; MIPS64: llvm_mips_dlsa_test:
56+
; MIPS64: dlsa {{\$[0-9]+}}, $5, $4, 2
57+
; MIPS64: .size llvm_mips_dlsa_test
58+
; NO-DSLA-NOT: dlsa {{\$[0-9]+}}, $5, $4, 2
59+
define i64 @dlsa_test(i64 %a, i64 %b) nounwind {
60+
entry:
61+
%0 = shl i64 %b, 2
62+
%1 = add i64 %a, %0
63+
ret i64 %1
64+
}
65+
66+
; MIPS64: dlsa_test:
67+
; MIPS64: dlsa {{\$[0-9]+}}, $5, $4, 2
68+
; MIPS64: .size dlsa_test
69+
; NO-DSLA-NOT: dlsa {{\$[0-9]+}}, $5, $4, 2

0 commit comments

Comments
 (0)