1848b8605Smrg/************************************************************************** 2848b8605Smrg * 3848b8605Smrg * Copyright 2008 VMware, Inc. 4848b8605Smrg * All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the 8848b8605Smrg * "Software"), to deal in the Software without restriction, including 9848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish, 10848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to 11848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to 12848b8605Smrg * the following conditions: 13848b8605Smrg * 14848b8605Smrg * The above copyright notice and this permission notice (including the 15848b8605Smrg * next paragraph) shall be included in all copies or substantial portions 16848b8605Smrg * of the Software. 17848b8605Smrg * 18848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21848b8605Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22848b8605Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24848b8605Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25848b8605Smrg * 26848b8605Smrg **************************************************************************/ 27848b8605Smrg 28848b8605Smrg#include "pipe/p_config.h" 29848b8605Smrg#include "rtasm_cpu.h" 30848b8605Smrg 31848b8605Smrg#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) 32848b8605Smrg 33848b8605Smrg#include "util/u_debug.h" 34848b8605Smrg#include "util/u_cpu_detect.h" 35848b8605Smrg 36848b8605SmrgDEBUG_GET_ONCE_BOOL_OPTION(nosse, "GALLIUM_NOSSE", FALSE); 37848b8605Smrg 38848b8605Smrgstatic struct util_cpu_caps *get_cpu_caps(void) 39848b8605Smrg{ 40848b8605Smrg util_cpu_detect(); 41848b8605Smrg return &util_cpu_caps; 42848b8605Smrg} 43848b8605Smrg 44848b8605Smrgint rtasm_cpu_has_sse(void) 45848b8605Smrg{ 46848b8605Smrg return !debug_get_option_nosse() && get_cpu_caps()->has_sse; 47848b8605Smrg} 48848b8605Smrg 49848b8605Smrgint rtasm_cpu_has_sse2(void) 50848b8605Smrg{ 51848b8605Smrg return !debug_get_option_nosse() && get_cpu_caps()->has_sse2; 52848b8605Smrg} 53848b8605Smrg 54848b8605Smrg 55848b8605Smrg#else 56848b8605Smrg 57848b8605Smrgint rtasm_cpu_has_sse(void) 58848b8605Smrg{ 59848b8605Smrg return 0; 60848b8605Smrg} 61848b8605Smrg 62848b8605Smrgint rtasm_cpu_has_sse2(void) 63848b8605Smrg{ 64848b8605Smrg return 0; 65848b8605Smrg} 66848b8605Smrg 67848b8605Smrg#endif 68