bjacob | 886ac3e | 2023-03-07 14:25:01 -0500 | [diff] [blame] | 1 | // Copyright 2023 The IREE Authors |
| 2 | // |
| 3 | // Licensed under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | |
| 7 | #include <stdio.h> |
| 8 | |
| 9 | #include "iree/base/api.h" |
| 10 | #include "iree/base/internal/cpu.h" |
| 11 | |
Scott Todd | b716704 | 2024-05-16 10:06:50 -0700 | [diff] [blame] | 12 | int main(int argc, char* argv[]) { |
bjacob | 886ac3e | 2023-03-07 14:25:01 -0500 | [diff] [blame] | 13 | iree_cpu_initialize(iree_allocator_system()); |
bjacob | 0d81062 | 2023-06-01 14:32:37 -0400 | [diff] [blame] | 14 | const uint64_t* cpu_data = iree_cpu_data_fields(); |
bjacob | 886ac3e | 2023-03-07 14:25:01 -0500 | [diff] [blame] | 15 | |
| 16 | #define IREE_CPU_FEATURE_BIT(arch, field_index, bit_pos, bit_name, llvm_name) \ |
| 17 | if (IREE_ARCH_ENUM == IREE_ARCH_ENUM_##arch) { \ |
bjacob | 0d81062 | 2023-06-01 14:32:37 -0400 | [diff] [blame] | 18 | bool result = (cpu_data[field_index] & (1ull << bit_pos)) != 0; \ |
CindyLiu | 43774f6 | 2023-07-28 23:35:38 -0700 | [diff] [blame] | 19 | printf("%-20s %d\n", llvm_name, (int)result); \ |
bjacob | 886ac3e | 2023-03-07 14:25:01 -0500 | [diff] [blame] | 20 | } |
| 21 | #include "iree/schemas/cpu_feature_bits.inl" |
| 22 | #undef IREE_CPU_FEATURE_BIT |
| 23 | |
| 24 | return 0; |
| 25 | } |