blob: 3596db39bdb78bc3aa59162fa4ca61c2a180dfff [file] [log] [blame]
Jim Stichnoth10ea6982014-09-09 11:19:12 -07001//===- subzero/runtime/szrt.c - Subzero runtime source ----------*- C++ -*-===//
2//
3// The Subzero Code Generator
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the runtime helper routines that are needed by
11// Subzero. This needs to be compiled by some non-Subzero compiler.
12//
13//===----------------------------------------------------------------------===//
14
15#include <stdint.h>
16#include <stdlib.h>
17
18void ice_unreachable(void) {
19 abort();
20}
21
22uint32_t cvtftoui32(float value) {
23 return (uint32_t) value;
24}
25
26uint32_t cvtdtoui32(double value) {
27 return (uint32_t) value;
28}
29
30int64_t cvtftosi64(float value) {
31 return (int64_t) value;
32}
33
34int64_t cvtdtosi64(double value) {
35 return (int64_t) value;
36}
37
38uint64_t cvtftoui64(float value) {
39 return (uint64_t) value;
40}
41
42uint64_t cvtdtoui64(double value) {
43 return (uint64_t) value;
44}
45
46float cvtui32tof(uint32_t value) {
47 return (float) value;
48}
49
50float cvtsi64tof(int64_t value) {
51 return (float) value;
52}
53
54float cvtui64tof(uint64_t value) {
55 return (float) value;
56}
57
58double cvtui32tod(uint32_t value) {
59 return (double) value;
60}
61
62double cvtsi64tod(int64_t value) {
63 return (double) value;
64}
65
66double cvtui64tod(uint64_t value) {
67 return (double) value;
68}
69
70/* TODO(stichnot):
Jim Stichnoth10ea6982014-09-09 11:19:12 -070071 Sz_bitcast_v8i1_to_i8
72 Sz_bitcast_v16i1_to_i16
73 Sz_bitcast_i8_to_v8i1
74 Sz_bitcast_i16_to_v16i1
75*/