Author: dsanders Date: Thu Sep 24 05:22:17 2015 New Revision: 248481 URL: http://llvm.org/viewvc/llvm-project?rev=248481&view=rev Log: [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 Modified: cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/CodeGen/mips-unsupported-nan.c Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=248481&r1=248480&r2=248481&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Thu Sep 24 05:22:17 2015 @@ -6191,6 +6191,9 @@ void arm::appendEBLinkFlags(const ArgLis } 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<int>(CPU) .Case("mips1", NanLegacy) .Case("mips2", NanLegacy) @@ -6198,12 +6201,12 @@ mips::NanEncoding mips::getSupportedNanE .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) Modified: cfe/trunk/test/CodeGen/mips-unsupported-nan.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mips-unsupported-nan.c?rev=248481&r1=248480&r2=248481&view=diff ============================================================================== --- cfe/trunk/test/CodeGen/mips-unsupported-nan.c (original) +++ cfe/trunk/test/CodeGen/mips-unsupported-nan.c Thu Sep 24 05:22:17 2015 @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits