Jim Stichnoth | 10ea698 | 2014-09-09 11:19:12 -0700 | [diff] [blame] | 1 | //===- 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 | |
| 18 | void ice_unreachable(void) { |
| 19 | abort(); |
| 20 | } |
| 21 | |
| 22 | uint32_t cvtftoui32(float value) { |
| 23 | return (uint32_t) value; |
| 24 | } |
| 25 | |
| 26 | uint32_t cvtdtoui32(double value) { |
| 27 | return (uint32_t) value; |
| 28 | } |
| 29 | |
| 30 | int64_t cvtftosi64(float value) { |
| 31 | return (int64_t) value; |
| 32 | } |
| 33 | |
| 34 | int64_t cvtdtosi64(double value) { |
| 35 | return (int64_t) value; |
| 36 | } |
| 37 | |
| 38 | uint64_t cvtftoui64(float value) { |
| 39 | return (uint64_t) value; |
| 40 | } |
| 41 | |
| 42 | uint64_t cvtdtoui64(double value) { |
| 43 | return (uint64_t) value; |
| 44 | } |
| 45 | |
| 46 | float cvtui32tof(uint32_t value) { |
| 47 | return (float) value; |
| 48 | } |
| 49 | |
| 50 | float cvtsi64tof(int64_t value) { |
| 51 | return (float) value; |
| 52 | } |
| 53 | |
| 54 | float cvtui64tof(uint64_t value) { |
| 55 | return (float) value; |
| 56 | } |
| 57 | |
| 58 | double cvtui32tod(uint32_t value) { |
| 59 | return (double) value; |
| 60 | } |
| 61 | |
| 62 | double cvtsi64tod(int64_t value) { |
| 63 | return (double) value; |
| 64 | } |
| 65 | |
| 66 | double cvtui64tod(uint64_t value) { |
| 67 | return (double) value; |
| 68 | } |
| 69 | |
| 70 | /* TODO(stichnot): |
Jim Stichnoth | 10ea698 | 2014-09-09 11:19:12 -0700 | [diff] [blame] | 71 | Sz_bitcast_v8i1_to_i8 |
| 72 | Sz_bitcast_v16i1_to_i16 |
| 73 | Sz_bitcast_i8_to_v8i1 |
| 74 | Sz_bitcast_i16_to_v16i1 |
| 75 | */ |