Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 1 | /* libFLAC - Free Lossless Audio Codec library |
Erik de Castro Lopo | b1982fb | 2013-05-25 17:11:19 +1000 | [diff] [blame] | 2 | * Copyright (C) 2001-2009 Josh Coalson |
Erik de Castro Lopo | 1437391 | 2014-11-24 22:07:15 +1100 | [diff] [blame] | 3 | * Copyright (C) 2011-2014 Xiph.Org Foundation |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 4 | * |
Josh Coalson | afd8107 | 2003-01-31 23:34:56 +0000 | [diff] [blame] | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 8 | * |
Josh Coalson | afd8107 | 2003-01-31 23:34:56 +0000 | [diff] [blame] | 9 | * - Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 11 | * |
Josh Coalson | afd8107 | 2003-01-31 23:34:56 +0000 | [diff] [blame] | 12 | * - Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * |
| 16 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 31 | */ |
| 32 | |
Erik de Castro Lopo | 006b835 | 2014-03-23 21:59:46 +1100 | [diff] [blame] | 33 | #ifdef HAVE_CONFIG_H |
Josh Coalson | b1ec796 | 2006-05-24 04:41:36 +0000 | [diff] [blame] | 34 | # include <config.h> |
| 35 | #endif |
| 36 | |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 37 | #include "private/cpu.h" |
Erik de Castro Lopo | a08e90c | 2016-06-26 21:09:08 +1000 | [diff] [blame] | 38 | #include "share/compat.h" |
Josh Coalson | 663c599 | 2005-01-21 01:53:02 +0000 | [diff] [blame] | 39 | #include <stdlib.h> |
Erik de Castro Lopo | 35c14b1 | 2014-10-04 09:05:08 +1000 | [diff] [blame] | 40 | #include <memory.h> |
Erik de Castro Lopo | 23778a3 | 2016-06-25 17:02:06 +1000 | [diff] [blame] | 41 | |
Erik de Castro Lopo | 23778a3 | 2016-06-25 17:02:06 +1000 | [diff] [blame] | 42 | #if defined (__NetBSD__) || defined(__OpenBSD__) |
| 43 | # include <sys/param.h> |
| 44 | # include <sys/sysctl.h> |
| 45 | # include <machine/cpu.h> |
| 46 | #endif |
| 47 | |
| 48 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__) |
| 49 | # include <sys/types.h> |
| 50 | # include <sys/sysctl.h> |
| 51 | #endif |
| 52 | |
| 53 | #if defined(__linux__) && defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && (defined FLAC__HAS_NASM || FLAC__HAS_X86INTRIN) && !FLAC__SSE_OS |
| 54 | # include <sys/ucontext.h> |
| 55 | #endif |
| 56 | |
| 57 | #if defined(_MSC_VER) |
| 58 | # include <windows.h> |
| 59 | # include <intrin.h> /* for __cpuid() and _xgetbv() */ |
| 60 | #endif |
| 61 | |
| 62 | #if defined __GNUC__ && defined HAVE_CPUID_H |
| 63 | # include <cpuid.h> /* for __get_cpuid() and __get_cpuid_max() */ |
Erik de Castro Lopo | 35c14b1 | 2014-10-04 09:05:08 +1000 | [diff] [blame] | 64 | #endif |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 65 | |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 66 | #ifdef DEBUG |
Julian Calaby | 828e33b | 2016-06-27 22:10:47 +1000 | [diff] [blame] | 67 | #include <stdio.h> |
| 68 | |
Julian Calaby | 601c051 | 2016-06-27 22:08:51 +1000 | [diff] [blame] | 69 | #define dfprintf fprintf |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 70 | #else |
Julian Calaby | 601c051 | 2016-06-27 22:08:51 +1000 | [diff] [blame] | 71 | /* This is bad practice, it should be a static void empty function */ |
| 72 | #define dfprintf(file, format, args...) |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 73 | #endif |
| 74 | |
| 75 | |
Josh Coalson | f2f328b | 2007-03-13 06:35:55 +0000 | [diff] [blame] | 76 | /* these are flags in EDX of CPUID AX=00000001 */ |
| 77 | static const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000; |
| 78 | static const unsigned FLAC__CPUINFO_IA32_CPUID_MMX = 0x00800000; |
| 79 | static const unsigned FLAC__CPUINFO_IA32_CPUID_FXSR = 0x01000000; |
| 80 | static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE = 0x02000000; |
| 81 | static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000; |
Erik de Castro Lopo | 35c14b1 | 2014-10-04 09:05:08 +1000 | [diff] [blame] | 82 | |
Josh Coalson | f2f328b | 2007-03-13 06:35:55 +0000 | [diff] [blame] | 83 | /* these are flags in ECX of CPUID AX=00000001 */ |
| 84 | static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE3 = 0x00000001; |
| 85 | static const unsigned FLAC__CPUINFO_IA32_CPUID_SSSE3 = 0x00000200; |
Erik de Castro Lopo | 8fe2c23 | 2013-09-25 23:05:13 +1000 | [diff] [blame] | 86 | static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE41 = 0x00080000; |
| 87 | static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE42 = 0x00100000; |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 88 | |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 89 | /* these are flags in ECX of CPUID AX=00000001 */ |
| 90 | static const unsigned FLAC__CPUINFO_IA32_CPUID_OSXSAVE = 0x08000000; |
| 91 | static const unsigned FLAC__CPUINFO_IA32_CPUID_AVX = 0x10000000; |
| 92 | static const unsigned FLAC__CPUINFO_IA32_CPUID_FMA = 0x00001000; |
| 93 | /* these are flags in EBX of CPUID AX=00000007 */ |
| 94 | static const unsigned FLAC__CPUINFO_IA32_CPUID_AVX2 = 0x00000020; |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 95 | |
Josh Coalson | 83f42e3 | 2007-03-03 01:52:19 +0000 | [diff] [blame] | 96 | /* |
| 97 | * Extra stuff needed for detection of OS support for SSE on IA-32 |
| 98 | */ |
Erik de Castro Lopo | 23778a3 | 2016-06-25 17:02:06 +1000 | [diff] [blame] | 99 | #if defined(__linux__) && defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && (defined FLAC__HAS_NASM || FLAC__HAS_X86INTRIN) && !FLAC__SSE_OS |
Josh Coalson | 83f42e3 | 2007-03-03 01:52:19 +0000 | [diff] [blame] | 100 | /* |
| 101 | * If the OS doesn't support SSE, we will get here with a SIGILL. We |
| 102 | * modify the return address to jump over the offending SSE instruction |
| 103 | * and also the operation following it that indicates the instruction |
| 104 | * executed successfully. In this way we use no global variables and |
| 105 | * stay thread-safe. |
| 106 | * |
| 107 | * 3 + 3 + 6: |
| 108 | * 3 bytes for "xorps xmm0,xmm0" |
| 109 | * 3 bytes for estimate of how long the follwing "inc var" instruction is |
| 110 | * 6 bytes extra in case our estimate is wrong |
| 111 | * 12 bytes puts us in the NOP "landing zone" |
| 112 | */ |
Erik de Castro Lopo | 23778a3 | 2016-06-25 17:02:06 +1000 | [diff] [blame] | 113 | static void sigill_handler_sse_os(int signal, siginfo_t *si, void *uc) |
| 114 | { |
| 115 | (void)signal, (void)si; |
| 116 | ((ucontext_t*)uc)->uc_mcontext.gregs[14/*REG_EIP*/] += 3 + 3 + 6; |
| 117 | } |
Josh Coalson | 83f42e3 | 2007-03-03 01:52:19 +0000 | [diff] [blame] | 118 | #endif |
| 119 | |
Erik de Castro Lopo | 85c902f | 2016-06-27 05:09:07 +1000 | [diff] [blame] | 120 | #if defined FLAC__CPU_IA32 |
Erik de Castro Lopo | 162a449 | 2016-06-26 17:28:27 +1000 | [diff] [blame] | 121 | static void |
| 122 | ia32_disable_sse(FLAC__CPUInfo *info) |
| 123 | { |
| 124 | info->ia32.sse = false; |
| 125 | info->ia32.sse2 = false; |
| 126 | info->ia32.sse3 = false; |
| 127 | info->ia32.ssse3 = false; |
| 128 | info->ia32.sse41 = false; |
| 129 | info->ia32.sse42 = false; |
| 130 | } |
| 131 | |
| 132 | static void |
| 133 | ia32_disable_avx(FLAC__CPUInfo *info) |
| 134 | { |
| 135 | info->ia32.avx = false; |
| 136 | info->ia32.avx2 = false; |
| 137 | info->ia32.fma = false; |
| 138 | } |
Erik de Castro Lopo | 85c902f | 2016-06-27 05:09:07 +1000 | [diff] [blame] | 139 | #endif |
Erik de Castro Lopo | 162a449 | 2016-06-26 17:28:27 +1000 | [diff] [blame] | 140 | |
Erik de Castro Lopo | 85c902f | 2016-06-27 05:09:07 +1000 | [diff] [blame] | 141 | #if defined FLAC__CPU_X86_64 |
Erik de Castro Lopo | 162a449 | 2016-06-26 17:28:27 +1000 | [diff] [blame] | 142 | static void |
| 143 | x86_64_disable_avx(FLAC__CPUInfo *info) |
| 144 | { |
| 145 | info->x86.avx = false; |
| 146 | info->x86.avx2 = false; |
| 147 | info->x86.fma = false; |
| 148 | } |
Erik de Castro Lopo | 85c902f | 2016-06-27 05:09:07 +1000 | [diff] [blame] | 149 | #endif |
Erik de Castro Lopo | 162a449 | 2016-06-26 17:28:27 +1000 | [diff] [blame] | 150 | |
Erik de Castro Lopo | 85c902f | 2016-06-27 05:09:07 +1000 | [diff] [blame] | 151 | #if defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64 |
Erik de Castro Lopo | 162a449 | 2016-06-26 17:28:27 +1000 | [diff] [blame] | 152 | static uint32_t |
| 153 | cpu_xgetbv_x86(void) |
Erik de Castro Lopo | fa24613 | 2016-06-26 10:39:18 +1000 | [diff] [blame] | 154 | { |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 155 | #if (defined _MSC_VER || defined __INTEL_COMPILER) && FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED |
Erik de Castro Lopo | fa24613 | 2016-06-26 10:39:18 +1000 | [diff] [blame] | 156 | return (uint32_t)_xgetbv(0); |
| 157 | #elif defined __GNUC__ |
| 158 | uint32_t lo, hi; |
| 159 | asm volatile (".byte 0x0f, 0x01, 0xd0" : "=a"(lo), "=d"(hi) : "c" (0)); |
| 160 | return lo; |
| 161 | #else |
| 162 | return 0; |
| 163 | #endif |
| 164 | } |
Erik de Castro Lopo | 162a449 | 2016-06-26 17:28:27 +1000 | [diff] [blame] | 165 | #endif |
Josh Coalson | 83f42e3 | 2007-03-03 01:52:19 +0000 | [diff] [blame] | 166 | |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 167 | static void |
| 168 | ia32_cpu_info (FLAC__CPUInfo *info) |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 169 | { |
Erik de Castro Lopo | 85c902f | 2016-06-27 05:09:07 +1000 | [diff] [blame] | 170 | #if !defined FLAC__CPU_IA32 |
Erik de Castro Lopo | 162a449 | 2016-06-26 17:28:27 +1000 | [diff] [blame] | 171 | (void) info; |
Julian Calaby | 078c631 | 2016-06-27 22:13:30 +1000 | [diff] [blame] | 172 | #elif defined(__ANDROID__) || defined(ANDROID) |
| 173 | /* no need to check OS SSE support */ |
| 174 | info->use_asm = true; |
Erik de Castro Lopo | 162a449 | 2016-06-26 17:28:27 +1000 | [diff] [blame] | 175 | #else |
Erik de Castro Lopo | 35c14b1 | 2014-10-04 09:05:08 +1000 | [diff] [blame] | 176 | FLAC__bool ia32_fxsr = false; |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 177 | FLAC__bool ia32_osxsave = false; |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 178 | FLAC__uint32 flags_eax, flags_ebx, flags_ecx, flags_edx; |
| 179 | |
Erik de Castro Lopo | 36a0ab1 | 2016-06-20 20:29:59 +1000 | [diff] [blame] | 180 | #if !defined FLAC__NO_ASM && (defined FLAC__HAS_NASM || FLAC__HAS_X86INTRIN) |
Josh Coalson | f2f328b | 2007-03-13 06:35:55 +0000 | [diff] [blame] | 181 | info->use_asm = true; /* we assume a minimum of 80386 with FLAC__CPU_IA32 */ |
Erik de Castro Lopo | fa24613 | 2016-06-26 10:39:18 +1000 | [diff] [blame] | 182 | #if !FLAC__HAS_X86INTRIN |
Erik de Castro Lopo | 35c14b1 | 2014-10-04 09:05:08 +1000 | [diff] [blame] | 183 | if(!FLAC__cpu_have_cpuid_asm_ia32()) |
| 184 | return; |
| 185 | #endif |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 186 | /* http://www.sandpile.org/x86/cpuid.htm */ |
| 187 | if (FLAC__HAS_X86INTRIN) { |
| 188 | FLAC__cpu_info_x86(0, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); |
| 189 | info->ia32.intel = (flags_ebx == 0x756E6547 && flags_edx == 0x49656E69 && flags_ecx == 0x6C65746E) ? true : false; /* GenuineIntel */ |
| 190 | FLAC__cpu_info_x86(1, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); |
| 191 | } |
| 192 | else { |
| 193 | FLAC__cpu_info_asm_ia32(&flags_edx, &flags_ecx); |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 194 | } |
Erik de Castro Lopo | 35c14b1 | 2014-10-04 09:05:08 +1000 | [diff] [blame] | 195 | |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 196 | info->ia32.cmov = (flags_edx & FLAC__CPUINFO_IA32_CPUID_CMOV ) ? true : false; |
| 197 | info->ia32.mmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_MMX ) ? true : false; |
| 198 | ia32_fxsr = (flags_edx & FLAC__CPUINFO_IA32_CPUID_FXSR ) ? true : false; |
| 199 | info->ia32.sse = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE ) ? true : false; |
| 200 | info->ia32.sse2 = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE2 ) ? true : false; |
| 201 | info->ia32.sse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE3 ) ? true : false; |
| 202 | info->ia32.ssse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSSE3) ? true : false; |
| 203 | info->ia32.sse41 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE41) ? true : false; |
| 204 | info->ia32.sse42 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE42) ? true : false; |
| 205 | |
Erik de Castro Lopo | 936e968 | 2016-06-26 11:32:06 +1000 | [diff] [blame] | 206 | if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED) { |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 207 | ia32_osxsave = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_OSXSAVE) ? true : false; |
| 208 | info->ia32.avx = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_AVX ) ? true : false; |
| 209 | info->ia32.fma = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_FMA ) ? true : false; |
| 210 | FLAC__cpu_info_x86(7, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); |
| 211 | info->ia32.avx2 = (flags_ebx & FLAC__CPUINFO_IA32_CPUID_AVX2 ) ? true : false; |
Erik de Castro Lopo | 936e968 | 2016-06-26 11:32:06 +1000 | [diff] [blame] | 212 | } |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 213 | |
Julian Calaby | 601c051 | 2016-06-27 22:08:51 +1000 | [diff] [blame] | 214 | dfprintf(stderr, "CPU info (IA-32):\n"); |
| 215 | dfprintf(stderr, " CMOV ....... %c\n", info->ia32.cmov ? 'Y' : 'n'); |
| 216 | dfprintf(stderr, " MMX ........ %c\n", info->ia32.mmx ? 'Y' : 'n'); |
| 217 | dfprintf(stderr, " SSE ........ %c\n", info->ia32.sse ? 'Y' : 'n'); |
| 218 | dfprintf(stderr, " SSE2 ....... %c\n", info->ia32.sse2 ? 'Y' : 'n'); |
| 219 | dfprintf(stderr, " SSE3 ....... %c\n", info->ia32.sse3 ? 'Y' : 'n'); |
| 220 | dfprintf(stderr, " SSSE3 ...... %c\n", info->ia32.ssse3 ? 'Y' : 'n'); |
| 221 | dfprintf(stderr, " SSE41 ...... %c\n", info->ia32.sse41 ? 'Y' : 'n'); |
| 222 | dfprintf(stderr, " SSE42 ...... %c\n", info->ia32.sse42 ? 'Y' : 'n'); |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 223 | |
Julian Calaby | 601c051 | 2016-06-27 22:08:51 +1000 | [diff] [blame] | 224 | if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED) { |
| 225 | dfprintf(stderr, " AVX ........ %c\n", info->ia32.avx ? 'Y' : 'n'); |
| 226 | dfprintf(stderr, " FMA ........ %c\n", info->ia32.fma ? 'Y' : 'n'); |
| 227 | dfprintf(stderr, " AVX2 ....... %c\n", info->ia32.avx2 ? 'Y' : 'n'); |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 228 | } |
Josh Coalson | f2f328b | 2007-03-13 06:35:55 +0000 | [diff] [blame] | 229 | |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 230 | /* |
| 231 | * now have to check for OS support of SSE instructions |
| 232 | */ |
| 233 | if(info->ia32.sse) { |
Erik de Castro Lopo | 23778a3 | 2016-06-25 17:02:06 +1000 | [diff] [blame] | 234 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__) |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 235 | int sse = 0; |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 236 | size_t len = sizeof(sse); |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 237 | /* at least one of these must work: */ |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 238 | sse = sse || (sysctlbyname("hw.instruction_sse", &sse, &len, NULL, 0) == 0 && sse); |
| 239 | sse = sse || (sysctlbyname("hw.optional.sse" , &sse, &len, NULL, 0) == 0 && sse); /* __APPLE__ ? */ |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 240 | if(!sse) |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 241 | ia32_disable_sse(info); |
Josh Coalson | 83f42e3 | 2007-03-03 01:52:19 +0000 | [diff] [blame] | 242 | #elif defined(__NetBSD__) || defined (__OpenBSD__) |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 243 | int val = 0, mib[2] = { CTL_MACHDEP, CPU_SSE }; |
| 244 | size_t len = sizeof(val); |
| 245 | if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val) |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 246 | ia32_disable_sse(info); |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 247 | else { /* double-check SSE2 */ |
| 248 | mib[1] = CPU_SSE2; |
| 249 | len = sizeof(val); |
| 250 | if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val) { |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 251 | ia32_disable_sse(info); |
Erik de Castro Lopo | 35c14b1 | 2014-10-04 09:05:08 +1000 | [diff] [blame] | 252 | info->ia32.sse = true; |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 253 | } |
| 254 | } |
Erik de Castro Lopo | e120037 | 2016-06-19 21:51:31 +1000 | [diff] [blame] | 255 | #elif defined(__linux__) && !FLAC__SSE_OS |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 256 | int sse = 0; |
| 257 | struct sigaction sigill_save; |
| 258 | struct sigaction sigill_sse; |
| 259 | sigill_sse.sa_sigaction = sigill_handler_sse_os; |
Erik de Castro Lopo | a9f8442 | 2016-03-14 18:14:31 +1100 | [diff] [blame] | 260 | sigemptyset(&sigill_sse.sa_mask); |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 261 | sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */ |
| 262 | if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save)) |
| 263 | { |
| 264 | /* http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html */ |
| 265 | /* see sigill_handler_sse_os() for an explanation of the following: */ |
| 266 | asm volatile ( |
| 267 | "xorps %%xmm0,%%xmm0\n\t" /* will cause SIGILL if unsupported by OS */ |
| 268 | "incl %0\n\t" /* SIGILL handler will jump over this */ |
| 269 | /* landing zone */ |
| 270 | "nop\n\t" /* SIGILL jump lands here if "inc" is 9 bytes */ |
| 271 | "nop\n\t" |
| 272 | "nop\n\t" |
| 273 | "nop\n\t" |
| 274 | "nop\n\t" |
| 275 | "nop\n\t" |
| 276 | "nop\n\t" /* SIGILL jump lands here if "inc" is 3 bytes (expected) */ |
| 277 | "nop\n\t" |
| 278 | "nop" /* SIGILL jump lands here if "inc" is 1 byte */ |
| 279 | : "=r"(sse) |
| 280 | : "0"(sse) |
| 281 | ); |
Josh Coalson | 83f42e3 | 2007-03-03 01:52:19 +0000 | [diff] [blame] | 282 | |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 283 | sigaction(SIGILL, &sigill_save, NULL); |
| 284 | } |
Josh Coalson | 83f42e3 | 2007-03-03 01:52:19 +0000 | [diff] [blame] | 285 | |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 286 | if(!sse) |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 287 | ia32_disable_sse(info); |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 288 | #elif defined(_MSC_VER) |
| 289 | __try { |
| 290 | __asm { |
| 291 | xorps xmm0,xmm0 |
| 292 | } |
| 293 | } |
| 294 | __except(EXCEPTION_EXECUTE_HANDLER) { |
| 295 | if (_exception_code() == STATUS_ILLEGAL_INSTRUCTION) |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 296 | ia32_disable_sse(info); |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 297 | } |
| 298 | #elif defined(__GNUC__) /* MinGW goes here */ |
| 299 | int sse = 0; |
| 300 | /* Based on the idea described in Agner Fog's manual "Optimizing subroutines in assembly language" */ |
| 301 | /* In theory, not guaranteed to detect lack of OS SSE support on some future Intel CPUs, but in practice works (see the aforementioned manual) */ |
Erik de Castro Lopo | 35c14b1 | 2014-10-04 09:05:08 +1000 | [diff] [blame] | 302 | if (ia32_fxsr) { |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 303 | struct { |
| 304 | FLAC__uint32 buff[128]; |
| 305 | } __attribute__((aligned(16))) fxsr; |
| 306 | FLAC__uint32 old_val, new_val; |
| 307 | |
Erik de Castro Lopo | 8d43282 | 2015-10-13 20:20:29 +1100 | [diff] [blame] | 308 | memset(fxsr.buff, 0, sizeof (fxsr.buff)); |
| 309 | |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 310 | asm volatile ("fxsave %0" : "=m" (fxsr) : "m" (fxsr)); |
| 311 | old_val = fxsr.buff[50]; |
| 312 | fxsr.buff[50] ^= 0x0013c0de; /* change value in the buffer */ |
| 313 | asm volatile ("fxrstor %0" : "=m" (fxsr) : "m" (fxsr)); /* try to change SSE register */ |
| 314 | fxsr.buff[50] = old_val; /* restore old value in the buffer */ |
Erik de Castro Lopo | 6ec64d3 | 2015-11-18 18:59:26 +1100 | [diff] [blame] | 315 | asm volatile ("fxsave %0" : "=m" (fxsr) : "m" (fxsr)); /* old value will be overwritten if SSE register was changed */ |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 316 | new_val = fxsr.buff[50]; /* == old_val if FXRSTOR didn't change SSE register and (old_val ^ 0x0013c0de) otherwise */ |
| 317 | fxsr.buff[50] = old_val; /* again restore old value in the buffer */ |
| 318 | asm volatile ("fxrstor %0" : "=m" (fxsr) : "m" (fxsr)); /* restore old values of registers */ |
| 319 | |
| 320 | if ((old_val^new_val) == 0x0013c0de) |
| 321 | sse = 1; |
| 322 | } |
| 323 | if(!sse) |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 324 | ia32_disable_sse(info); |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 325 | #else |
| 326 | /* no way to test, disable to be safe */ |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 327 | ia32_disable_sse(info); |
Josh Coalson | 83f42e3 | 2007-03-03 01:52:19 +0000 | [diff] [blame] | 328 | #endif |
Julian Calaby | 601c051 | 2016-06-27 22:08:51 +1000 | [diff] [blame] | 329 | dfprintf(stderr, " SSE OS sup . %c\n", info->ia32.sse ? 'Y' : 'n'); |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 330 | } |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 331 | else /* info->ia32.sse == false */ |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 332 | ia32_disable_sse(info); |
Erik de Castro Lopo | cf732a8 | 2014-09-24 06:41:56 +1000 | [diff] [blame] | 333 | |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 334 | /* |
| 335 | * now have to check for OS support of AVX instructions |
| 336 | */ |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 337 | if (FLAC__HAS_X86INTRIN && info->ia32.avx && ia32_osxsave) { |
Erik de Castro Lopo | fa24613 | 2016-06-26 10:39:18 +1000 | [diff] [blame] | 338 | FLAC__uint32 ecr = cpu_xgetbv_x86(); |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 339 | if ((ecr & 0x6) != 0x6) |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 340 | ia32_disable_avx(info); |
Julian Calaby | 601c051 | 2016-06-27 22:08:51 +1000 | [diff] [blame] | 341 | |
| 342 | dfprintf(stderr, " AVX OS sup . %c\n", info->ia32.avx ? 'Y' : 'n'); |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 343 | } |
Erik de Castro Lopo | 6ec64d3 | 2015-11-18 18:59:26 +1100 | [diff] [blame] | 344 | else /* no OS AVX support */ |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 345 | ia32_disable_avx(info); |
| 346 | |
Erik de Castro Lopo | 826b64f | 2015-11-07 07:06:23 +1100 | [diff] [blame] | 347 | #else |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 348 | info->use_asm = false; |
| 349 | #endif |
Erik de Castro Lopo | 162a449 | 2016-06-26 17:28:27 +1000 | [diff] [blame] | 350 | #endif |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 351 | } |
Josh Coalson | 83f42e3 | 2007-03-03 01:52:19 +0000 | [diff] [blame] | 352 | |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 353 | static void |
| 354 | x86_64_cpu_info (FLAC__CPUInfo *info) |
| 355 | { |
Erik de Castro Lopo | 85c902f | 2016-06-27 05:09:07 +1000 | [diff] [blame] | 356 | #if !defined FLAC__CPU_X86_64 |
Erik de Castro Lopo | 162a449 | 2016-06-26 17:28:27 +1000 | [diff] [blame] | 357 | (void) info; |
Julian Calaby | 078c631 | 2016-06-27 22:13:30 +1000 | [diff] [blame] | 358 | #elif defined(__ANDROID__) || defined(ANDROID) |
| 359 | /* no need to check OS SSE support */ |
| 360 | info->use_asm = true; |
Julian Calaby | e58a6e7 | 2016-06-27 22:17:03 +1000 | [diff] [blame] | 361 | #elif !defined FLAC__NO_ASM && FLAC__HAS_X86INTRIN |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 362 | FLAC__bool x86_osxsave = false; |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 363 | FLAC__uint32 flags_eax, flags_ebx, flags_ecx, flags_edx; |
| 364 | |
Erik de Castro Lopo | 84c3e3d | 2013-09-15 09:46:17 +1000 | [diff] [blame] | 365 | info->use_asm = true; |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 366 | |
| 367 | /* http://www.sandpile.org/x86/cpuid.htm */ |
| 368 | FLAC__cpu_info_x86(0, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); |
| 369 | info->x86.intel = (flags_ebx == 0x756E6547 && flags_edx == 0x49656E69 && flags_ecx == 0x6C65746E) ? true : false; /* GenuineIntel */ |
| 370 | FLAC__cpu_info_x86(1, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); |
| 371 | info->x86.sse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE3 ) ? true : false; |
| 372 | info->x86.ssse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSSE3) ? true : false; |
| 373 | info->x86.sse41 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE41) ? true : false; |
| 374 | info->x86.sse42 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE42) ? true : false; |
| 375 | |
| 376 | if (FLAC__AVX_SUPPORTED) { |
| 377 | x86_osxsave = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_OSXSAVE) ? true : false; |
| 378 | info->x86.avx = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_AVX ) ? true : false; |
| 379 | info->x86.fma = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_FMA ) ? true : false; |
| 380 | FLAC__cpu_info_x86(7, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); |
| 381 | info->x86.avx2 = (flags_ebx & FLAC__CPUINFO_IA32_CPUID_AVX2 ) ? true : false; |
| 382 | } |
| 383 | |
Julian Calaby | 601c051 | 2016-06-27 22:08:51 +1000 | [diff] [blame] | 384 | dfprintf(stderr, "CPU info (x86-64):\n"); |
| 385 | dfprintf(stderr, " SSE3 ....... %c\n", info->x86.sse3 ? 'Y' : 'n'); |
| 386 | dfprintf(stderr, " SSSE3 ...... %c\n", info->x86.ssse3 ? 'Y' : 'n'); |
| 387 | dfprintf(stderr, " SSE41 ...... %c\n", info->x86.sse41 ? 'Y' : 'n'); |
| 388 | dfprintf(stderr, " SSE42 ...... %c\n", info->x86.sse42 ? 'Y' : 'n'); |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 389 | |
Julian Calaby | 601c051 | 2016-06-27 22:08:51 +1000 | [diff] [blame] | 390 | if (FLAC__AVX_SUPPORTED) { |
| 391 | dfprintf(stderr, " AVX ........ %c\n", info->x86.avx ? 'Y' : 'n'); |
| 392 | dfprintf(stderr, " FMA ........ %c\n", info->x86.fma ? 'Y' : 'n'); |
| 393 | dfprintf(stderr, " AVX2 ....... %c\n", info->x86.avx2 ? 'Y' : 'n'); |
Erik de Castro Lopo | 84c3e3d | 2013-09-15 09:46:17 +1000 | [diff] [blame] | 394 | } |
Erik de Castro Lopo | 84c3e3d | 2013-09-15 09:46:17 +1000 | [diff] [blame] | 395 | |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 396 | /* |
| 397 | * now have to check for OS support of AVX instructions |
| 398 | */ |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 399 | if (info->x86.avx && x86_osxsave) { |
Erik de Castro Lopo | fa24613 | 2016-06-26 10:39:18 +1000 | [diff] [blame] | 400 | FLAC__uint32 ecr = cpu_xgetbv_x86(); |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 401 | if ((ecr & 0x6) != 0x6) |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 402 | x86_64_disable_avx(info); |
Julian Calaby | 601c051 | 2016-06-27 22:08:51 +1000 | [diff] [blame] | 403 | |
| 404 | dfprintf(stderr, " AVX OS sup . %c\n", info->x86.avx ? 'Y' : 'n'); |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 405 | } |
Erik de Castro Lopo | 6ec64d3 | 2015-11-18 18:59:26 +1100 | [diff] [blame] | 406 | else /* no OS AVX support */ |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 407 | x86_64_disable_avx(info); |
Erik de Castro Lopo | 84c3e3d | 2013-09-15 09:46:17 +1000 | [diff] [blame] | 408 | #endif |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 409 | } |
Erik de Castro Lopo | 84c3e3d | 2013-09-15 09:46:17 +1000 | [diff] [blame] | 410 | |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 411 | void FLAC__cpu_info (FLAC__CPUInfo *info) |
| 412 | { |
| 413 | memset(info, 0, sizeof(*info)); |
| 414 | |
| 415 | #ifdef FLAC__CPU_IA32 |
| 416 | info->type = FLAC__CPUINFO_TYPE_IA32; |
| 417 | #elif defined FLAC__CPU_X86_64 |
| 418 | info->type = FLAC__CPUINFO_TYPE_X86_64; |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 419 | #else |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 420 | info->type = FLAC__CPUINFO_TYPE_UNKNOWN; |
| 421 | info->use_asm = false; |
| 422 | #endif |
Erik de Castro Lopo | 7a8f359 | 2016-06-26 12:59:11 +1000 | [diff] [blame] | 423 | |
| 424 | switch (info->type) { |
| 425 | case FLAC__CPUINFO_TYPE_IA32: |
| 426 | ia32_cpu_info (info); |
| 427 | break; |
| 428 | case FLAC__CPUINFO_TYPE_X86_64: |
| 429 | x86_64_cpu_info (info); |
| 430 | break; |
| 431 | default: |
| 432 | info->use_asm = false; |
| 433 | break; |
| 434 | } |
Josh Coalson | edade2c | 2001-05-23 20:53:31 +0000 | [diff] [blame] | 435 | } |
Erik de Castro Lopo | 84c3e3d | 2013-09-15 09:46:17 +1000 | [diff] [blame] | 436 | |
Erik de Castro Lopo | 36a0ab1 | 2016-06-20 20:29:59 +1000 | [diff] [blame] | 437 | #if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN |
Erik de Castro Lopo | 84c3e3d | 2013-09-15 09:46:17 +1000 | [diff] [blame] | 438 | |
Erik de Castro Lopo | a08e90c | 2016-06-26 21:09:08 +1000 | [diff] [blame] | 439 | #if defined _MSC_VER || defined __INTEL_COMPILER |
| 440 | static inline void |
| 441 | cpu_id_ex (int *cpuinfo, int result) |
| 442 | { |
| 443 | // Stupid MSVC doesn't know how to optimise out: |
| 444 | // if (FLAC_AVC_SUPPORTER) |
| 445 | // __cpuidex(cpuinfo, level, 0); /* for AVX2 detection */ |
| 446 | #if FLAC__AVX_SUPPORTED |
| 447 | __cpuidex(cpuinfo, result, 0); /* for AVX2 detection */ |
| 448 | #else |
| 449 | __cpuid(cpuinfo, result); /* some old compilers don't support __cpuidex */ |
| 450 | #endif |
| 451 | } |
| 452 | #endif |
| 453 | |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 454 | void FLAC__cpu_info_x86(FLAC__uint32 level, FLAC__uint32 *eax, FLAC__uint32 *ebx, FLAC__uint32 *ecx, FLAC__uint32 *edx) |
Erik de Castro Lopo | 84c3e3d | 2013-09-15 09:46:17 +1000 | [diff] [blame] | 455 | { |
Erik de Castro Lopo | 57297ee | 2014-01-30 21:53:37 +1100 | [diff] [blame] | 456 | #if defined _MSC_VER || defined __INTEL_COMPILER |
Erik de Castro Lopo | 8fe2c23 | 2013-09-25 23:05:13 +1000 | [diff] [blame] | 457 | int cpuinfo[4]; |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 458 | int ext = level & 0x80000000; |
| 459 | __cpuid(cpuinfo, ext); |
Julian Calaby | 79ca23e | 2016-06-27 22:37:45 +1000 | [diff] [blame^] | 460 | if((unsigned)cpuinfo[0] >= level) { |
| 461 | cpu_id_ex (cpuinfo, ext); |
| 462 | |
| 463 | *eax = cpuinfo[0]; *ebx = cpuinfo[1]; *ecx = cpuinfo[2]; *edx = cpuinfo[3]; |
| 464 | |
Erik de Castro Lopo | 2c15052 | 2014-06-28 21:50:09 +1000 | [diff] [blame] | 465 | return; |
| 466 | } |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 467 | #elif defined __GNUC__ && defined HAVE_CPUID_H |
| 468 | FLAC__uint32 ext = level & 0x80000000; |
| 469 | __cpuid(ext, *eax, *ebx, *ecx, *edx); |
Julian Calaby | 79ca23e | 2016-06-27 22:37:45 +1000 | [diff] [blame^] | 470 | if (*eax >= level) { |
| 471 | __cpuid_count(level, 0, *eax, *ebx, *ecx, *edx); |
| 472 | |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 473 | return; |
| 474 | } |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 475 | #endif |
Julian Calaby | 79ca23e | 2016-06-27 22:37:45 +1000 | [diff] [blame^] | 476 | *eax = *ebx = *ecx = *edx = 0; |
Erik de Castro Lopo | a75b870 | 2014-10-04 09:14:18 +1000 | [diff] [blame] | 477 | } |
| 478 | |
Erik de Castro Lopo | b8d58e3 | 2014-06-15 20:29:34 +1000 | [diff] [blame] | 479 | #endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ |