| //===- subzero/crosstest/test_bitmanip.cpp - Implementation for tests. ----===// |
| // The Subzero Code Generator |
| // This file is distributed under the University of Illinois Open Source |
| // License. See LICENSE.TXT for details. |
| //===----------------------------------------------------------------------===// |
| // This aims to test that all the bit manipulation intrinsics work, via |
| // cross-testing. This calls wrappers (my_{ctlz,cttz,ctpop} around the |
| // intrinsics (llvm.{ctlz,cttz,ctpop}.*). |
| //===----------------------------------------------------------------------===// |
| #include "test_bitmanip.h" |
| type test_##inst(type a) { return my_##inst(a); } \ |
| type test_alloca_##inst(type a) { \ |
| const size_t buf_size = 8; \ |
| for (size_t i = 0; i < buf_size; ++i) { \ |
| for (size_t i = 0; i < buf_size; ++i) { \ |
| type test_const_##inst(type ignored) { \ |
| return my_##inst(static_cast<type>(0x12340)); \ |
| #define X(type, builtin_name) \ |
| type test_bswap(type a) { return builtin_name(a); } |