Index: cfe/trunk/include/clang/Driver/Options.td =================================================================== --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -2269,6 +2269,8 @@ def fno_altivec : Flag<["-"], "fno-altivec">, Group, Flags<[DriverOption]>; def maltivec : Flag<["-"], "maltivec">, Group; def mno_altivec : Flag<["-"], "mno-altivec">, Group; +def mspe : Flag<["-"], "mspe">, Group; +def mno_spe : Flag<["-"], "mno-spe">, Group; def mvsx : Flag<["-"], "mvsx">, Group; def mno_vsx : Flag<["-"], "mno-vsx">, Group; def msecure_plt : Flag<["-"], "msecure-plt">, Group; Index: cfe/trunk/lib/Basic/Targets/PPC.h =================================================================== --- cfe/trunk/lib/Basic/Targets/PPC.h +++ cfe/trunk/lib/Basic/Targets/PPC.h @@ -66,6 +66,7 @@ bool HasBPERMD = false; bool HasExtDiv = false; bool HasP9Vector = false; + bool HasSPE = false; protected: std::string ABI; Index: cfe/trunk/lib/Basic/Targets/PPC.cpp =================================================================== --- cfe/trunk/lib/Basic/Targets/PPC.cpp +++ cfe/trunk/lib/Basic/Targets/PPC.cpp @@ -54,6 +54,10 @@ HasFloat128 = true; } else if (Feature == "+power9-vector") { HasP9Vector = true; + } else if (Feature == "+spe") { + HasSPE = true; + LongDoubleWidth = LongDoubleAlign = 64; + LongDoubleFormat = &llvm::APFloat::IEEEdouble(); } else if (Feature == "-hard-float") { FloatABI = SoftFloat; } @@ -165,6 +169,10 @@ Builder.defineMacro("__VEC__", "10206"); Builder.defineMacro("__ALTIVEC__"); } + if (HasSPE) { + Builder.defineMacro("__SPE__"); + Builder.defineMacro("__NO_FPRS__"); + } if (HasVSX) Builder.defineMacro("__VSX__"); if (HasP8Vector) @@ -203,7 +211,6 @@ // __CMODEL_LARGE__ // _CALL_SYSV // _CALL_DARWIN - // __NO_FPRS__ } // Handle explicit options being passed to the compiler here: if we've @@ -332,6 +339,7 @@ .Case("extdiv", HasExtDiv) .Case("float128", HasFloat128) .Case("power9-vector", HasP9Vector) + .Case("spe", HasSPE) .Default(false); } Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp =================================================================== --- cfe/trunk/lib/CodeGen/TargetInfo.cpp +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp @@ -9726,7 +9726,8 @@ case llvm::Triple::ppc: return SetCGInfo( - new PPC32TargetCodeGenInfo(Types, CodeGenOpts.FloatABI == "soft")); + new PPC32TargetCodeGenInfo(Types, CodeGenOpts.FloatABI == "soft" || + getTarget().hasFeature("spe"))); case llvm::Triple::ppc64: if (Triple.isOSBinFormatELF()) { PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv1; Index: cfe/trunk/test/Driver/ppc-features.cpp =================================================================== --- cfe/trunk/test/Driver/ppc-features.cpp +++ cfe/trunk/test/Driver/ppc-features.cpp @@ -168,6 +168,9 @@ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-invariant-function-descriptors -minvariant-function-descriptors -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-INVFUNCDESC %s // CHECK-INVFUNCDESC: "-target-feature" "+invariant-function-descriptors" +// RUN: %clang -target powerpc-unknown-linux-gnu %s -mno-spe -mspe -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-SPE %s +// CHECK-SPE: "-target-feature" "+spe" + // Assembler features // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o -no-integrated-as 2>&1 | FileCheck -check-prefix=CHECK_BE_AS_ARGS %s // CHECK_BE_AS_ARGS: "-mppc64" Index: cfe/trunk/test/Preprocessor/init.c =================================================================== --- cfe/trunk/test/Preprocessor/init.c +++ cfe/trunk/test/Preprocessor/init.c @@ -7580,6 +7580,11 @@ // // PPC32-LINUX-NOT: _CALL_LINUX // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-linux-gnu -target-feature +spe < /dev/null | FileCheck -match-full-lines -check-prefix PPC32-SPE %s +// +// PPC32-SPE:#define __NO_FPRS__ 1 +// PPC32-SPE:#define __SPE__ 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-apple-darwin8 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-DARWIN %s // // PPC-DARWIN:#define _ARCH_PPC 1