Subzero: The cross tests should use the actual Subzero runtime.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/560493002
diff --git a/crosstest/test_cast_main.cpp b/crosstest/test_cast_main.cpp
index 7407a59..4ac700e 100644
--- a/crosstest/test_cast_main.cpp
+++ b/crosstest/test_cast_main.cpp
@@ -224,23 +224,3 @@
<< " 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; }
-}
diff --git a/crosstest/test_vector_ops_main.cpp b/crosstest/test_vector_ops_main.cpp
index ef7b450..1232799 100644
--- a/crosstest/test_vector_ops_main.cpp
+++ b/crosstest/test_vector_ops_main.cpp
@@ -162,11 +162,3 @@
return Failures;
}
-
-extern "C" {
-
-void ice_unreachable(void) {
- std::cerr << "\"unreachable\" instruction encountered\n";
- abort();
-}
-}
diff --git a/pydir/crosstest.py b/pydir/crosstest.py
index 2df00f1..54010c5 100755
--- a/pydir/crosstest.py
+++ b/pydir/crosstest.py
@@ -122,6 +122,7 @@
# 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 @@
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
index 0000000..62afa06
--- /dev/null
+++ b/runtime/szrt.cpp
@@ -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"
+}