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
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"
20 // CHECK-INVALID: error: invalid value 'something' in '-fveclib=something'
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
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"
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"
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"
38 /* Verify that the correct vector library is passed to LTO flags. */
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"
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"
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"
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"
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"
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"
59 /* Verify that -fmath-errno is set correctly for the vector library. */
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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]
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