RetroArch/retroarch_info.c

93 lines
3.4 KiB
C
Raw Normal View History

2015-05-13 11:21:43 +00:00
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <retro_miscellaneous.h>
#include "performance.h"
#include "retroarch.h"
int rarch_info_get_capabilities(enum rarch_capabilities type, char *s, size_t len)
{
switch (type)
{
case RARCH_CAPABILITIES_CPU:
{
uint64_t cpu = rarch_get_cpu_features();
if (cpu & RETRO_SIMD_MMX)
strlcat(s, "MMX ", len);
if (cpu & RETRO_SIMD_MMXEXT)
strlcat(s, "MMXEXT ", len);
if (cpu & RETRO_SIMD_SSE)
strlcat(s, "SSE1 ", len);
if (cpu & RETRO_SIMD_SSE2)
strlcat(s, "SSE2 ", len);
if (cpu & RETRO_SIMD_SSE3)
strlcat(s, "SSE3 ", len);
if (cpu & RETRO_SIMD_SSSE3)
strlcat(s, "SSSE3 ", len);
if (cpu & RETRO_SIMD_SSE4)
strlcat(s, "SSE4 ", len);
if (cpu & RETRO_SIMD_SSE42)
strlcat(s, "SSE4.2 ", len);
if (cpu & RETRO_SIMD_AVX)
strlcat(s, "AVX ", len);
if (cpu & RETRO_SIMD_AVX2)
strlcat(s, "AVX2 ", len);
if (cpu & RETRO_SIMD_VFPU)
strlcat(s, "VFPU ", len);
if (cpu & RETRO_SIMD_NEON)
strlcat(s, "NEON ", len);
if (cpu & RETRO_SIMD_PS)
strlcat(s, "PS ", len);
if (cpu & RETRO_SIMD_AES)
strlcat(s, "AES ", len);
if (cpu & RETRO_SIMD_VMX)
strlcat(s, "VMX ", len);
if (cpu & RETRO_SIMD_VMX128)
strlcat(s, "VMX128 ", len);
}
break;
case RARCH_CAPABILITIES_COMPILER:
#if defined(_MSC_VER)
snprintf(s, len, "Compiler: MSVC (%d) %u-bit", _MSC_VER, (unsigned)
(CHAR_BIT * sizeof(size_t)));
#elif defined(__SNC__)
snprintf(s, len, "Compiler: SNC (%d) %u-bit",
__SN_VER__, (unsigned)(CHAR_BIT * sizeof(size_t)));
#elif defined(_WIN32) && defined(__GNUC__)
snprintf(s, len, "Compiler: MinGW (%d.%d.%d) %u-bit",
__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, (unsigned)
(CHAR_BIT * sizeof(size_t)));
#elif defined(__clang__)
snprintf(s, len, "Compiler: Clang/LLVM (%s) %u-bit",
__clang_version__, (unsigned)(CHAR_BIT * sizeof(size_t)));
#elif defined(__GNUC__)
snprintf(s, len, "Compiler: GCC (%d.%d.%d) %u-bit",
__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, (unsigned)
(CHAR_BIT * sizeof(size_t)));
#else
snprintf(s, len, "Unknown compiler %u-bit",
(unsigned)(CHAR_BIT * sizeof(size_t)));
#endif
break;
default:
case RARCH_CAPABILITIES_NONE:
break;
}
return 0;
}