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