<commit_before>// SPDX-License-Identifier: BSD-2-Clause
// SPDX-FileCopyrightText: 2017 Dr.-Ing. <NAME> <EMAIL>

#ifndef _CHECK_HW_H_
#define _CHECK_HW_H_

#include <stdint.h>
#include <unistd.h>         /* for sysconf / _SC_NPROCESSORS_ONLN */
#include "cpu_features_macros.h"

#ifdef CPU_FEATURES_ARCH_X86_64
# include "cpuinfo_x86.h"
typedef union {
  X86Features in;
  uint64_t bits;
} archfeatures;
#endif /* #ifdef CPU_FEATURES_ARCH_X86_64 */

#ifdef CPU_FEATURES_ARCH_PPC
# include "cpuinfo_ppc.h"
typedef union {
  PPCFeatures in;
  uint64_t bits;
} archfeatures;
#endif /* #ifdef CPU_FEATURES_ARCH_PPC */

#ifdef CPU_FEATURES_ARCH_ARM
# include "cpuinfo_arm.h"
typedef union {
  ArmFeatures in;
  uint64_t bits;
} archfeatures;
#endif /* #ifdef CPU_FEATURES_ARCH_ARM */

#ifdef CPU_FEATURES_ARCH_AARCH64
# include "cpuinfo_aarch64.h"
typedef union {
  Aarch64Features in;
  uint64_t bits;
} archfeatures;
#endif /* #ifdef CPU_FEATURES_ARCH_AARCH64 */

static archfeatures check_hw_capabilites( void )
{
#ifdef CPU_FEATURES_ARCH_X86_64
  archfeatures cap = { .in = GetX86Info().features };
#endif /* #ifdef CPU_FEATURES_ARCH_X86_64 */

#ifdef CPU_FEATURES_ARCH_PPC
  archfeatures cap = { .in = GetPPCInfo().features };
#endif /* #ifdef CPU_FEATURES_ARCH_PPC */

#ifdef CPU_FEATURES_ARCH_ARM
  archfeatures cap = { .in = GetArmInfo().features };
#endif /* #ifdef CPU_FEATURES_ARCH_ARM */

#ifdef CPU_FEATURES_ARCH_AARCH64
  archfeatures cap = { .in = GetAarch64Info().features };
#endif /* #ifdef CPU_FEATURES_ARCH_AARCH64 */
  return cap;
}

static void print_hw_capabilites( archfeatures cap )
{
  if( cap.bits ) {
#ifdef CPU_FEATURES_ARCH_X86_64
//    if( cap & HAS_SSE )
    printf(" sse");
    if( cap.in.avx )
      printf(" avx");
    if( cap.in.avx2 )
      printf(" avx2");
    if( cap.in.fma3 )
      printf(" fma");
#endif

#ifdef CPU_FEATURES_ARCH_PPC
    if( cap.altivec )
      printf(" altivec");
    if( cap.in.vsx )<commit_msg>Fix defines<commit_after>// SPDX-License-Identifier: BSD-2-Clause
// SPDX-FileCopyrightText: 2017 Dr.-Ing. <NAME> <EMAIL>

#ifndef _CHECK_HW_H_
#define _CHECK_HW_H_

#include <stdint.h>
#include <unistd.h>         /* for sysconf / _SC_NPROCESSORS_ONLN */
#include "cpu_features_macros.h"

#ifdef CPU_FEATURES_ARCH_X86_64
# include "cpuinfo_x86.h"
#elif defined(CPU_FEATURES_ARCH_PPC)
# include "cpuinfo_ppc.h"
#elif defined(CPU_FEATURES_ARCH_ARM)
# include "cpuinfo_arm.h"
#elif defined(CPU_FEATURES_ARCH_AARCH64)
# include "cpuinfo_aarch64.h"
#endif

typedef union {
#ifdef CPU_FEATURES_ARCH_X86_64
  X86Features in;
#elif defined(CPU_FEATURES_ARCH_PPC)
  PPCFeatures in;
#elif defined(CPU_FEATURES_ARCH_ARM)
  ArmFeatures in;
#elif defined(CPU_FEATURES_ARCH_AARCH64)
  Aarch64Features in;
#endif
  uint64_t bits;
} archfeatures;

static archfeatures check_hw_capabilites( void )
{
  archfeatures cap = {
#ifdef CPU_FEATURES_ARCH_X86_64
    .in = GetX86Info().features
#elif defined(CPU_FEATURES_ARCH_PPC)
    .in = GetPPCInfo().features
#elif defined(CPU_FEATURES_ARCH_ARM)
    .in = GetArmInfo().features
#elif defined(CPU_FEATURES_ARCH_AARCH64)
    .in = GetAarch64Info().features
#endif
  };
  return cap;
}

static void print_hw_capabilites( archfeatures cap )
{
  if( cap.bits ) {
#ifdef CPU_FEATURES_ARCH_X86_64
//    if( cap & HAS_SSE )
    printf(" sse");
    if( cap.in.avx )
      printf(" avx");
    if( cap.in.avx2 )
      printf(" avx2");
    if( cap.in.fma3 )
      printf(" fma");
#endif /* #ifdef CPU_FEATURES_ARCH_X86_64 */

#ifdef CPU_FEATURES_ARCH_PPC
    if( cap.altivec )
      printf(" altivec");
    if( cap.in.vsx )
{'fraction_non_alphanumeric': 0.11748329621380846, 'fraction_numerical': 0.028953229398663696, 'mean_word_length': 4.330860534124629, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2431796', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1439, 'n_words': 277}