Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: runtime/szrt.c

Issue 944333002: Subzero: Update tests and build scripts for sandboxing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: More code review changes Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pydir/szbuild_spec2k.py ('k') | runtime/szrt.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 wrappers for particular bitcode instructions
11 // Subzero. This needs to be compiled by some non-Subzero compiler. 11 // that are too uncommon and complex for a particular target to bother
12 // implementing directly in Subzero target lowering. This needs to be
13 // compiled by some non-Subzero compiler.
12 // 14 //
13 //===----------------------------------------------------------------------===// 15 //===----------------------------------------------------------------------===//
14 16
15 #include <stdint.h> 17 #include <stdint.h>
16 #include <stdlib.h> 18 #include <stdlib.h>
17 19
18 uint32_t cvtftoui32(float value) { return (uint32_t)value; } 20 // TODO(stichnot): The various NaN cross tests try to map Subzero's
21 // undefined behavior to the same as llc's undefined behavior, as
22 // observed by the cross tests. This will have to be kept up to date
23 // with any future changes to llc, and may also have to be different
24 // for different targets. It would be better to find a more
25 // appropriate set of llc options when building the Subzero runtime.
26 //
27 // We test for NaN using "value==value" instead of using isnan(value)
28 // to avoid an external dependency on fpclassify().
19 29
20 uint32_t cvtdtoui32(double value) { return (uint32_t)value; } 30 uint32_t cvtftoui32(float value) {
31 if (value == value) // NaNaN
32 return (uint32_t)value;
33 return 0x80000000;
34 }
35
36 uint32_t cvtdtoui32(double value) {
37 if (value == value) // NaNaN
38 return (uint32_t)value;
39 return 0x80000000;
40 }
21 41
22 int64_t cvtftosi64(float value) { return (int64_t)value; } 42 int64_t cvtftosi64(float value) { return (int64_t)value; }
23 43
24 int64_t cvtdtosi64(double value) { return (int64_t)value; } 44 int64_t cvtdtosi64(double value) { return (int64_t)value; }
25 45
26 uint64_t cvtftoui64(float value) { return (uint64_t)value; } 46 uint64_t cvtftoui64(float value) { return (uint64_t)value; }
27 47
28 uint64_t cvtdtoui64(double value) { return (uint64_t)value; } 48 uint64_t cvtdtoui64(double value) { return (uint64_t)value; }
29 49
30 float cvtui32tof(uint32_t value) { return (float)value; } 50 float cvtui32tof(uint32_t value) { return (float)value; }
31 51
32 float cvtsi64tof(int64_t value) { return (float)value; } 52 float cvtsi64tof(int64_t value) { return (float)value; }
33 53
34 float cvtui64tof(uint64_t value) { return (float)value; } 54 float cvtui64tof(uint64_t value) { return (float)value; }
35 55
36 double cvtui32tod(uint32_t value) { return (double)value; } 56 double cvtui32tod(uint32_t value) { return (double)value; }
37 57
38 double cvtsi64tod(int64_t value) { return (double)value; } 58 double cvtsi64tod(int64_t value) { return (double)value; }
39 59
40 double cvtui64tod(uint64_t value) { return (double)value; } 60 double cvtui64tod(uint64_t value) { return (double)value; }
41 61
42 /* TODO(stichnot): 62 /* TODO(stichnot):
43 Sz_bitcast_v8i1_to_i8 63 Sz_bitcast_v8i1_to_i8
44 Sz_bitcast_v16i1_to_i16 64 Sz_bitcast_v16i1_to_i16
45 Sz_bitcast_i8_to_v8i1 65 Sz_bitcast_i8_to_v8i1
46 Sz_bitcast_i16_to_v16i1 66 Sz_bitcast_i16_to_v16i1
47 */ 67 */
OLDNEW
« no previous file with comments | « pydir/szbuild_spec2k.py ('k') | runtime/szrt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698