OLD | NEW |
---|---|
(Empty) | |
1 //===- subzero/crosstest/test_bitmanip.cpp - Implementation for tests --===// | |
Jim Stichnoth
2014/07/14 23:20:45
Space it out to 80 cols :)
jvoung (off chromium)
2014/07/15 21:30:22
Done.
| |
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 aims to test that all the bit manipulation intrinsics work, via | |
11 // cross-testing. This uses a wrapper around the GCC __builtins to access | |
wala
2014/07/15 00:16:31
Where were the GCC __builtins? I don't see them.
jvoung (off chromium)
2014/07/15 21:30:23
These are only using the wrappers, but the builtin
| |
12 // the NaCl intrinsics. | |
13 // | |
14 //===----------------------------------------------------------------------===// | |
15 | |
16 #include <stdint.h> | |
17 | |
18 #include <cstdlib> | |
19 | |
20 #include "test_bitmanip.h" | |
21 | |
22 #define X(inst, type) \ | |
23 type test_##inst(type a) { return my_##inst(a); } \ | |
24 type test_alloca_##inst(type a) { \ | |
25 const size_t buf_size = 8; \ | |
26 type buf[buf_size]; \ | |
27 for (size_t i = 0; i < buf_size; ++i) { \ | |
28 buf[i] = my_##inst(a); \ | |
29 } \ | |
30 type sum = 0; \ | |
31 for (size_t i = 0; i < buf_size; ++i) { \ | |
32 sum += buf[i]; \ | |
33 } \ | |
34 return sum; \ | |
35 } \ | |
36 type test_const_##inst(type ignored) { \ | |
37 return my_##inst(static_cast<type>(0x12340)); \ | |
38 } | |
39 | |
40 FOR_ALL_BMI_OP_TYPES(X) | |
41 #undef X | |
OLD | NEW |