Add PR check to suggest alternatives to using undef (#118506)
[llvm-project.git] / clang / test / Driver / ppc-cpus.c
blobb0fd539b198a2c35816987e3326750d5c6352d68
1 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=ppc64 2>&1 | FileCheck --check-prefix=MCPU_PPC64 %s
2 // MCPU_PPC64: "-target-cpu" "ppc64"
4 /// We cannot check much for -mcpu=native, but it should be replaced by a CPU name.
5 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=native 2> %t.err || true
6 // RUN: FileCheck --input-file=%t.err -check-prefix=MCPU_NATIVE %s
7 // MCPU_NATIVE-NOT: "-target-cpu" "native"
9 /// Check that we are passing unknown mcpu options to the backend so an error
10 /// can be triggered.
11 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=asdf1234 2>&1 | FileCheck --check-prefix=MCPU_UNKNOWN %s
12 // MCPU_UNKNOWN: "-target-cpu" "asdf1234"
14 /// Check for the unknown target error if an unknown mcpu option is used.
15 // RUN: not %clang -c --target=powerpc64 %s -mcpu=asdf1234 2>&1 | FileCheck --check-prefix=MCPU_ERR %s
16 // MCPU_ERR: unknown target CPU 'asdf1234'
18 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=7400 2>&1 | FileCheck --check-prefix=MCPU_7400 %s
19 // MCPU_7400: "-target-cpu" "7400"
21 /// The following -mcpu= have their own -target-cpu values.
22 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=G4 2>&1 | FileCheck %s --check-prefix=NO_PPC64
23 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=7450 2>&1 | FileCheck %s --check-prefix=NO_PPC64
24 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=G4+ 2>&1 | FileCheck %s --check-prefix=NO_PPC64
25 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=970 2>&1 | FileCheck %s --check-prefix=NO_PPC64
26 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=G5 2>&1 | FileCheck %s --check-prefix=NO_PPC64
27 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=pwr6 2>&1 | FileCheck %s --check-prefix=NO_PPC64
28 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=pwr7 2>&1 | FileCheck %s --check-prefix=NO_PPC64
29 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=pwr8 2>&1 | FileCheck %s --check-prefix=NO_PPC64
31 // NO_PPC64-NOT: "-target-cpu" "ppc64"
33 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=generic -mtune=pwr9 2>&1 | FileCheck %s --check-prefix=TUNE
34 // TUNE: "-target-cpu" "ppc64" "-tune-cpu" "pwr9"
35 // RUN: %clang -### -c --target=powerpc64le %s -mcpu=power9 -mtune=power10 2>&1 | FileCheck %s --check-prefix=TUNE-LONG
36 // TUNE-LONG: "-target-cpu" "pwr9" "-tune-cpu" "pwr10"
38 /// Test mcpu options that are equivalent to "generic"
39 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=generic 2>&1 | FileCheck %s --check-prefix=GENERIC
40 // RUN: %clang -### -c --target=powerpc64 %s -mcpu=405 2>&1 | FileCheck %s --check-prefix=GENERIC
42 // GENERIC: "-target-cpu" "ppc64"
44 // RUN: not %clang -### -c --target=powerpc64 %s -march=generic 2>&1 | FileCheck --check-prefix=MARCH %s
45 // MARCH: error: unsupported option '-march=' for target 'powerpc64'