llvm-project/clang/test/Driver/aix-mcpu-default.c
Fangrui Song cb1654ee4b [Driver][test] Clean up some AIX tests
* For `-###`, `-o %t.o` is unnecessary if we don't specifically test the
  output filename.
* --target= is the canonical spelling. -target is a legacy spelling which
  unfortunately cannot be removed because there are too many uses.
* -no-canonical-prefixes uses the dereferenced absolute path for the cc1
  command. For most tests "-cc1" is sufficient to identify the command line, no
  need to specifically test the "clang" command, and -no-canonical-prefixes can
  removed.
* --unwindlib= is the preferred spelling. -u is a short option taking a value,
  which means a -uwindlib= typo cannot be detected.

I recommend that you take a look at linux-cross.cpp. Testing include paths and
library paths in one RUN line is sometimes more readable than having separate
include/library tests.

Having separate RUN lines for misc features like -fdata-sections
(`aix-data-sections.c`) is wasteful. It may be better testing multiple
options in a single RUN command.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D119309
2022-02-26 01:06:24 +00:00

35 lines
1.6 KiB
C

// Check that the target cpu defaults to power7 on AIX7.2 and up.
// RUN: %clang %s -### -c 2>&1 --target=powerpc-ibm-aix7.2 \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// Check that the target cpu defaults to power7 on AIX7.2 and up.
// RUN: %clang %s -### -c 2>&1 --target=powerpc64-ibm-aix7.2 \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// Check that the target cpu defaults to power7 on AIX7.1 and below.
// RUN: %clang %s -### -c 2>&1 --target=powerpc-ibm-aix7.1 \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// Check that the target cpu defaults to power7 on AIX7.1 and below.
// RUN: %clang %s -### -c 2>&1 --target=powerpc64-ibm-aix7.1 \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// Check that the target cpu defaults to power7 when level not specified.
// RUN: %clang %s -### -c 2>&1 --target=powerpc-ibm-aix \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// Check that the target cpu defaults to power7 when level not specified.
// RUN: %clang %s -### -c 2>&1 --target=powerpc64-ibm-aix \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
// CHECK-MCPU-DEFAULT-AIX72: "-cc1"
// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
// Check that the user is able to overwrite the default with '-mcpu'.
// RUN: %clang %s -### -c 2>&1 -mcpu=pwr6 --target=powerpc-ibm-aix \
// RUN: | FileCheck --check-prefix=CHECK-MCPU-USER %s
// CHECK-MCPU-USER-NOT: warning:
// CHECK-MCPU-USER: "-cc1"
// CHECK-MCPU-USER: "-target-cpu" "pwr6"