diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -367,8 +367,6 @@ Builder.defineMacro("__MMA__"); if (HasROPProtect) Builder.defineMacro("__ROP_PROTECT__"); - if (HasPrivileged) - Builder.defineMacro("__PRIVILEGED__"); if (HasP10Vector) Builder.defineMacro("__POWER10_VECTOR__"); if (HasPCRelativeMemops) diff --git a/clang/test/Driver/ppc-mprivileged-support-check.c b/clang/test/Driver/ppc-mprivileged-support-check.c --- a/clang/test/Driver/ppc-mprivileged-support-check.c +++ b/clang/test/Driver/ppc-mprivileged-support-check.c @@ -1,26 +1,29 @@ -// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mcpu=pwr10 -mprivileged %s 2>&1 | FileCheck %s --check-prefix=HASPRIV -// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mcpu=power10 -mprivileged %s 2>&1 | FileCheck %s --check-prefix=HASPRIV -// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mcpu=pwr9 -mprivileged %s 2>&1 | FileCheck %s --check-prefix=HASPRIV -// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mcpu=power9 -mprivileged %s 2>&1 | FileCheck %s --check-prefix=HASPRIV -// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mcpu=pwr8 -mprivileged %s 2>&1 | FileCheck %s --check-prefix=HASPRIV -// RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ -// RUN: -mcpu=power8 -mprivileged %s 2>&1 | FileCheck %s --check-prefix=HASPRIV +// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm \ +// RUN: -mcpu=pwr10 -mprivileged %s -o - | FileCheck %s --check-prefix=HASPRIV +// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm \ +// RUN: -mcpu=power10 -mprivileged %s -o - | FileCheck %s --check-prefix=HASPRIV +// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm \ +// RUN: -mcpu=pwr9 -mprivileged %s -o - | FileCheck %s --check-prefix=HASPRIV +// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm \ +// RUN: -mcpu=power9 -mprivileged %s -o - | FileCheck %s --check-prefix=HASPRIV +// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm \ +// RUN: -mcpu=pwr8 -mprivileged %s -o - | FileCheck %s --check-prefix=HASPRIV +// RUN: %clang -target powerpc64le-unknown-linux-gnu -S -emit-llvm \ +// RUN: -mcpu=power8 -mprivileged %s -o - | FileCheck %s --check-prefix=HASPRIV // RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ // RUN: -mcpu=pwr7 -mprivileged %s 2>&1 | FileCheck %s --check-prefix=NOPRIV // RUN: not %clang -target powerpc64le-unknown-linux-gnu -fsyntax-only \ // RUN: -mcpu=power7 -mprivileged %s 2>&1 | FileCheck %s --check-prefix=NOPRIV -#ifdef __PRIVILEGED__ -static_assert(false, "Privileged instructions enabled"); -#endif +// __SP__ TODO: Fix this test case to check for the attribute. +int test() { + return 0; +} + +// HASPRIV: test() #0 { +// HASPRIV: attributes #0 = { +// HASPRIV-SAME: +privileged -// HASPRIV: Privileged instructions enabled -// HASPRIV-NOT: option '-mprivileged' cannot be specified with // NOPRIV: option '-mprivileged' cannot be specified with diff --git a/clang/test/Preprocessor/init-ppc64.c b/clang/test/Preprocessor/init-ppc64.c --- a/clang/test/Preprocessor/init-ppc64.c +++ b/clang/test/Preprocessor/init-ppc64.c @@ -565,7 +565,6 @@ // PPCPWR8:#define _ARCH_PWR7 1 // PPCPWR8:#define _ARCH_PWR8 1 // PPCPWR8-NOT:#define __ROP_PROTECT__ 1 -// PPCPWR8-NOT:#define __PRIVILEGED__ 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu power8 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPOWER8 %s // @@ -584,7 +583,6 @@ // PPCPOWER8:#define _ARCH_PWR7 1 // PPCPOWER8:#define _ARCH_PWR8 1 // PPCPOWER8-NOT:#define __ROP_PROTECT__ 1 -// PPCPOWER8-NOT:#define __PRIVILEGED__ 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu pwr9 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPWR9 %s // @@ -600,7 +598,6 @@ // PPCPWR9:#define _ARCH_PWR7 1 // PPCPWR9:#define _ARCH_PWR9 1 // PPCPWR9-NOT:#define __ROP_PROTECT__ 1 -// PPCPWR9-NOT:#define __PRIVILEGED__ 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu power9 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPOWER9 %s // @@ -616,7 +613,6 @@ // PPCPOWER9:#define _ARCH_PWR7 1 // PPCPOWER9:#define _ARCH_PWR9 1 // PPCPOWER9-NOT:#define __ROP_PROTECT__ 1 -// PPCPOWER9-NOT:#define __PRIVILEGED__ 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu pwr10 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPOWER10 %s // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu power10 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPOWER10 %s @@ -637,7 +633,6 @@ // PPCPOWER10:#define __MMA__ 1 // PPCPOWER10:#define __PCREL__ 1 // PPCPOWER10-NOT:#define __ROP_PROTECT__ 1 -// PPCPOWER10-NOT:#define __PRIVILEGED__ 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu future -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCFUTURE %s // @@ -658,7 +653,6 @@ // PPCFUTURE:#define __MMA__ 1 // PPCFUTURE:#define __PCREL__ 1 // PPCFUTURE-NOT:#define __ROP_PROTECT__ 1 -// PPCFUTURE-NOT:#define __PRIVILEGED__ 1 // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-feature +mma -target-cpu power10 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC-MMA %s // PPC-MMA:#define __MMA__ 1 @@ -668,11 +662,6 @@ // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-feature +rop-protect -target-cpu power8 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC-ROP %s // PPC-ROP:#define __ROP_PROTECT__ 1 // -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-feature +privileged -target-cpu power10 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC-PRIV %s -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-feature +privileged -target-cpu power9 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC-PRIV %s -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-feature +privileged -target-cpu power8 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC-PRIV %s -// PPC-PRIV:#define __PRIVILEGED__ 1 -// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-feature +float128 -target-cpu power9 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC-FLOAT128 %s // PPC-FLOAT128:#define __FLOAT128__ 1 //