[PowerPC] Do not define __PRIVILEGED__

We do not want to define __PRIVILEGED__. There is no use case for the
definition and gcc does not define it. This patch removes that definition.

Reviewed By: lei, NeHuang

Differential Revision: https://reviews.llvm.org/D107461
This commit is contained in:
Stefan Pintilie 2021-08-04 09:16:11 -05:00
parent a5ae34afaa
commit a614a28772
3 changed files with 20 additions and 30 deletions

View File

@ -373,8 +373,6 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__MMA__");
if (HasROPProtect)
Builder.defineMacro("__ROP_PROTECT__");
if (HasPrivileged)
Builder.defineMacro("__PRIVILEGED__");
if (HasP10Vector)
Builder.defineMacro("__POWER10_VECTOR__");
if (HasPCRelativeMemops)

View File

@ -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

View File

@ -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
//