reland "use intrinsics for 'emms'"

Only target 32bit builds. Visual Studio does not define _mm_empty for
64bit configurations.

Rename emms.asm and remove from 32 bit builds to avoid empty file
warnings.

Don't check register state on 64bit builds.

BUG=webm:1500

This reverts commit 60beb781c1.

Change-Id: I5ac4cf6c67249ff24f7da19792144de20527bfce
This commit is contained in:
Johann 2018-03-14 16:57:57 -07:00
parent 0f9521f0a8
commit 726b021a12
7 changed files with 37 additions and 22 deletions

View File

@ -11,19 +11,13 @@
#define TEST_CLEAR_SYSTEM_STATE_H_ #define TEST_CLEAR_SYSTEM_STATE_H_
#include "./vpx_config.h" #include "./vpx_config.h"
#if ARCH_X86 || ARCH_X86_64 #include "vpx_ports/system_state.h"
#include "vpx_ports/x86.h"
#endif
namespace libvpx_test { namespace libvpx_test {
// Reset system to a known state. This function should be used for all non-API // Reset system to a known state. This function should be used for all non-API
// test cases. // test cases.
inline void ClearSystemState() { inline void ClearSystemState() { vpx_clear_system_state(); }
#if ARCH_X86 || ARCH_X86_64
vpx_reset_mmx_state();
#endif
}
} // namespace libvpx_test } // namespace libvpx_test
#endif // TEST_CLEAR_SYSTEM_STATE_H_ #endif // TEST_CLEAR_SYSTEM_STATE_H_

View File

@ -140,7 +140,7 @@ class RegisterStateCheck {};
#endif // _WIN64 #endif // _WIN64
#if ARCH_X86 || ARCH_X86_64 #if ARCH_X86
#if defined(__GNUC__) #if defined(__GNUC__)
namespace libvpx_test { namespace libvpx_test {
@ -178,7 +178,7 @@ class RegisterStateCheckMMX {
} // namespace libvpx_test } // namespace libvpx_test
#endif // __GNUC__ #endif // __GNUC__
#endif // ARCH_X86 || ARCH_X86_64 #endif // ARCH_X86
#ifndef API_REGISTER_STATE_CHECK #ifndef API_REGISTER_STATE_CHECK
#define API_REGISTER_STATE_CHECK ASM_REGISTER_STATE_CHECK #define API_REGISTER_STATE_CHECK ASM_REGISTER_STATE_CHECK

13
vpx_ports/emms_mmx.c Normal file
View File

@ -0,0 +1,13 @@
/*
* Copyright (c) 2018 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <mmintrin.h>
void vpx_clear_system_state() { _mm_empty(); }

View File

@ -12,11 +12,6 @@
%include "vpx_ports/x86_abi_support.asm" %include "vpx_ports/x86_abi_support.asm"
section .text section .text
global sym(vpx_reset_mmx_state) PRIVATE
sym(vpx_reset_mmx_state):
emms
ret
%if LIBVPX_YASM_WIN64 %if LIBVPX_YASM_WIN64
global sym(vpx_winx64_fldcw) PRIVATE global sym(vpx_winx64_fldcw) PRIVATE

View File

@ -13,10 +13,18 @@
#include "./vpx_config.h" #include "./vpx_config.h"
#if ARCH_X86 || ARCH_X86_64 #ifdef __cplusplus
void vpx_reset_mmx_state(void); extern "C" {
#define vpx_clear_system_state() vpx_reset_mmx_state() #endif
#if ARCH_X86 && HAVE_MMX
extern void vpx_clear_system_state();
#else #else
#define vpx_clear_system_state() #define vpx_clear_system_state()
#endif // ARCH_X86 || ARCH_X86_64 #endif // ARCH_X86 && HAVE_MMX
#ifdef __cplusplus
} // extern "C"
#endif
#endif // VPX_PORTS_SYSTEM_STATE_H_ #endif // VPX_PORTS_SYSTEM_STATE_H_

View File

@ -17,8 +17,15 @@ PORTS_SRCS-yes += msvc.h
PORTS_SRCS-yes += system_state.h PORTS_SRCS-yes += system_state.h
PORTS_SRCS-yes += vpx_timer.h PORTS_SRCS-yes += vpx_timer.h
ifeq ($(ARCH_X86),yes)
PORTS_SRCS-$(HAVE_MMX) += emms_mmx.c
endif
ifeq ($(ARCH_X86_64),yes)
PORTS_SRCS-$(CONFIG_MSVS) += float_control_word.asm
endif
ifeq ($(ARCH_X86)$(ARCH_X86_64),yes) ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
PORTS_SRCS-yes += emms.asm
PORTS_SRCS-yes += x86.h PORTS_SRCS-yes += x86.h
PORTS_SRCS-yes += x86_abi_support.asm PORTS_SRCS-yes += x86_abi_support.asm
endif endif

View File

@ -317,8 +317,6 @@ static INLINE unsigned int x87_set_double_precision(void) {
return mode; return mode;
} }
extern void vpx_reset_mmx_state(void);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif