From: Jim Stichnoth Date: Tue, 9 Sep 2014 21:40:40 +0000 (-0700) Subject: Subzero: The cross tests should use the actual Subzero runtime. X-Git-Tag: android-x86-7.1-r1~148^2~1097 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6d4f5647ad542d59f7db34de5518402500ce7a9a;p=android-x86%2Fexternal-swiftshader.git 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 7407a595c..4ac700e1f 100644 --- a/crosstest/test_cast_main.cpp +++ b/crosstest/test_cast_main.cpp @@ -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; } -} diff --git a/crosstest/test_vector_ops_main.cpp b/crosstest/test_vector_ops_main.cpp index ef7b4504a..1232799a9 100644 --- a/crosstest/test_vector_ops_main.cpp +++ b/crosstest/test_vector_ops_main.cpp @@ -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(); -} -} diff --git a/pydir/crosstest.py b/pydir/crosstest.py index 2df00f14e..54010c52e 100755 --- a/pydir/crosstest.py +++ b/pydir/crosstest.py @@ -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 index 000000000..62afa06da --- /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" +}