[cfe-commits] r80655 - in /cfe/trunk: lib/CodeGen/CGBuiltin.cpp test/CodeGen/builtins.c
Eli Friedman
eli.friedman at gmail.com
Mon Aug 31 21:19:44 PDT 2009
Author: efriedma
Date: Mon Aug 31 23:19:44 2009
New Revision: 80655
URL: http://llvm.org/viewvc/llvm-project?rev=80655&view=rev
Log:
PR4836, part 2: CodeGen for __builtin_isnan.
Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/builtins.c
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=80655&r1=80654&r2=80655&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Aug 31 23:19:44 2009
@@ -271,6 +271,11 @@
return RValue::get(Builder.CreateZExt(LHS, ConvertType(E->getType()),
"tmp"));
}
+ case Builtin::BI__builtin_isnan: {
+ Value *V = EmitScalarExpr(E->getArg(0));
+ V = Builder.CreateFCmpUNO(V, V, "cmp");
+ return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType()), "tmp"));
+ }
case Builtin::BIalloca:
case Builtin::BI__builtin_alloca: {
// FIXME: LLVM IR Should allow alloca with an i64 size!
Modified: cfe/trunk/test/CodeGen/builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins.c?rev=80655&r1=80654&r2=80655&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins.c (original)
+++ cfe/trunk/test/CodeGen/builtins.c Mon Aug 31 23:19:44 2009
@@ -54,6 +54,8 @@
P(islessgreater, (1., 2.));
P(isunordered, (1., 2.));
+ P(isnan, (1.));
+
// Bitwise & Numeric Functions
P(abs, (N));
More information about the cfe-commits
mailing list