summaryrefslogtreecommitdiff
path: root/vpx_ports
diff options
context:
space:
mode:
authorJohann Koenig <johannkoenig@google.com>2018-03-23 18:04:35 +0000
committerJohann <johannkoenig@google.com>2018-03-23 11:09:15 -0700
commit99e1784525d940ec9975261e352252f89f0694db (patch)
tree4093166651cbc9cdf5ee9716a49fc19ab85acb10 /vpx_ports
parent1000e07609f9136559148629ced67c170cb0218e (diff)
downloadlibvpx-99e1784525d940ec9975261e352252f89f0694db.tar
libvpx-99e1784525d940ec9975261e352252f89f0694db.tar.gz
libvpx-99e1784525d940ec9975261e352252f89f0694db.tar.bz2
libvpx-99e1784525d940ec9975261e352252f89f0694db.zip
Revert "remove fldcw/fstcw from Win64 builds"
This reverts commit 60a3cb9ad840377d46286bfd703c30a4a4ee56e2. Reason for revert: x87 instruction usage might not be as clear cut as I would like. At the very least, llvm mingw builds appear to having issues with emms. Original change's description: > remove fldcw/fstcw from Win64 builds > > _MCW_PC (Precision control) is not supported on x64: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/control87-controlfp-control87-2 > > The x87 FPU is not used on Win64 or ARM so setting the x87 control word > is not necessary. The SSE/SSE2 and ARM FPUs don't have a precision > control - the precision is embedded in each instruction - so the need to > set the control word is also gone. BUG=webm:1500 Change-Id: I25bcfa96bc9c860f6c7e03315d75fa6fd1d88ec5
Diffstat (limited to 'vpx_ports')
-rw-r--r--vpx_ports/float_control_word.asm33
-rw-r--r--vpx_ports/vpx_ports.mk4
-rw-r--r--vpx_ports/x86.h10
3 files changed, 42 insertions, 5 deletions
diff --git a/vpx_ports/float_control_word.asm b/vpx_ports/float_control_word.asm
new file mode 100644
index 000000000..256dae084
--- /dev/null
+++ b/vpx_ports/float_control_word.asm
@@ -0,0 +1,33 @@
+;
+; Copyright (c) 2010 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 "vpx_ports/x86_abi_support.asm"
+
+section .text
+
+%if LIBVPX_YASM_WIN64
+global sym(vpx_winx64_fldcw) PRIVATE
+sym(vpx_winx64_fldcw):
+ sub rsp, 8
+ mov [rsp], rcx ; win x64 specific
+ fldcw [rsp]
+ add rsp, 8
+ ret
+
+
+global sym(vpx_winx64_fstcw) PRIVATE
+sym(vpx_winx64_fstcw):
+ sub rsp, 8
+ fstcw [rsp]
+ mov rax, [rsp]
+ add rsp, 8
+ ret
+%endif
diff --git a/vpx_ports/vpx_ports.mk b/vpx_ports/vpx_ports.mk
index 9a6616a81..9299fa0ca 100644
--- a/vpx_ports/vpx_ports.mk
+++ b/vpx_ports/vpx_ports.mk
@@ -21,6 +21,10 @@ 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)
PORTS_SRCS-yes += x86.h
PORTS_SRCS-yes += x86_abi_support.asm
diff --git a/vpx_ports/x86.h b/vpx_ports/x86.h
index 08295ceb7..4b053b236 100644
--- a/vpx_ports/x86.h
+++ b/vpx_ports/x86.h
@@ -295,11 +295,11 @@ static unsigned short x87_get_control_word(void) {
return mode;
}
#elif ARCH_X86_64
-// Unsupported on Win64:
-// https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/control87-controlfp-control87-2
-// _MCW_PC (Precision control) (Not supported on ARM or x64 platforms.)
-static void x87_set_control_word(unsigned int mode) { (void)mode; }
-static unsigned int x87_get_control_word(void) { return 0; }
+/* No fldcw intrinsics on Windows x64, punt to external asm */
+extern void vpx_winx64_fldcw(unsigned short mode);
+extern unsigned short vpx_winx64_fstcw(void);
+#define x87_set_control_word vpx_winx64_fldcw
+#define x87_get_control_word vpx_winx64_fstcw
#else
static void x87_set_control_word(unsigned short mode) {
__asm { fldcw mode }