From c23094efb4b211f20a8e4aa877c2b9f5abffe09f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 6 Nov 2001 22:53:25 +0000 Subject: [PATCH] Implement log and drand48 for TSP bm llvm-svn: 1165 --- .../Interpreter/ExternalFunctions.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index f40205bce143..08158d2be576 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -229,6 +229,23 @@ GenericValue lle_X_sqrt(MethodType *M, const vector &Args) { return GV; } +// double log(double) +GenericValue lle_X_log(MethodType *M, const vector &Args) { + assert(Args.size() == 1); + GenericValue GV; + GV.DoubleVal = log(Args[0].DoubleVal); + return GV; +} + +// double drand48() +GenericValue lle_X_drand48(MethodType *M, const vector &Args) { + assert(Args.size() == 0); + GenericValue GV; + GV.DoubleVal = drand48(); + return GV; +} + + // int printf(sbyte *, ...) - a very rough implementation to make output useful. GenericValue lle_X_printf(MethodType *M, const vector &Args) { const char *FmtStr = (const char *)Args[0].PointerVal;