Implement log and drand48 for TSP bm
authorChris Lattner <sabre@nondot.org>
Tue, 6 Nov 2001 22:53:25 +0000 (22:53 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 6 Nov 2001 22:53:25 +0000 (22:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1165 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp

index f40205bce143efe9a593baf363ebb50425f5f34b..08158d2be576015543b6ac1290609459b5fbd193 100644 (file)
@@ -229,6 +229,23 @@ GenericValue lle_X_sqrt(MethodType *M, const vector<GenericValue> &Args) {
   return GV;
 }
 
+// double log(double)
+GenericValue lle_X_log(MethodType *M, const vector<GenericValue> &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<GenericValue> &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<GenericValue> &Args) {
   const char *FmtStr = (const char *)Args[0].PointerVal;