Hash :
6abd3916
Author :
Date :
2016-11-15T08:47:43
Unified CMake-based build system See #56 for discussion. Fixes #21, Fixes #29, Fixes #37, Closes #56, Fixes #58, Closes #73 Obviates #82 See also: https://sourceforge.net/p/libjpeg-turbo/feature-requests/5/ https://sourceforge.net/p/libjpeg-turbo/patches/5/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
;
; jsimdcpu.asm - SIMD instruction support check
;
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
; Copyright (C) 2016, D. R. Commander.
;
; Based on
; x86 SIMD extension for IJG JPEG library
; Copyright (C) 1999-2006, MIYASAKA Masaru.
; For conditions of distribution and use, see copyright notice in jsimdext.inc
;
; This file should be assembled with NASM (Netwide Assembler),
; can *not* be assembled with Microsoft's MASM or any compatible
; assembler (including Borland's Turbo Assembler).
; NASM is available from http://nasm.sourceforge.net/ or
; http://sourceforge.net/project/showfiles.php?group_id=6208
;
; [TAB8]
%include "jsimdext.inc"
; --------------------------------------------------------------------------
SECTION SEG_TEXT
BITS 64
;
; Check if the CPU supports SIMD instructions
;
; GLOBAL(unsigned int)
; jpeg_simd_cpu_support (void)
;
align 32
global EXTN(jpeg_simd_cpu_support)
EXTN(jpeg_simd_cpu_support):
push rbx
push rdi
xor rdi, rdi ; simd support flag
; Check for AVX2 instruction support
mov rax, 7
xor rcx, rcx
cpuid
mov rax, rbx ; rax = Extended feature flags
or rdi, JSIMD_SSE2
or rdi, JSIMD_SSE
test rax, 1<<5 ; bit5:AVX2
jz short .return
; Check for AVX2 O/S support
mov rax, 1
xor rcx, rcx
cpuid
test rcx, 1<<27
jz short .return ; O/S does not support XSAVE
test rcx, 1<<28
jz short .return ; CPU does not support AVX2
xor rcx, rcx
xgetbv
test rax, 6 ; O/S does not manage XMM/YMM state
; using XSAVE
jz short .return
or rdi, JSIMD_AVX2
.return:
mov rax, rdi
pop rdi
pop rbx
ret
; For some reason, the OS X linker does not honor the request to align the
; segment unless we do this.
align 32