[PATCH] Add support for generating MIPS legacy NaN
Daniel Sanders
daniel.sanders at imgtec.com
Thu Feb 26 03:03:18 PST 2015
================
Comment at: lib/AST/ExprConstant.cpp:7599-7603
@@ +7598,7 @@
+ } else {
+ // This case will be triggered for Mips legacy encoding.
+ if (SNaN)
+ Result = llvm::APFloat::getQNaN(Sem, false, &fill);
+ else
+ Result = llvm::APFloat::getSNaN(Sem, false, &fill);
+ }
----------------
Could you add a comment explaining the relevant history and why that leads to QNaN and SNaN being reversed here. It won't be obvious to most readers.
================
Comment at: lib/Basic/Targets.cpp:5679
@@ +5678,3 @@
+ bool isNan2008() const override {
+ return IsNan2008 || isNaN2008Default();
+ }
----------------
This isn't quite right. It should just be IsNan2008 since IsNan2008 is initialized with the result of isNaN2008Default().
================
Comment at: test/CodeGen/builtin-nan-legacy.c:2-3
@@ +1,4 @@
+// RUN: %clang -target mipsel-unknown-linux -mnan=legacy -emit-llvm -S -o %t %s
+// RUN: grep 'float 0x7FF4000000000000, float 0x7FF8000000000000' %t
+// RUN: grep 'double 0x7FF4000000000000, double 0x7FF8000000000000' %t
+
----------------
New tests should be using FileCheck rather than grep.
http://reviews.llvm.org/D7882
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list