Skip to content

Commit d365746

Browse files
committed
[MIPS] Add MIPS i6400 and i6500 processors
The i6400 and i6500 are high performance multi-core microprocessors from MIPS that provide best in class power efficiency for use in system-on-chip (SoC) applications. i6400 and i6500 implements Release 6 of the MIPS64 Instruction Set Architecture with full hardware multithreading and hardware virtualization support. Scheduling model shall be added in separate commit/PR.
1 parent fe544d4 commit d365746

File tree

7 files changed

+47
-3
lines changed

7 files changed

+47
-3
lines changed

clang/lib/Basic/Targets/Mips.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ bool MipsTargetInfo::processorSupportsGPR64() const {
4747
.Case("mips64r6", true)
4848
.Case("octeon", true)
4949
.Case("octeon+", true)
50+
.Case("i6400", true)
51+
.Case("i6500", true)
5052
.Default(false);
5153
}
5254

5355
static constexpr llvm::StringLiteral ValidCPUNames[] = {
5456
{"mips1"}, {"mips2"}, {"mips3"}, {"mips4"}, {"mips5"},
5557
{"mips32"}, {"mips32r2"}, {"mips32r3"}, {"mips32r5"}, {"mips32r6"},
5658
{"mips64"}, {"mips64r2"}, {"mips64r3"}, {"mips64r5"}, {"mips64r6"},
57-
{"octeon"}, {"octeon+"}, {"p5600"}};
59+
{"octeon"}, {"octeon+"}, {"p5600"}, {"i6400"}, {"i6500"}};
5860

5961
bool MipsTargetInfo::isValidCPUName(StringRef Name) const {
6062
return llvm::is_contained(ValidCPUNames, Name);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ void mips::getMipsCPUAndABI(const ArgList &Args, const llvm::Triple &Triple,
104104
.Case("mips64r6", "n64")
105105
.Case("octeon", "n64")
106106
.Case("p5600", "o32")
107+
.Case("i6400", "n64")
108+
.Case("i6500", "n64")
107109
.Default("");
108110
}
109111

@@ -514,5 +516,7 @@ bool mips::supportsIndirectJumpHazardBarrier(StringRef &CPU) {
514516
.Case("mips64r6", true)
515517
.Case("octeon", true)
516518
.Case("p5600", true)
519+
.Case("i6400", true)
520+
.Case("i6500", true)
517521
.Default(false);
518522
}

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,9 @@ bool clang::driver::findMIPSMultilibs(const Driver &D,
15011501
CPUName == "mips64r5" || CPUName == "octeon" ||
15021502
CPUName == "octeon+",
15031503
"-march=mips64r2", Flags);
1504-
addMultilibFlag(CPUName == "mips64r6", "-march=mips64r6", Flags);
1504+
addMultilibFlag(CPUName == "mips64r6" || CPUName == "i6400" ||
1505+
CPUName == "i6500",
1506+
"-march=mips64r6", Flags);
15051507
addMultilibFlag(isMicroMips(Args), "-mmicromips", Flags);
15061508
addMultilibFlag(tools::mips::isUCLibc(Args), "-muclibc", Flags);
15071509
addMultilibFlag(tools::mips::isNaN2008(D, Args, TargetTriple), "-mnan=2008",

clang/test/Driver/mips-abi.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,30 @@
121121
// MIPS-ARCH-P5600-N64: error: ABI 'n64' is not supported on CPU 'p5600'
122122
//
123123
// RUN: %clang --target=mips-linux-gnu -### -c %s \
124+
// RUN: -march=i6400 2>&1 \
125+
// RUN: | FileCheck -check-prefix=MIPS-ARCH-I6400 %s
126+
// MIPS-ARCH-I6400: "-target-cpu" "i6400"
127+
// MIPS-ARCH-I6400: "-target-abi" "o32"
128+
//
129+
// RUN: %clang --target=mips-linux-gnu -### -c %s \
130+
// RUN: -march=i6400 -mabi=64 2>&1 \
131+
// RUN: | FileCheck -check-prefix=MIPS-ARCH-I6400-N64 %s
132+
// MIPS-ARCH-I6400-N64: "-target-cpu" "i6400"
133+
// MIPS-ARCH-I6400-N64: "-target-abi" "n64"
134+
//
135+
// RUN: %clang --target=mips-linux-gnu -### -c %s \
136+
// RUN: -march=i6500 2>&1 \
137+
// RUN: | FileCheck -check-prefix=MIPS-ARCH-I6500 %s
138+
// MIPS-ARCH-I6500: "-target-cpu" "i6500"
139+
// MIPS-ARCH-I6500: "-target-abi" "o32"
140+
//
141+
// RUN: %clang --target=mips-linux-gnu -### -c %s \
142+
// RUN: -march=i6500 -mabi=64 2>&1 \
143+
// RUN: | FileCheck -check-prefix=MIPS-ARCH-I6500-N64 %s
144+
// MIPS-ARCH-I6500-N64: "-target-cpu" "i6500"
145+
// MIPS-ARCH-I6500-N64: "-target-abi" "n64"
146+
//
147+
// RUN: %clang --target=mips-linux-gnu -### -c %s \
124148
// RUN: -march=mips64 2>&1 \
125149
// RUN: | FileCheck -check-prefix=MIPS-ARCH-3264 %s
126150
// MIPS-ARCH-3264: "-target-cpu" "mips64"

llvm/docs/ReleaseNotes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ Changes to the LoongArch Backend
101101
Changes to the MIPS Backend
102102
---------------------------
103103

104+
* `-mcpu=i6400` and `-mcpu=i6500` was added.
105+
104106
Changes to the PowerPC Backend
105107
------------------------------
106108

llvm/lib/Target/Mips/Mips.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@ def ImplP5600 : SubtargetFeature<"p5600", "ProcImpl",
238238
"MipsSubtarget::CPU::P5600",
239239
"The P5600 Processor", [FeatureMips32r5]>;
240240

241+
def ImplI6400
242+
: SubtargetFeature<"i6400", "ProcImpl", "MipsSubtarget::CPU::I6400",
243+
"The I6400 Processor", [FeatureMips64r6]>;
244+
245+
def ImplI6500
246+
: SubtargetFeature<"i6500", "ProcImpl", "MipsSubtarget::CPU::I6400",
247+
"The I6500 Processor", [FeatureMips64r6]>;
248+
241249
class Proc<string Name, list<SubtargetFeature> Features>
242250
: ProcessorModel<Name, MipsGenericModel, Features>;
243251

@@ -261,6 +269,8 @@ def : Proc<"mips64r6", [FeatureMips64r6]>;
261269
def : Proc<"octeon", [FeatureMips64r2, FeatureCnMips]>;
262270
def : Proc<"octeon+", [FeatureMips64r2, FeatureCnMips, FeatureCnMipsP]>;
263271
def : ProcessorModel<"p5600", MipsP5600Model, [ImplP5600]>;
272+
def : ProcessorModel<"i6400", NoSchedModel, [ImplI6400]>;
273+
def : ProcessorModel<"i6500", NoSchedModel, [ImplI6500]>;
264274

265275
def MipsAsmParser : AsmParser {
266276
let ShouldEmitMatchRegisterName = 0;

llvm/lib/Target/Mips/MipsSubtarget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class MipsSubtarget : public MipsGenSubtargetInfo {
4343
Mips3, Mips4, Mips5, Mips64, Mips64r2, Mips64r3, Mips64r5, Mips64r6
4444
};
4545

46-
enum class CPU { P5600 };
46+
enum class CPU { P5600, I6400 };
4747

4848
// Used to avoid printing dsp warnings multiple times.
4949
static bool DspWarningPrinted;

0 commit comments

Comments
 (0)