Skip to content

Commit b6722de

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 b6722de

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-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: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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=mips-elf -mcpu=i6400 < %s | \
12+
; RUN: FileCheck %s --check-prefix=MIPS32
13+
; RUN: llc -mtriple=mips64-elf -mcpu=i6400 < %s | \
14+
; RUN: FileCheck %s --check-prefix=MIPS64
15+
; RUN: llc -mtriple=mips-elf -mcpu=i6400 < %s | \
16+
; RUN: FileCheck %s --check-prefix=MIPS32
17+
; RUN: llc -mtriple=mips64-elf -mcpu=i6400 < %s | \
18+
; RUN: FileCheck %s --check-prefix=MIPS64
19+
20+
define i32 @llvm_mips_lsa_test(i32 %a, i32 %b) nounwind {
21+
entry:
22+
%0 = tail call i32 @llvm.mips.lsa(i32 %a, i32 %b, i32 2)
23+
ret i32 %0
24+
}
25+
26+
declare i32 @llvm.mips.lsa(i32, i32, i32) nounwind
27+
28+
; MIPS32: llvm_mips_lsa_test:
29+
; MIPS32: lsa {{\$[0-9]+}}, $5, $4, 2
30+
; MIPS32: .size llvm_mips_lsa_test
31+
32+
define i32 @lsa_test(i32 %a, i32 %b) nounwind {
33+
entry:
34+
%0 = shl i32 %b, 2
35+
%1 = add i32 %a, %0
36+
ret i32 %1
37+
}
38+
39+
; MIPS32: lsa_test:
40+
; MIPS32: lsa {{\$[0-9]+}}, $5, $4, 2
41+
; MIPS32: .size lsa_test
42+
43+
define i64 @llvm_mips_dlsa_test(i64 %a, i64 %b) nounwind {
44+
entry:
45+
%0 = tail call i64 @llvm.mips.dlsa(i64 %a, i64 %b, i32 2)
46+
ret i64 %0
47+
}
48+
49+
declare i64 @llvm.mips.dlsa(i64, i64, i32) nounwind
50+
51+
; MIPS64: llvm_mips_dlsa_test:
52+
; MIPS64: dlsa {{\$[0-9]+}}, $5, $4, 2
53+
; MIPS64: .size llvm_mips_dlsa_test
54+
55+
define i64 @dlsa_test(i64 %a, i64 %b) nounwind {
56+
entry:
57+
%0 = shl i64 %b, 2
58+
%1 = add i64 %a, %0
59+
ret i64 %1
60+
}
61+
62+
; MIPS64: dlsa_test:
63+
; MIPS64: dlsa {{\$[0-9]+}}, $5, $4, 2
64+
; MIPS64: .size dlsa_test

0 commit comments

Comments
 (0)