1bf215546Sopenharmony_ci 2bf215546Sopenharmony_ci/* 3bf215546Sopenharmony_ci * Mesa 3-D graphics library 4bf215546Sopenharmony_ci * 5bf215546Sopenharmony_ci * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. 6bf215546Sopenharmony_ci * 7bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 8bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 9bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 10bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 12bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be included 15bf215546Sopenharmony_ci * in all copies or substantial portions of the Software. 16bf215546Sopenharmony_ci * 17bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21bf215546Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22bf215546Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23bf215546Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 24bf215546Sopenharmony_ci */ 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci/* 27bf215546Sopenharmony_ci * x86 CPUID feature information. The raw data is returned by 28bf215546Sopenharmony_ci * _mesa_identify_x86_cpu_features() and interpreted with the cpu_has_* 29bf215546Sopenharmony_ci * helper macros. 30bf215546Sopenharmony_ci * 31bf215546Sopenharmony_ci * Gareth Hughes 32bf215546Sopenharmony_ci */ 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci#ifndef __COMMON_X86_FEATURES_H__ 35bf215546Sopenharmony_ci#define __COMMON_X86_FEATURES_H__ 36bf215546Sopenharmony_ci 37bf215546Sopenharmony_ci#define X86_FEATURE_FPU (1<<0) 38bf215546Sopenharmony_ci#define X86_FEATURE_CMOV (1<<1) 39bf215546Sopenharmony_ci#define X86_FEATURE_MMXEXT (1<<2) 40bf215546Sopenharmony_ci#define X86_FEATURE_MMX (1<<3) 41bf215546Sopenharmony_ci#define X86_FEATURE_FXSR (1<<4) 42bf215546Sopenharmony_ci#define X86_FEATURE_XMM (1<<5) 43bf215546Sopenharmony_ci#define X86_FEATURE_XMM2 (1<<6) 44bf215546Sopenharmony_ci#define X86_FEATURE_3DNOWEXT (1<<7) 45bf215546Sopenharmony_ci#define X86_FEATURE_3DNOW (1<<8) 46bf215546Sopenharmony_ci#define X86_FEATURE_SSE4_1 (1<<9) 47bf215546Sopenharmony_ci 48bf215546Sopenharmony_ci/* standard X86 CPU features */ 49bf215546Sopenharmony_ci#define X86_CPU_FPU (1<<0) 50bf215546Sopenharmony_ci#define X86_CPU_CMOV (1<<15) 51bf215546Sopenharmony_ci#define X86_CPU_MMX (1<<23) 52bf215546Sopenharmony_ci#define X86_CPU_XMM (1<<25) 53bf215546Sopenharmony_ci#define X86_CPU_XMM2 (1<<26) 54bf215546Sopenharmony_ci/* ECX. */ 55bf215546Sopenharmony_ci#define X86_CPU_SSE4_1 (1<<19) 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_ci/* extended X86 CPU features */ 58bf215546Sopenharmony_ci#define X86_CPUEXT_MMX_EXT (1<<22) 59bf215546Sopenharmony_ci#define X86_CPUEXT_3DNOW_EXT (1<<30) 60bf215546Sopenharmony_ci#define X86_CPUEXT_3DNOW (1<<31) 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_ci#ifdef __MMX__ 63bf215546Sopenharmony_ci#define cpu_has_mmx 1 64bf215546Sopenharmony_ci#else 65bf215546Sopenharmony_ci#define cpu_has_mmx (_mesa_x86_cpu_features & X86_FEATURE_MMX) 66bf215546Sopenharmony_ci#endif 67bf215546Sopenharmony_ci 68bf215546Sopenharmony_ci#define cpu_has_mmxext (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT) 69bf215546Sopenharmony_ci 70bf215546Sopenharmony_ci#if defined(__SSE__) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1)) || defined(_M_X64) 71bf215546Sopenharmony_ci#define cpu_has_xmm 1 72bf215546Sopenharmony_ci#else 73bf215546Sopenharmony_ci#define cpu_has_xmm (_mesa_x86_cpu_features & X86_FEATURE_XMM) 74bf215546Sopenharmony_ci#endif 75bf215546Sopenharmony_ci 76bf215546Sopenharmony_ci#if defined(__SSE2__) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(_M_X64) 77bf215546Sopenharmony_ci#define cpu_has_xmm2 1 78bf215546Sopenharmony_ci#else 79bf215546Sopenharmony_ci#define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2) 80bf215546Sopenharmony_ci#endif 81bf215546Sopenharmony_ci 82bf215546Sopenharmony_ci#ifdef __3dNOW__ 83bf215546Sopenharmony_ci#define cpu_has_3dnow 1 84bf215546Sopenharmony_ci#else 85bf215546Sopenharmony_ci#define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW) 86bf215546Sopenharmony_ci#endif 87bf215546Sopenharmony_ci 88bf215546Sopenharmony_ci#define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_ci#ifdef __SSE4_1__ 91bf215546Sopenharmony_ci#define cpu_has_sse4_1 1 92bf215546Sopenharmony_ci#else 93bf215546Sopenharmony_ci#define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1) 94bf215546Sopenharmony_ci#endif 95bf215546Sopenharmony_ci 96bf215546Sopenharmony_ci#endif 97bf215546Sopenharmony_ci 98