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