156 lines · c
1// RUN: %clang -### -c -fveclib=none %s 2>&1 | FileCheck --check-prefix=CHECK-NOLIB %s2// RUN: %clang -### -c -fveclib=Accelerate %s 2>&1 | FileCheck --check-prefix=CHECK-ACCELERATE %s3// RUN: %clang -### -c --target=x86_64-unknown-linux-gnu -fveclib=libmvec %s 2>&1 | FileCheck --check-prefix=CHECK-libmvec %s4// RUN: %clang -### -c --target=aarch64-linux-gnu -fveclib=libmvec %s 2>&1 | FileCheck --check-prefix=CHECK-LIBMVEC-AARCH64 %s5// RUN: %clang -### -c --target=x86_64-unknown-linux-gnu -fveclib=AMDLIBM %s 2>&1 | FileCheck --check-prefix=CHECK-AMDLIBM %s6// RUN: %clang -### -c -fveclib=MASSV %s 2>&1 | FileCheck --check-prefix=CHECK-MASSV %s7// RUN: %clang -### -c -fveclib=Darwin_libsystem_m %s 2>&1 | FileCheck --check-prefix=CHECK-DARWIN_LIBSYSTEM_M %s8// RUN: %clang -### -c --target=aarch64 -fveclib=SLEEF %s 2>&1 | FileCheck --check-prefix=CHECK-SLEEF %s9// RUN: %clang -### -c --target=riscv64-unknown-linux-gnu -fveclib=SLEEF -march=rv64gcv %s 2>&1 | FileCheck -check-prefix CHECK-SLEEF-RISCV %s10// RUN: %clang -### -c --target=aarch64 -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-ARMPL %s11// RUN: not %clang -c -fveclib=something %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s12 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 %s27// RUN: not %clang --target=x86 -c -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s28// RUN: not %clang --target=aarch64 -c -fveclib=SVML %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s29// RUN: not %clang --target=aarch64 -c -fveclib=AMDLIBM %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s30// CHECK-ERROR: unsupported option {{.*}} for target31 32// RUN: %clang -fveclib=Accelerate %s -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK %s33// 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 %s36// 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 %s39// 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 %s45// 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 %s48// 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 %s51// 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 %s54// 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 %s57// 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 %s60// 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 %s63// 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 %s66// 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 %s72// 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 %s76// 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 %s80// 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 %s84// 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 %s88// 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 %s92// 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 %s97// 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 %s102// 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 %s107// 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 %s112// 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 %s117// 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 %s122// 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 %s128// 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 %s132// CHECK-REPEAT-VECLIB-NOT: math errno enabled133 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 %s136// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-LINKING-ARMPL-LINUX %s137// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL %s -nostdlib 2>&1 | FileCheck --check-prefix=CHECK-LINKING-ARMPL-NOSTDLIB-LINUX %s138// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL %s -lamath 2>&1 | FileCheck --check-prefix=CHECK-LINKING-AMATH-BEFORE-ARMPL-LINUX %s139// RUN: %clang -### --target=arm64-apple-darwin -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-LINKING-ARMPL-DARWIN %s140// RUN: %clang -### --target=arm64-apple-darwin -fveclib=ArmPL -nostdlib %s 2>&1 | FileCheck --check-prefix=CHECK-LINKING-ARMPL-NOSTDLIB-DARWIN %s141// RUN: %clang -### --target=arm64-apple-darwin -fveclib=ArmPL %s -lamath 2>&1 | FileCheck --check-prefix=CHECK-LINKING-AMATH-BEFORE-ARMPL-DARWIN %s142// 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 %s154// CHECK-RPATH-ARMPL: "--push-state" "--as-needed" "-lm" "-lamath" "-lm" "--pop-state"155// CHECK-RPATH-ARMPL-SAME: "-rpath"156