From: Daniel Sanders Date: Thu, 24 Sep 2015 10:22:17 +0000 (+0000) Subject: [mips] Relax -mnan=2008 acceptance to permit MIPS32R2 and MIPS64R2. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f138c78edd1bbb22b070d1bffa42a8bad36455ab;p=clang [mips] Relax -mnan=2008 acceptance to permit MIPS32R2 and MIPS64R2. Summary: Strictly speaking, the MIPS*R2 ISA's should not permit -mnan=2008 since this feature was added in MIPS*R3. However, other toolchains permit this and we should do the same. Reviewers: atanasyan Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13057 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248481 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 218d1218f2..682c7e5255 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -6191,6 +6191,9 @@ void arm::appendEBLinkFlags(const ArgList &Args, ArgStringList &CmdArgs, } mips::NanEncoding mips::getSupportedNanEncoding(StringRef &CPU) { + // Strictly speaking, mips32r2 and mips64r2 are NanLegacy-only since Nan2008 + // was first introduced in Release 3. However, other compilers have + // traditionally allowed it for Release 2 so we should do the same. return (NanEncoding)llvm::StringSwitch(CPU) .Case("mips1", NanLegacy) .Case("mips2", NanLegacy) @@ -6198,12 +6201,12 @@ mips::NanEncoding mips::getSupportedNanEncoding(StringRef &CPU) { .Case("mips4", NanLegacy) .Case("mips5", NanLegacy) .Case("mips32", NanLegacy) - .Case("mips32r2", NanLegacy) + .Case("mips32r2", NanLegacy | Nan2008) .Case("mips32r3", NanLegacy | Nan2008) .Case("mips32r5", NanLegacy | Nan2008) .Case("mips32r6", Nan2008) .Case("mips64", NanLegacy) - .Case("mips64r2", NanLegacy) + .Case("mips64r2", NanLegacy | Nan2008) .Case("mips64r3", NanLegacy | Nan2008) .Case("mips64r5", NanLegacy | Nan2008) .Case("mips64r6", Nan2008) diff --git a/test/CodeGen/mips-unsupported-nan.c b/test/CodeGen/mips-unsupported-nan.c index 14a36fc029..2fd5042e92 100644 --- a/test/CodeGen/mips-unsupported-nan.c +++ b/test/CodeGen/mips-unsupported-nan.c @@ -1,24 +1,44 @@ -// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips2 -emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS2 -check-prefix=CHECK-NANLEGACY %s -// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips3 -emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS3 -check-prefix=CHECK-NANLEGACY %s -// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips4 -emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS4 -check-prefix=CHECK-NANLEGACY %s -// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32 -emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS32 -check-prefix=CHECK-NANLEGACY %s -// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r2 -emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS32R2 -check-prefix=CHECK-NANLEGACY %s -// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r3 -emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-NOT-MIPS32R3 -check-prefix=CHECK-NAN2008 %s -// RUN: %clang -target mipsel-unknown-linux -mnan=legacy -march=mips32r6 -emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS32R6 -check-prefix=CHECK-NAN2008 %s -// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64 -emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS64 -check-prefix=CHECK-NANLEGACY %s -// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64r2 -emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS64R2 -check-prefix=CHECK-NANLEGACY %s -// RUN: %clang -target mips64el-unknown-linux -mnan=legacy -march=mips64r6 -emit-llvm -S %s -o - 2>&1 | FileCheck -check-prefix=CHECK-MIPS64R6 -check-prefix=CHECK-NAN2008 %s +// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s +// RUN: FileCheck -check-prefix=CHECK-MIPS2 %s < %t +// +// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips3 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s +// RUN: FileCheck -check-prefix=CHECK-MIPS3 %s < %t +// +// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips4 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s +// RUN: FileCheck -check-prefix=CHECK-MIPS4 %s < %t +// +// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s +// RUN: FileCheck -check-prefix=CHECK-MIPS32 %s < %t +// +// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s +// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t +// +// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r3 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s +// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t +// +// RUN: %clang -target mipsel-unknown-linux -mnan=legacy -march=mips32r6 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s +// RUN: FileCheck -check-prefix=CHECK-MIPS32R6 %s < %t +// +// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s +// RUN: FileCheck -check-prefix=CHECK-MIPS64 %s < %t +// +// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64r2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s +// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t +// +// RUN: %clang -target mips64el-unknown-linux -mnan=legacy -march=mips64r6 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s +// RUN: FileCheck -check-prefix=CHECK-MIPS64R6 %s < %t + +// NO-WARNINGS-NOT: warning: ignoring '-mnan=legacy' option +// NO-WARNINGS-NOT: warning: ignoring '-mnan=2008' option // CHECK-MIPS2: warning: ignoring '-mnan=2008' option because the 'mips2' architecture does not support it // 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-MIPS32R2: warning: ignoring '-mnan=2008' option because the 'mips32r2' architecture does not support it -// CHECK-MIPS32R3: warning: ignoring '-mnan=2008' option because the 'mips32r3' architecture does not support it // CHECK-MIPS32R6: warning: ignoring '-mnan=legacy' option because the 'mips32r6' architecture does not support it // CHECK-MIPS64: warning: ignoring '-mnan=2008' option because the 'mips64' architecture does not support it -// CHECK-MIPS64R2: warning: ignoring '-mnan=2008' option because the 'mips64r2' architecture does not support it // CHECK-MIPS64R6: warning: ignoring '-mnan=legacy' option because the 'mips64r6' architecture does not support it + // CHECK-NANLEGACY: float 0x7FF4000000000000 // CHECK-NAN2008: float 0x7FF8000000000000