Skip to content

Commit 55a88cd

Browse files
authored
[MIPS] Add FeatureMSA to i6400 and i6500 cores (#134985)
- Enable 'FeatureMSA' for MIPS i6400 and i6500 cpu. - Enable -mmsa option if mcpu is set to either i6400 or i6500 - added clang driver test to validate msa feature - added llvm codegen test to validate msa instructions for cpu i6500 and i6400 MIPS i6400 and i6500 cores implements and enables MSA (MIPS SIMD ARCHITECTURE) by default.
1 parent 6a1f521 commit 55a88cd

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

clang/lib/Driver/ToolChains/Arch/Mips.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ void mips::getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple,
255255
D.Diag(diag::err_drv_unsupported_noabicalls_pic);
256256
}
257257

258+
if (CPUName == "i6500" || CPUName == "i6400") {
259+
// MIPS cpu i6400 and i6500 support MSA (Mips SIMD Architecture)
260+
// by default.
261+
Features.push_back("+msa");
262+
}
263+
258264
if (!UseAbiCalls)
259265
Features.push_back("+noabicalls");
260266
else

clang/test/Driver/mips-cpus.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Check target CPUs are correctly passed.
2+
3+
// RUN: %clang --target=mips64 -### -c %s 2>&1 -mcpu=i6400 | FileCheck -check-prefix=MCPU-I6400 %s
4+
// MCPU-I6400: "-target-cpu" "i6400"
5+
// MCPU-I6400: "-target-feature" "+msa" "-target-feature" "-noabicalls"
6+
7+
// RUN: %clang --target=mips64 -### -c %s 2>&1 -mcpu=i6500 | FileCheck -check-prefix=MCPU-I6500 %s
8+
// MCPU-I6500: "-target-cpu" "i6500"
9+
// MCPU-I6500: "-target-feature" "+msa" "-target-feature" "-noabicalls"

llvm/lib/Target/Mips/Mips.td

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

248248
def ImplI6500
249249
: SubtargetFeature<"i6500", "ProcImpl", "MipsSubtarget::CPU::I6500",
250-
"MIPS I6500 Processor", [FeatureMips64r6]>;
250+
"MIPS I6500 Processor", [FeatureMips64r6, FeatureMSA]>;
251251

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22
; RUN: llc -mtriple=mips -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s --check-prefixes=ALL,MIPS
33
; RUN: llc -mtriple=mipsel -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s --check-prefixes=ALL,MIPSEL
4+
; RUN: llc -mtriple=mips64 -mcpu=i6500 < %s | FileCheck %s --check-prefixes=ALL
5+
; RUN: llc -mtriple=mips64 -mcpu=i6400 < %s | FileCheck %s --check-prefixes=ALL
46

57
define void @add_v16i8(ptr %c, ptr %a, ptr %b) nounwind {
68
; ALL-LABEL: add_v16i8:

0 commit comments

Comments
 (0)