Skip to content

Commit 2d57eca

Browse files
committed
Fixups
1 parent 5ce5c33 commit 2d57eca

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,10 +3142,10 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
31423142
break;
31433143
case options::OPT_fveclib:
31443144
VecLibArg = A;
3145-
if (llvm::is_contained(VecLibImpliesNoMathErrno, A->getValue())) {
3145+
NoMathErrnoWasImpliedByVecLib =
3146+
llvm::is_contained(VecLibImpliesNoMathErrno, A->getValue());
3147+
if (NoMathErrnoWasImpliedByVecLib)
31463148
MathErrno = false;
3147-
NoMathErrnoWasImpliedByVecLib = true;
3148-
}
31493149
break;
31503150
case options::OPT_fno_trapping_math:
31513151
if (!TrappingMathPresent && !FPExceptionBehavior.empty() &&

clang/test/Driver/fveclib.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,28 @@
7777

7878
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -fmath-errno %s 2>&1 | FileCheck --check-prefix=CHECK-REENABLE-ERRNO-ARMPL %s
7979
// 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]
80-
8180
// CHECK-REENABLE-ERRNO-ARMPL: "-fveclib=ArmPL"
8281
// CHECK-REENABLE-ERRNO-ARMPL-SAME: "-fmath-errno"
8382

8483
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=SLEEF -fmath-errno %s 2>&1 | FileCheck --check-prefix=CHECK-REENABLE-ERRNO-SLEEF %s
8584
// 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]
86-
8785
// CHECK-REENABLE-ERRNO-SLEEF: "-fveclib=SLEEF"
8886
// CHECK-REENABLE-ERRNO-SLEEF-SAME: "-fmath-errno"
8987

9088
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -fno-fast-math %s 2>&1 | FileCheck --check-prefix=CHECK-REENABLE-ERRNO-NFM %s
9189
// 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]
92-
9390
// CHECK-REENABLE-ERRNO-NFM: "-fveclib=ArmPL"
9491
// CHECK-REENABLE-ERRNO-NFM-SAME: "-fmath-errno"
9592

9693
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -ffp-model=strict %s 2>&1 | FileCheck --check-prefix=CHECK-REENABLE-ERRNO-FP-MODEL %s
9794
// 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]
98-
9995
// CHECK-REENABLE-ERRNO-FP-MODEL: "-fveclib=ArmPL"
10096
// CHECK-REENABLE-ERRNO-FP-MODEL-SAME: "-fmath-errno"
97+
98+
/* Verify the warning points at the last arg to enable -fmath-errno. */
99+
// 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
100+
// 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]
101+
102+
/* Verify no warning when math-errno is re-enabled for a different veclib (that does not imply -fno-math-errno). */
103+
// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -fmath-errno -fveclib=LIBMVEC %s 2>&1 | FileCheck --check-prefix=CHECK-REPEAT-VECLIB %s
104+
// CHECK-REPEAT-VECLIB-NOT: math errno enabled

0 commit comments

Comments
 (0)