14a49301eSmrg/**************************************************************************
24a49301eSmrg *
3af69d88dSmrg * Copyright 2008 VMware, Inc.
44a49301eSmrg * All Rights Reserved.
54a49301eSmrg *
64a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a
74a49301eSmrg * copy of this software and associated documentation files (the
84a49301eSmrg * "Software"), to deal in the Software without restriction, including
94a49301eSmrg * without limitation the rights to use, copy, modify, merge, publish,
104a49301eSmrg * distribute, sub license, and/or sell copies of the Software, and to
114a49301eSmrg * permit persons to whom the Software is furnished to do so, subject to
124a49301eSmrg * the following conditions:
134a49301eSmrg *
144a49301eSmrg * The above copyright notice and this permission notice (including the
154a49301eSmrg * next paragraph) shall be included in all copies or substantial portions
164a49301eSmrg * of the Software.
174a49301eSmrg *
184a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
194a49301eSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
204a49301eSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21af69d88dSmrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
224a49301eSmrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
234a49301eSmrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
244a49301eSmrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
254a49301eSmrg *
264a49301eSmrg **************************************************************************/
274a49301eSmrg
28af69d88dSmrg#include "pipe/p_config.h"
29af69d88dSmrg#include "rtasm_cpu.h"
30af69d88dSmrg
31af69d88dSmrg#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
324a49301eSmrg
334a49301eSmrg#include "util/u_debug.h"
34af69d88dSmrg#include "util/u_cpu_detect.h"
354a49301eSmrg
367ec681f3SmrgDEBUG_GET_ONCE_BOOL_OPTION(nosse, "GALLIUM_NOSSE", false);
374a49301eSmrg
387ec681f3Smrgstatic const struct util_cpu_caps_t *get_cpu_caps(void)
394a49301eSmrg{
40af69d88dSmrg   util_cpu_detect();
417ec681f3Smrg   return util_get_cpu_caps();
424a49301eSmrg}
434a49301eSmrg
444a49301eSmrgint rtasm_cpu_has_sse(void)
454a49301eSmrg{
46af69d88dSmrg   return !debug_get_option_nosse() && get_cpu_caps()->has_sse;
474a49301eSmrg}
484a49301eSmrg
494a49301eSmrgint rtasm_cpu_has_sse2(void)
504a49301eSmrg{
51af69d88dSmrg   return !debug_get_option_nosse() && get_cpu_caps()->has_sse2;
52af69d88dSmrg}
53af69d88dSmrg
54af69d88dSmrg
554a49301eSmrg#else
56af69d88dSmrg
57af69d88dSmrgint rtasm_cpu_has_sse(void)
58af69d88dSmrg{
594a49301eSmrg   return 0;
604a49301eSmrg}
61af69d88dSmrg
62af69d88dSmrgint rtasm_cpu_has_sse2(void)
63af69d88dSmrg{
64af69d88dSmrg   return 0;
65af69d88dSmrg}
66af69d88dSmrg
67af69d88dSmrg#endif
68