Skip to content

Commit 0ca10ef

Browse files
authored
[MIPS] Add MIPS i6400 and i6500 processors (llvm#130587)
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.
1 parent 19d2023 commit 0ca10ef

File tree

7 files changed

+69
-3
lines changed

7 files changed

+69
-3
lines changed

clang/lib/Basic/Targets/Mips.cpp

+3-1
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

+4
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

+3-1
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

+48
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,54 @@
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=mips64-linux-gnu -### -c %s \
136+
// RUN: -march=i6400 2>&1 \
137+
// RUN: | FileCheck -check-prefix=MIPS64-ARCH-I6400 %s
138+
// MIPS64-ARCH-I6400: "-target-cpu" "i6400"
139+
// MIPS64-ARCH-I6400: "-target-abi" "n64"
140+
//
141+
// RUN: %clang --target=mips64-linux-gnu -### -c %s \
142+
// RUN: -march=i6400 -mabi=32 2>&1 \
143+
// RUN: | FileCheck -check-prefix=MIPS64-ARCH-I6400-O32 %s
144+
// MIPS64-ARCH-I6400-O32: "-target-cpu" "i6400"
145+
// MIPS64-ARCH-I6400-O32: "-target-abi" "o32"
146+
//
147+
// RUN: %clang --target=mips-linux-gnu -### -c %s \
148+
// RUN: -march=i6500 2>&1 \
149+
// RUN: | FileCheck -check-prefix=MIPS-ARCH-I6500 %s
150+
// MIPS-ARCH-I6500: "-target-cpu" "i6500"
151+
// MIPS-ARCH-I6500: "-target-abi" "o32"
152+
//
153+
// RUN: %clang --target=mips-linux-gnu -### -c %s \
154+
// RUN: -march=i6500 -mabi=64 2>&1 \
155+
// RUN: | FileCheck -check-prefix=MIPS-ARCH-I6500-N64 %s
156+
// MIPS-ARCH-I6500-N64: "-target-cpu" "i6500"
157+
// MIPS-ARCH-I6500-N64: "-target-abi" "n64"
158+
//
159+
// RUN: %clang --target=mips64-linux-gnu -### -c %s \
160+
// RUN: -march=i6500 2>&1 \
161+
// RUN: | FileCheck -check-prefix=MIPS64-ARCH-I6500 %s
162+
// MIPS64-ARCH-I6500: "-target-cpu" "i6500"
163+
// MIPS64-ARCH-I6500: "-target-abi" "n64"
164+
//
165+
// RUN: %clang --target=mips64-linux-gnu -### -c %s \
166+
// RUN: -march=i6500 -mabi=32 2>&1 \
167+
// RUN: | FileCheck -check-prefix=MIPS64-ARCH-I6500-O32 %s
168+
// MIPS64-ARCH-I6500-O32: "-target-cpu" "i6500"
169+
// MIPS54-ARCH-I6500-O32: "-target-abi" "o32"
170+
//
171+
// RUN: %clang --target=mips-linux-gnu -### -c %s \
124172
// RUN: -march=mips64 2>&1 \
125173
// RUN: | FileCheck -check-prefix=MIPS-ARCH-3264 %s
126174
// MIPS-ARCH-3264: "-target-cpu" "mips64"

llvm/docs/ReleaseNotes.md

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ Changes to the LoongArch Backend
110110
Changes to the MIPS Backend
111111
---------------------------
112112

113+
* `-mcpu=i6400` and `-mcpu=i6500` were added.
114+
113115
Changes to the PowerPC Backend
114116
------------------------------
115117

llvm/lib/Target/Mips/Mips.td

+8
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ def ImplP5600 : SubtargetFeature<"p5600", "ProcImpl",
238238
"MipsSubtarget::CPU::P5600",
239239
"The P5600 Processor", [FeatureMips32r5]>;
240240

241+
// The I6500 is the multi-cluster version of the I6400. Both are based on the
242+
// same CPU architecture.
243+
def ImplI6400
244+
: SubtargetFeature<"i6400", "ProcImpl", "MipsSubtarget::CPU::I6400",
245+
"MIPS I6400/I6500 Processors", [FeatureMips64r6]>;
246+
241247
class Proc<string Name, list<SubtargetFeature> Features>
242248
: ProcessorModel<Name, MipsGenericModel, Features>;
243249

@@ -261,6 +267,8 @@ def : Proc<"mips64r6", [FeatureMips64r6]>;
261267
def : Proc<"octeon", [FeatureMips64r2, FeatureCnMips]>;
262268
def : Proc<"octeon+", [FeatureMips64r2, FeatureCnMips, FeatureCnMipsP]>;
263269
def : ProcessorModel<"p5600", MipsP5600Model, [ImplP5600]>;
270+
def : ProcessorModel<"i6400", NoSchedModel, [ImplI6400]>;
271+
def : ProcessorModel<"i6500", NoSchedModel, [ImplI6400]>;
264272

265273
def MipsAsmParser : AsmParser {
266274
let ShouldEmitMatchRegisterName = 0;

llvm/lib/Target/Mips/MipsSubtarget.h

+1-1
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)