OSDN Git Service

Subzero: The cross tests should use the actual Subzero runtime.
authorJim Stichnoth <stichnot@chromium.org>
Tue, 9 Sep 2014 21:40:40 +0000 (14:40 -0700)
committerJim Stichnoth <stichnot@chromium.org>
Tue, 9 Sep 2014 21:40:40 +0000 (14:40 -0700)
BUG= none
R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/560493002

crosstest/test_cast_main.cpp
crosstest/test_vector_ops_main.cpp
pydir/crosstest.py
runtime/szrt.cpp [new file with mode: 0644]

index 7407a59..4ac700e 100644 (file)
@@ -224,23 +224,3 @@ int main(int argc, char **argv) {
             << " Failures=" << Failures << "\n";
   return Failures;
 }
-
-////////////////////////////////////////////////////////////////
-
-// The following are helper definitions that should be part of the
-// Subzero runtime.
-
-extern "C" {
-uint32_t cvtdtoui32(double a) { return (uint32_t)a; }
-uint32_t cvtftoui32(float a) { return (uint32_t)a; }
-int64_t cvtdtosi64(double a) { return (int64_t)a; }
-int64_t cvtftosi64(float a) { return (int64_t)a; }
-uint64_t cvtdtoui64(double a) { return (uint64_t)a; }
-uint64_t cvtftoui64(float a) { return (uint64_t)a; }
-float cvtui64tof(uint64_t a) { return (float)a; }
-double cvtui64tod(uint64_t a) { return (double)a; }
-float cvtsi64tof(int64_t a) { return (float)a; }
-float cvtui32tof(uint32_t a) { return (float)a; }
-double cvtui32tod(uint32_t a) { return (double)a; }
-double cvtsi64tod(int64_t a) { return (double)a; }
-}
index ef7b450..1232799 100644 (file)
@@ -162,11 +162,3 @@ int main(int argc, char *argv[]) {
 
   return Failures;
 }
-
-extern "C" {
-
-void ice_unreachable(void) {
-  std::cerr << "\"unreachable\" instruction encountered\n";
-  abort();
-}
-}
index 2df00f1..54010c5 100755 (executable)
@@ -122,6 +122,7 @@ if __name__ == '__main__':
         # failures.  This behavior can be inspected by switching
         # use_llc between True and False.
         use_llc = False
+        pure_c = os.path.splitext(args.driver)[1] == '.c'
         if not args.crosstest_bitcode:
             objs.append(arg)
         elif use_llc:
@@ -133,7 +134,11 @@ if __name__ == '__main__':
         else:
             objs.append(bitcode)
 
-    linker = 'clang' if os.path.splitext(args.driver)[1] == '.c' else 'clang++'
+    # Use 'clang szrt.c'  -or-  'clang++ szrt.cpp'
+    objs.append((
+            '{root}/toolchain_build/src/subzero/runtime/szrt.{ext}'
+            ).format(root=nacl_root, ext='c' if pure_c else 'cpp'))
+    linker = 'clang' if pure_c else 'clang++'
     shellcmd([linker, '-g', '-m32', args.driver] +
              objs +
              ['-lm', '-lpthread', '-o', os.path.join(args.dir, args.output)])
diff --git a/runtime/szrt.cpp b/runtime/szrt.cpp
new file mode 100644 (file)
index 0000000..62afa06
--- /dev/null
@@ -0,0 +1,17 @@
+//===- subzero/runtime/szrt.cpp - Subzero runtime source ------------------===//
+//
+//                        The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a C++ wrapper to szrt.c since clang++ complains about
+// .c files.
+//
+//===----------------------------------------------------------------------===//
+
+extern "C" {
+#include "szrt.c"
+}