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

Side by Side Diff: crosstest/test_bitmanip.cpp

Issue 390443005: Lower bitmanip intrinsics, assuming absence of BMI/SSE4.2 for now. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: stuff Created 6 years, 5 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
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698