Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,10 @@ def warn_target_unsupported_nan2008 : Warning<
def warn_target_unsupported_nanlegacy : Warning<
"ignoring '-mnan=legacy' option because the '%0' architecture does not support it">,
InGroup<UnsupportedNan>;
def warn_target_unsupported_convertnanlegacytonan2008 : Warning<
"ignoring unsupported '-mnan=legacy' option and instead set to `-mnan=2008` option "
"because the '%0' architecture supports it">,
InGroup<UnsupportedNan>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this any better?

"ignoring unsupported '-mnan=legacy' option and instead set to `-mnan=2008` option because the '%0' architecture supports it"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More clear, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, applied. Can you help review again?

def warn_target_unsupported_abslegacy : Warning<
"ignoring '-mabs=legacy' option because the '%0' architecture does not support it">,
InGroup<UnsupportedAbs>;
Expand Down
9 changes: 6 additions & 3 deletions clang/lib/Driver/ToolChains/Arch/Mips.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,13 @@ void mips::getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple,
D.Diag(diag::warn_target_unsupported_nan2008) << CPUName;
}
} else if (Val == "legacy") {
if (mips::getIEEE754Standard(CPUName) & mips::Legacy)
Features.push_back("-nan2008");
else {
if (mips::getIEEE754Standard(CPUName) & mips::Std2008) {
Features.push_back("+nan2008");
HasNaN2008Opt = true;
D.Diag(diag::warn_target_unsupported_convertnanlegacytonan2008)
<< CPUName;
} else {
Features.push_back("-nan2008");
D.Diag(diag::warn_target_unsupported_nanlegacy) << CPUName;
}
} else
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CodeGen/builtin-nan-legacy.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang -target mipsel-unknown-linux -mnan=legacy -emit-llvm -S %s -o - | FileCheck %s
// CHECK: float 0x7FFC000000000000, float 0x7FF8000000000000
// CHECK: double 0x7FF4000000000000, double 0x7FF8000000000000
// CHECK: float 0x7FF8000000000000, float 0x7FFC000000000000
// CHECK: double 0x7FF8000000000000, double 0x7FF4000000000000

// The first line shows an unintended consequence.
// __builtin_nan() creates a legacy QNAN double with an empty payload
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CodeGen/mips-unsupported-nan.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
// CHECK-MIPS3: warning: ignoring '-mnan=2008' option because the 'mips3' architecture does not support it
// CHECK-MIPS4: warning: ignoring '-mnan=2008' option because the 'mips4' architecture does not support it
// CHECK-MIPS32: warning: ignoring '-mnan=2008' option because the 'mips32' architecture does not support it
// CHECK-MIPS32R6: warning: ignoring '-mnan=legacy' option because the 'mips32r6' architecture does not support it
// CHECK-MIPS32R6: warning: ignoring unsupported '-mnan=legacy' option and instead set to `-mnan=2008` option because the 'mips32r6' architecture supports it
// CHECK-MIPS64: warning: ignoring '-mnan=2008' option because the 'mips64' architecture does not support it
// CHECK-MIPS64R6: warning: ignoring '-mnan=legacy' option because the 'mips64r6' architecture does not support it
// CHECK-MIPS64R6: warning: ignoring unsupported '-mnan=legacy' option and instead set to `-mnan=2008` option because the 'mips64r6' architecture supports it

// This call creates a QNAN double with an empty payload.
// The quiet bit is inverted in legacy mode: it is clear to indicate QNAN,
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/mips-as.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS-NAN-LEGACY %s
// MIPS-NAN-LEGACY: as{{(.exe)?}}"
// MIPS-NAN-LEGACY-NOT: "{{[ A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-mnan={{.*}}"
// MIPS-NAN-LEGACY: "-target-feature" "+nan2008" "-target-feature" "+abs2008"
//
// RUN: %clang --target=mips-linux-gnu -mfp64 -mfpxx -mfp32 -### \
// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \
Expand Down
5 changes: 2 additions & 3 deletions clang/test/Driver/mips-features.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,10 @@
// RUN: | FileCheck --check-prefix=CHECK-ABSLEGACYNAN2008 %s
// CHECK-ABSLEGACYNAN2008: "-target-feature" "+nan2008" "-target-feature" "-abs2008"
//
// -mnan=legacy
// -mnan=2008
// RUN: %clang --target=mips-linux-gnu -march=mips32r3 -### -c %s \
// RUN: -mnan=2008 -mnan=legacy 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NANLEGACY %s
// CHECK-NANLEGACY: "-target-feature" "-nan2008"
// RUN: | FileCheck --check-prefix=CHECK-NAN2008 %s
//
// -mabs=2008 on pre R2
// RUN: %clang --target=mips-linux-gnu -march=mips32 -### -c %s \
Expand Down
4 changes: 1 addition & 3 deletions clang/test/Driver/mips-integrated-as.s
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@
// NAN-DEFAULT-NOT: "-target-feature" "{{[-+]}}nan2008"

// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mnan=legacy 2>&1 | \
// RUN: FileCheck -check-prefix=NAN-LEGACY %s
// NAN-LEGACY: -cc1as
// NAN-LEGACY: "-target-feature" "-nan2008"
// RUN: FileCheck -check-prefix=NAN-2008 %s

// RUN: %clang --target=mips-linux-gnu -march=mips32r6 -### -fintegrated-as -c %s -mnan=2008 2>&1 | \
// RUN: FileCheck -check-prefix=NAN-2008 %s
Expand Down