<commit_before>/*********************************************************************
 * Copyright (C) 2005-2007 by <NAME>                        *
 * <EMAIL>                                                *
 *                                                                   *
 * This library is free software; you can redistribute it and/or     *
 * modify it under the terms of the GNU Library General Public       *
 * License as published by the Free Software Foundation;             *
 * version 2 of the License                                          *
 *                                                                   *
 * This library is distributed in the hope that it will be useful,   *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *
 * Library General Public License for more details.                  *
 *                                                                   *
 * You should have received a copy of the GNU Library General Public *
 * License along with this library; if not, write to the             *
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,      *
 * Boston, MA  02110-1301, USA.                                      *
 *********************************************************************/
#include <string.h>
#include <stdlib.h>
#include "x86_cpu_caps.h"

/* caps1 */
#define MMX_BIT             23
#define SSE_BIT             25
#define SSE2_BIT            26

/* caps2 */
#define SSE3_BIT             0
#define SSSE3_BIT            9

/* caps3 */
#define AMD_3DNOW_BIT       31
#define AMD_3DNOWEXT_BIT    30
#define AMD_SSE_MMX_BIT     22
#define CYRIX_MMXEXT_BIT    24


#ifdef HAVE_CPU_CAPS_DETECTION
#include "asm_support.h"

// derived from loki_cpuinfo.c, 1997-98 by <NAME> and <NAME>
// using infos from sandpile.org
static void cpu_caps_detect_x86(uint32_t *caps1, uint32_t *caps2, uint32_t *caps3)
{
    uint32_t c1, c2, c3;

#if __GNUC__
#define param1      %0
#define param2      %1
#define param3      %2

    asm volatile (
#else
#define param1 c1
#define param2 c2
#define param3 c3

  __asm {
#endif
        _push(_b)

        // standard CPUID
        _mov(_(0x1), _eax)
        _cpuid
        _mov(_edx, param1) //caps1 - MMX, SSE, SSE2
        _mov(_ecx, param2) //caps2 - SSE3

        // extended CPUID
        _mov(_(0x80000001), _eax)
        _cpuid
        _mov(_edx, param3) //caps3 - 3DNOW!, 3DNOW!EXT, CYRIX-MMXEXT, AMD-MMX-SSE

        _pop(_b)
#if __GNUC__
        :"=m"(c1), "=m"(c2), "=m"(c3)   /* output */
        :                               /* input */
        :"%eax", "%ecx", "%edx"         /* clobbered registers */
    );
#else
 }
#endif
<commit_msg>allow register to be used<commit_after>/*********************************************************************
 * Copyright (C) 2005-2007 by <NAME>                        *
 * <EMAIL>                                                *
 *                                                                   *
 * This library is free software; you can redistribute it and/or     *
 * modify it under the terms of the GNU Library General Public       *
 * License as published by the Free Software Foundation;             *
 * version 2 of the License                                          *
 *                                                                   *
 * This library is distributed in the hope that it will be useful,   *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *
 * Library General Public License for more details.                  *
 *                                                                   *
 * You should have received a copy of the GNU Library General Public *
 * License along with this library; if not, write to the             *
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,      *
 * Boston, MA  02110-1301, USA.                                      *
 *********************************************************************/
#include <string.h>
#include <stdlib.h>
#include "x86_cpu_caps.h"

/* caps1 */
#define MMX_BIT             23
#define SSE_BIT             25
#define SSE2_BIT            26

/* caps2 */
#define SSE3_BIT             0
#define SSSE3_BIT            9

/* caps3 */
#define AMD_3DNOW_BIT       31
#define AMD_3DNOWEXT_BIT    30
#define AMD_SSE_MMX_BIT     22
#define CYRIX_MMXEXT_BIT    24


#ifdef HAVE_CPU_CAPS_DETECTION
#include "asm_support.h"

// derived from loki_cpuinfo.c, 1997-98 by <NAME> and <NAME>
// using infos from sandpile.org
static void cpu_caps_detect_x86(uint32_t *caps1, uint32_t *caps2, uint32_t *caps3)
{
    uint32_t c1, c2, c3;

#if __GNUC__
#define param1      %0
#define param2      %1
#define param3      %2

    asm volatile (
#else
#define param1 c1
#define param2 c2
#define param3 c3

  __asm {
#endif
        _push(_b)

        // standard CPUID
        _mov(_(0x1), _eax)
        _cpuid
        _mov(_edx, param1) //caps1 - MMX, SSE, SSE2
        _mov(_ecx, param2) //caps2 - SSE3

        // extended CPUID
        _mov(_(0x80000001), _eax)
        _cpuid
        _mov(_edx, param3) //caps3 - 3DNOW!, 3DNOW!EXT, CYRIX-MMXEXT, AMD-MMX-SSE

        _pop(_b)
#if __GNUC__
        :"=rm"(c1), "=rm"(c2), "=rm"(c3)/* output */
        :                               /* input */
        :"%eax", "%ecx", "%edx"         /* clobbered registers */
    );
#else
 }
#endif

{'fraction_non_alphanumeric': 0.13502722323049002, 'fraction_numerical': 0.037749546279491834, 'mean_word_length': 1.6217887725975262, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1654386', 'n_tokens_mistral': 1700, 'n_tokens_neox': 1545, 'n_words': 498}