Skip to content

Commit 36eedfc

Browse files
committed
[PowerPC] Fix powerpcspe subtarget enablement in llvm backend
Summary: As currently written, -target powerpcspe will enable SPE regardless of disabling the feature later on in the command line. Instead, change this to just set a default CPU to 'e500' instead of a generic CPU. As part of this, add FeatureSPE to the e500 definition. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D72673
1 parent d18fbfc commit 36eedfc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

llvm/lib/Target/PowerPC/PPC.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def : ProcessorModel<"g5", G5Model,
442442
def : ProcessorModel<"e500", PPCE500Model,
443443
[DirectiveE500,
444444
FeatureICBT, FeatureBookE,
445-
FeatureISEL, FeatureMFTB]>;
445+
FeatureISEL, FeatureMFTB, FeatureSPE]>;
446446
def : ProcessorModel<"e500mc", PPCE500mcModel,
447447
[DirectiveE500mc,
448448
FeatureSTFIWX, FeatureICBT, FeatureBookE,

llvm/lib/Target/PowerPC/PPCSubtarget.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
127127
// If cross-compiling with -march=ppc64le without -mcpu
128128
if (TargetTriple.getArch() == Triple::ppc64le)
129129
CPUName = "ppc64le";
130+
else if (TargetTriple.getSubArch() == Triple::PPCSubArch_spe)
131+
CPUName = "e500";
130132
else
131133
CPUName = "generic";
132134
}
@@ -151,9 +153,6 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
151153
TargetTriple.isMusl())
152154
SecurePlt = true;
153155

154-
if (TargetTriple.getSubArch() == Triple::PPCSubArch_spe)
155-
HasSPE = true;
156-
157156
if (HasSPE && IsPPC64)
158157
report_fatal_error( "SPE is only supported for 32-bit targets.\n", false);
159158
if (HasSPE && (HasAltivec || HasQPX || HasVSX || HasFPU))

0 commit comments

Comments
 (0)