| 1 |
// RUN: %clang -### -c -fveclib=none %s 2>&1 | FileCheck --check-prefix=CHECK-NOLIB %s |
| 2 |
// RUN: %clang -### -c -fveclib=Accelerate %s 2>&1 | FileCheck --check-prefix=CHECK-ACCELERATE %s |
| 3 |
// RUN: %clang -### -c --target=x86_64-unknown-linux-gnu -fveclib=libmvec %s 2>&1 | FileCheck --check-prefix=CHECK-libmvec %s |
| 4 |
// RUN: %clang -### -c --target=aarch64-linux-gnu -fveclib=libmvec %s 2>&1 | FileCheck --check-prefix=CHECK-LIBMVEC-AARCH64 %s |
| 5 |
// RUN: %clang -### -c --target=x86_64-unknown-linux-gnu -fveclib=AMDLIBM %s 2>&1 | FileCheck --check-prefix=CHECK-AMDLIBM %s |
| 6 |
// RUN: %clang -### -c -fveclib=MASSV %s 2>&1 | FileCheck --check-prefix=CHECK-MASSV %s |
| 7 |
// RUN: %clang -### -c -fveclib=Darwin_libsystem_m %s 2>&1 | FileCheck --check-prefix=CHECK-DARWIN_LIBSYSTEM_M %s |
| 8 |
// RUN: %clang -### -c --target=aarch64 -fveclib=SLEEF %s 2>&1 | FileCheck --check-prefix=CHECK-SLEEF %s |
| 9 |
// RUN: %clang -### -c --target=riscv64-unknown-linux-gnu -fveclib=SLEEF -march=rv64gcv %s 2>&1 | FileCheck -check-prefix CHECK-SLEEF-RISCV %s |
| 10 |
// RUN: %clang -### -c --target=aarch64 -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-ARMPL %s |
| 11 |
// RUN: not %clang -c -fveclib=something %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s |
| 12 |
|
| 13 |
// CHECK-NOLIB: "-fveclib=none" |
| 14 |
// CHECK-ACCELERATE: "-fveclib=Accelerate" |
| 15 |
// CHECK-libmvec: "-fveclib=libmvec" |
| 16 |
// CHECK-LIBMVEC-AARCH64: "-fveclib=libmvec" |
| 17 |
// CHECK-AMDLIBM: "-fveclib=AMDLIBM" |
| 18 |
// CHECK-MASSV: "-fveclib=MASSV" |
| 19 |
// CHECK-DARWIN_LIBSYSTEM_M: "-fveclib=Darwin_libsystem_m" |
| 20 |
// CHECK-SLEEF: "-fveclib=SLEEF" |
| 21 |
// CHECK-SLEEF-RISCV: "-fveclib=SLEEF" |
| 22 |
// CHECK-ARMPL: "-fveclib=ArmPL" |
| 23 |
|
| 24 |
// CHECK-INVALID: error: invalid value 'something' in '-fveclib=something' |
| 25 |
|
| 26 |
// RUN: not %clang --target=x86 -c -fveclib=SLEEF %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s |
| 27 |
// RUN: not %clang --target=x86 -c -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s |
| 28 |
// RUN: not %clang --target=aarch64 -c -fveclib=SVML %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s |
| 29 |
// RUN: not %clang --target=aarch64 -c -fveclib=AMDLIBM %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s |
| 30 |
// CHECK-ERROR: unsupported option {{.*}} for target |
| 31 |
|
| 32 |
// RUN: %clang -fveclib=Accelerate %s -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK %s |
| 33 |
// CHECK-LINK: "-framework" "Accelerate" |
| 34 |
|
| 35 |
// RUN: %clang -fveclib=Accelerate %s -nostdlib -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK-NOSTDLIB %s |
| 36 |
// CHECK-LINK-NOSTDLIB-NOT: "-framework" "Accelerate" |
| 37 |
|
| 38 |
// RUN: %clang -fveclib=Accelerate %s -nodefaultlibs -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK-NODEFAULTLIBS %s |
| 39 |
// CHECK-LINK-NODEFAULTLIBS-NOT: "-framework" "Accelerate" |
| 40 |
|
| 41 |
|
| 42 |
/* Verify that the correct vector library is passed to LTO flags. */ |
| 43 |
|
| 44 |
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=libmvec -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-LIBMVEC %s |
| 45 |
// CHECK-LTO-LIBMVEC: "-plugin-opt=-vector-library=LIBMVEC" |
| 46 |
|
| 47 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=libmvec -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-LIBMVEC-AARCH64 %s |
| 48 |
// CHECK-LTO-LIBMVEC-AARCH64: "-plugin-opt=-vector-library=LIBMVEC" |
| 49 |
|
| 50 |
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=AMDLIBM -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-AMDLIBM %s |
| 51 |
// CHECK-LTO-AMDLIBM: "-plugin-opt=-vector-library=AMDLIBM" |
| 52 |
|
| 53 |
// RUN: %clang -### --target=powerpc64-unknown-linux-gnu -fveclib=MASSV -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-MASSV %s |
| 54 |
// CHECK-LTO-MASSV: "-plugin-opt=-vector-library=MASSV" |
| 55 |
|
| 56 |
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=SVML -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-SVML %s |
| 57 |
// CHECK-LTO-SVML: "-plugin-opt=-vector-library=SVML" |
| 58 |
|
| 59 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=SLEEF -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-SLEEF %s |
| 60 |
// CHECK-LTO-SLEEF: "-plugin-opt=-vector-library=sleefgnuabi" |
| 61 |
|
| 62 |
// RUN: %clang -### --target=riscv64-unknown-linux-gnu -fveclib=SLEEF -flto -march=rv64gcv %s 2>&1 | FileCheck -check-prefix CHECK-LTO-SLEEF-RISCV %s |
| 63 |
// CHECK-LTO-SLEEF-RISCV: "-plugin-opt=-vector-library=sleefgnuabi" |
| 64 |
|
| 65 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-ARMPL %s |
| 66 |
// CHECK-LTO-ARMPL: "-plugin-opt=-vector-library=ArmPL" |
| 67 |
|
| 68 |
|
| 69 |
/* Verify that -fmath-errno is set correctly for the vector library. */ |
| 70 |
|
| 71 |
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=libmvec %s 2>&1 | FileCheck --check-prefix=CHECK-ERRNO-LIBMVEC %s |
| 72 |
// CHECK-ERRNO-LIBMVEC: "-fveclib=libmvec" |
| 73 |
// CHECK-ERRNO-LIBMVEC-SAME: "-fmath-errno" |
| 74 |
|
| 75 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=libmvec %s 2>&1 | FileCheck --check-prefix=CHECK-ERRNO-LIBMVEC-AARCH64 %s |
| 76 |
// CHECK-ERRNO-LIBMVEC-AARCH64: "-fveclib=libmvec" |
| 77 |
// CHECK-ERRNO-LIBMVEC-AARCH64-SAME: "-fmath-errno" |
| 78 |
|
| 79 |
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=AMDLIBM %s 2>&1 | FileCheck --check-prefix=CHECK-ERRNO-AMDLIBM %s |
| 80 |
// CHECK-ERRNO-AMDLIBM: "-fveclib=AMDLIBM" |
| 81 |
// CHECK-ERRNO-AMDLIBM-SAME: "-fmath-errno" |
| 82 |
|
| 83 |
// RUN: %clang -### --target=powerpc64-unknown-linux-gnu -fveclib=MASSV %s 2>&1 | FileCheck --check-prefix=CHECK-ERRNO-MASSV %s |
| 84 |
// CHECK-ERRNO-MASSV: "-fveclib=MASSV" |
| 85 |
// CHECK-ERRNO-MASSV-SAME: "-fmath-errno" |
| 86 |
|
| 87 |
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=SVML %s 2>&1 | FileCheck --check-prefix=CHECK-ERRNO-SVML %s |
| 88 |
// CHECK-ERRNO-SVML: "-fveclib=SVML" |
| 89 |
// CHECK-ERRNO-SVML-SAME: "-fmath-errno" |
| 90 |
|
| 91 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=SLEEF %s 2>&1 | FileCheck --check-prefix=CHECK-ERRNO-SLEEF %s |
| 92 |
// CHECK-ERRNO-SLEEF-NOT: "-fmath-errno" |
| 93 |
// CHECK-ERRNO-SLEEF: "-fveclib=SLEEF" |
| 94 |
// CHECK-ERRNO-SLEEF-NOT: "-fmath-errno" |
| 95 |
|
| 96 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-ERRNO-ARMPL %s |
| 97 |
// CHECK-ERRNO-ARMPL-NOT: "-fmath-errno" |
| 98 |
// CHECK-ERRNO-ARMPL: "-fveclib=ArmPL" |
| 99 |
// CHECK-ERRNO-ARMPL-NOT: "-fmath-errno" |
| 100 |
|
| 101 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -fmath-errno %s 2>&1 | FileCheck --check-prefix=CHECK-REENABLE-ERRNO-ARMPL %s |
| 102 |
// CHECK-REENABLE-ERRNO-ARMPL: math errno enabled by '-fmath-errno' after it was implicitly disabled by '-fveclib=ArmPL', this may limit the utilization of the vector library [-Wmath-errno-enabled-with-veclib] |
| 103 |
// CHECK-REENABLE-ERRNO-ARMPL: "-fveclib=ArmPL" |
| 104 |
// CHECK-REENABLE-ERRNO-ARMPL-SAME: "-fmath-errno" |
| 105 |
|
| 106 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=SLEEF -fmath-errno %s 2>&1 | FileCheck --check-prefix=CHECK-REENABLE-ERRNO-SLEEF %s |
| 107 |
// CHECK-REENABLE-ERRNO-SLEEF: math errno enabled by '-fmath-errno' after it was implicitly disabled by '-fveclib=SLEEF', this may limit the utilization of the vector library [-Wmath-errno-enabled-with-veclib] |
| 108 |
// CHECK-REENABLE-ERRNO-SLEEF: "-fveclib=SLEEF" |
| 109 |
// CHECK-REENABLE-ERRNO-SLEEF-SAME: "-fmath-errno" |
| 110 |
|
| 111 |
// RUN: %clang -### --target=riscv64-unknown-linux-gnu -fveclib=SLEEF -fmath-errno -march=rv64gcv %s 2>&1 | FileCheck --check-prefix=CHECK-REENABLE-ERRNO-SLEEF-RISCV %s |
| 112 |
// CHECK-REENABLE-ERRNO-SLEEF-RISCV: math errno enabled by '-fmath-errno' after it was implicitly disabled by '-fveclib=SLEEF', this may limit the utilization of the vector library [-Wmath-errno-enabled-with-veclib] |
| 113 |
// CHECK-REENABLE-ERRNO-SLEEF-RISCV: "-fveclib=SLEEF" |
| 114 |
// CHECK-REENABLE-ERRNO-SLEEF-RISCV-SAME: "-fmath-errno" |
| 115 |
|
| 116 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -fno-fast-math %s 2>&1 | FileCheck --check-prefix=CHECK-REENABLE-ERRNO-NFM %s |
| 117 |
// CHECK-REENABLE-ERRNO-NFM: math errno enabled by '-fno-fast-math' after it was implicitly disabled by '-fveclib=ArmPL', this may limit the utilization of the vector library [-Wmath-errno-enabled-with-veclib] |
| 118 |
// CHECK-REENABLE-ERRNO-NFM: "-fveclib=ArmPL" |
| 119 |
// CHECK-REENABLE-ERRNO-NFM-SAME: "-fmath-errno" |
| 120 |
|
| 121 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -ffp-model=strict %s 2>&1 | FileCheck --check-prefix=CHECK-REENABLE-ERRNO-FP-MODEL %s |
| 122 |
// CHECK-REENABLE-ERRNO-FP-MODEL: math errno enabled by '-ffp-model=strict' after it was implicitly disabled by '-fveclib=ArmPL', this may limit the utilization of the vector library [-Wmath-errno-enabled-with-veclib] |
| 123 |
// CHECK-REENABLE-ERRNO-FP-MODEL: "-fveclib=ArmPL" |
| 124 |
// CHECK-REENABLE-ERRNO-FP-MODEL-SAME: "-fmath-errno" |
| 125 |
|
| 126 |
/* Verify the warning points at the last arg to enable -fmath-errno. */ |
| 127 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -fno-fast-math -fno-math-errno -ffp-model=strict %s 2>&1 | FileCheck --check-prefix=CHECK-ENABLED-LAST %s |
| 128 |
// CHECK-ENABLED-LAST: math errno enabled by '-ffp-model=strict' after it was implicitly disabled by '-fveclib=ArmPL', this may limit the utilization of the vector library [-Wmath-errno-enabled-with-veclib] |
| 129 |
|
| 130 |
/* Verify no warning when math-errno is re-enabled for a different veclib (that does not imply -fno-math-errno). */ |
| 131 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -fmath-errno -fveclib=Accelerate %s 2>&1 | FileCheck --check-prefix=CHECK-REPEAT-VECLIB %s |
| 132 |
// CHECK-REPEAT-VECLIB-NOT: math errno enabled |
| 133 |
|
| 134 |
/// Verify that vectorized routines library is being linked in. |
| 135 |
// RUN: %clang -### --target=aarch64-pc-windows-msvc -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-LINKING-ARMPL-MSVC %s |
| 136 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-LINKING-ARMPL-LINUX %s |
| 137 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL %s -nostdlib 2>&1 | FileCheck --check-prefix=CHECK-LINKING-ARMPL-NOSTDLIB-LINUX %s |
| 138 |
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL %s -lamath 2>&1 | FileCheck --check-prefix=CHECK-LINKING-AMATH-BEFORE-ARMPL-LINUX %s |
| 139 |
// RUN: %clang -### --target=arm64-apple-darwin -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-LINKING-ARMPL-DARWIN %s |
| 140 |
// RUN: %clang -### --target=arm64-apple-darwin -fveclib=ArmPL -nostdlib %s 2>&1 | FileCheck --check-prefix=CHECK-LINKING-ARMPL-NOSTDLIB-DARWIN %s |
| 141 |
// RUN: %clang -### --target=arm64-apple-darwin -fveclib=ArmPL %s -lamath 2>&1 | FileCheck --check-prefix=CHECK-LINKING-AMATH-BEFORE-ARMPL-DARWIN %s |
| 142 |
// CHECK-LINKING-ARMPL-LINUX: "--push-state" "--as-needed" "-lm" "-lamath" "-lm" "--pop-state" |
| 143 |
// CHECK-LINKING-ARMPL-NOSTDLIB-LINUX: "--push-state" "--as-needed" "-lamath" "--pop-state" |
| 144 |
// CHECK-LINKING-ARMPL-NOSTDLIB-LINUX-NOT: "-lm" |
| 145 |
// CHECK-LINKING-ARMPL-DARWIN: "-lm" "-lamath" "-lm" |
| 146 |
// CHECK-LINKING-ARMPL-NOSTDLIB-DARWIN: "-lamath" |
| 147 |
// CHECK-LINKING-ARMPL-NOSTDLIB-DARWIN-NOT: "-lm" |
| 148 |
// CHECK-LINKING-ARMPL-MSVC: "--dependent-lib=amath" |
| 149 |
// CHECK-LINKING-AMATH-BEFORE-ARMPL-LINUX: "-lamath" {{.*}}"--push-state" "--as-needed" "-lm" "-lamath" "-lm" "--pop-state" |
| 150 |
// CHECK-LINKING-AMATH-BEFORE-ARMPL-DARWIN: "-lamath" {{.*}}"-lm" "-lamath" "-lm" |
| 151 |
|
| 152 |
/// Verify that the RPATH is being set when needed. |
| 153 |
// RUN: %clang -### --target=aarch64-linux-gnu -resource-dir=%S/../../../clang/test/Driver/Inputs/resource_dir_with_arch_subdir -frtlib-add-rpath -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-RPATH-ARMPL %s |
| 154 |
// CHECK-RPATH-ARMPL: "--push-state" "--as-needed" "-lm" "-lamath" "-lm" "--pop-state" |
| 155 |
// CHECK-RPATH-ARMPL-SAME: "-rpath" |