blob: dcc1ff5f953ba1b9d221b72853e71beb7994f2d3 [file] [log] [blame]
bjacob886ac3e2023-03-07 14:25:01 -05001// 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 Toddb7167042024-05-16 10:06:50 -070012int main(int argc, char* argv[]) {
bjacob886ac3e2023-03-07 14:25:01 -050013 iree_cpu_initialize(iree_allocator_system());
bjacob0d810622023-06-01 14:32:37 -040014 const uint64_t* cpu_data = iree_cpu_data_fields();
bjacob886ac3e2023-03-07 14:25:01 -050015
16#define IREE_CPU_FEATURE_BIT(arch, field_index, bit_pos, bit_name, llvm_name) \
17 if (IREE_ARCH_ENUM == IREE_ARCH_ENUM_##arch) { \
bjacob0d810622023-06-01 14:32:37 -040018 bool result = (cpu_data[field_index] & (1ull << bit_pos)) != 0; \
CindyLiu43774f62023-07-28 23:35:38 -070019 printf("%-20s %d\n", llvm_name, (int)result); \
bjacob886ac3e2023-03-07 14:25:01 -050020 }
21#include "iree/schemas/cpu_feature_bits.inl"
22#undef IREE_CPU_FEATURE_BIT
23
24 return 0;
25}