Here is a patch for testing, with the following changes:
* AXV targeting is supported, with CPUNR=avx * AVX2 targeting is supported, with CPUNR=avx2 * SSE targeting is supported, with CPUNR=sse * SSE2 targeting now uses CPUNR=sse2. * CPUNR=pentium4 is supported (with a warning), so as not to break existing scripts. Internally is is aliased to sse2. Rationale here, AMD exists, and it doesn't make sense to call instruction set targeting after a nebulous intel marketing name, or revision. Not all "Sandy Bridge" CPUs support AVX, for example, and there are probably more SSE2 Athlons/Opterons around than there are Pentium 4s. In view of that, it makes more sense to name the options after the instruction set, where possible. As for 'pentium4' printing a deprecation warning, I figure if we start now, by 2042 when Vim 9 comes out and we all want to compile it for our autopiloted flying cars so we can code on the way to work, we'll be able to remove it. * untargeted is now specifically available via CPUNR=any, as well as being the (intended) default as before. Previously, the behaviour depended on the compiler defaults, which gave untargeted code for VC10 and earlier, and SSE2 code for VC12 and later, where the /arch:IA32 option appears for generating fp87 code. Also, the makefile *said* i386 was the default, but actually untargeted was. This can be changed to i586 being the default for VC < 8, though the actual effect of the current Makefile seems better. * i586, i686, properly generates fp87 code for VC11 and up. Currently, it generates SSE2 code, as that is the default. * Support for targeting the i386 and i486 architectures is removed. Patch 8.0.0029 drops support for Windows NT4 and Windows 2000, and the minimum requirements for Windows XP is an i586 processor. I can add this back if its really necessary, of course, but it doesn't seem sensible. * Visual C++ 15 is supported. Thanks to MS always being a special snowflake, VC15 reports an _MSC_VER of 1910, which yields a compiler version of 14.1 (should be 15) and VC Runtime version of 141 (should be 140). So, it has special handling, sadly. * Invalid target architecture values error out. This seems a saner behaviour than the current "silently use compiler defaults". * Target architecture values unsupported by the compiler gracefully downgrade to the next available one, and print a warning. The path is AVX2->AVX->SSE/nothing, depending on VC's version and x86/x64. This is currently only for VC >= 8, though its trivial to add for VC < 8 if desired. Still to do is checking the GVimExt and VisVim makefiles, to see if they properly generate fp87 code with CPUNR=(i586|i686|any) under VC11 and up. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
>From 2ca3a3535a31238f1f28bb134ccf6bf94f77da39 Mon Sep 17 00:00:00 2001 From: Leonardo Valeri Manera <[email protected]> Date: Thu, 1 Jun 2017 17:18:06 +0200 Subject: [PATCH] Changes for Make_mvc.mak, for testing --- src/Make_mvc.mak | 103 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 87 insertions(+), 16 deletions(-) diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 1638fd9b8..fff963f8f 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -1,7 +1,7 @@ # Makefile for Vim on Win32 (Windows XP/2003/Vista/7/8/10) and Win64, # using the Microsoft Visual C++ compilers. Known to work with VC5, VC6 (VS98), # VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005), VC9 (VS2008), VC10 (VS2010), -# VC11 (VS2012), VC12 (VS2013) and VC14 (VS2015) +# VC11 (VS2012), VC12 (VS2013), VC14 (VS2015) and VC15 (VS2017) # # To build using other Windows compilers, see INSTALLpc.txt # @@ -108,10 +108,15 @@ # # Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED) # -# Processor Version: CPUNR=[i386, i486, i586, i686, pentium4] (default is -# i386) +# Processor Version: CPUNR=[any, i586, i686, sse, sse2, avx, avx2] (default is +# any) +# avx is available on Visual C++ 2010 and after. +# avx2 is available on Visual C++ 2013 Update 2 and after. # -# Version Support: WINVER=[0x0501, 0x0600] (default is 0x0501) +# Version Support: WINVER=[0x0501, 0x0502, 0x0600, 0x0601, 0x0602, +# 0x0603, 0x0A00] (default is 0x0501) +# Supported versions depends on your target SDK, check SDKDDKVer.h +# See https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt # # Debug version: DEBUG=yes # Mapfile: MAP=[no, yes or lines] (default is yes) @@ -270,11 +275,31 @@ MAKEFLAGS_GVIMEXT = DEBUG=yes !if $(MSVCVER) < 1900 MSVC_MAJOR = ($(MSVCVER) / 100 - 6) MSVCRT_VER = ($(MSVCVER) / 10 - 60) +# Visual C++ 2017 needs special handling +# it has an _MSC_VER of 1910->14.1, but is actually v15 with runtime v140 +!elseif $(MSVCVER) == 1910 +MSVC_MAJOR = 15 +MSVCRT_VER = 140 !else MSVC_MAJOR = ($(MSVCVER) / 100 - 5) MSVCRT_VER = ($(MSVCVER) / 10 - 50) !endif +# Calculate MSVC_FULL for Visual C++ 8 and up. +!if $(MSVC_MAJOR) >= 8 +! if [echo MSVC_FULL=_MSC_FULL_VER> msvcfullver.c && $(CC) /EP msvcfullver.c > msvcfullver.~ 2> nul] +! message *** ERROR +! message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH. +! message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed. +! error Make aborted. +! else +! include msvcfullver.~ +! if [del msvcfullver.c msvcfullver.~] +! endif +! endif +!endif + + # Calculate MSVCRT_VER !if [(set /a MSVCRT_VER="$(MSVCRT_VER)" > nul) && set MSVCRT_VER > msvcrtver.~] == 0 !include msvcrtver.~ @@ -446,26 +471,72 @@ DEL_TREE = rmdir /s /q INTDIR=$(OBJDIR) OUTDIR=$(OBJDIR) +### Validate CPUNR +!ifndef CPUNR +CPUNR = sse2 +!elseif "$(CPUNR)" == "pentium4" +! message *** WARNING CPUNR=pentium4 is deprecated in favour of sse2 +CPUNR = sse2 +!elseif "$(CPUNR)" != "i586" && "$(CPUNR)" != "i686" && "$(CPUNR)" != "sse" && "$(CPUNR)" != "sse2" && "$(CPUNR)" != "avx" && "$(CPUNR)" != "avx2" +! error *** ERROR Unknown target architecture "$(CPUNR)". Make aborted. +!endif + # Convert processor ID to MVC-compatible number !if $(MSVC_MAJOR) < 8 -!if "$(CPUNR)" == "i386" -CPUARG = /G3 -!elseif "$(CPUNR)" == "i486" -CPUARG = /G4 -!elseif "$(CPUNR)" == "i586" +! if "$(CPUNR)" == "i586" CPUARG = /G5 -!elseif "$(CPUNR)" == "i686" +! elseif "$(CPUNR)" == "i686" CPUARG = /G6 -!elseif "$(CPUNR)" == "pentium4" +! elseif "$(CPUNR)" == "sse" +CPUARG = /G6 /arch:SSE +! elseif "$(CPUNR)" == "sse2" || ("$(CPUNR)" == "avx") || ("$(CPUNR)" == "avx2") CPUARG = /G7 /arch:SSE2 -!else +! elseif "$(CPUNR)" == "any" CPUARG = -!endif +! endif !else -# VC8/9/10 only allows specifying SSE architecture but only for 32bit -!if "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "pentium4" +# IA32/SSE/SSE2 are only supported on x86 +! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "i586" || "$(CPUNR)" == "i686" || "$(CPUNR)" == "any" +! if $(MSVC_MAJOR) < 11 +CPUARG = +! else +CPUARG = /arch:IA32 +! endif +! elseif "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "sse" +CPUARG = /arch:SSE +! elseif "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "sse2" CPUARG = /arch:SSE2 -!endif +# AVX is only supported by VC 10 and up +! elseif "$(CPUNR)" == "avx" +! if $(MSVC_MAJOR) < 10 +! message AVX Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)-$(MSVC_FULL) +! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" +! message Falling back to SSE2 +CPUARG = /arch:SSE2 +! else +CPUARG = +! endif +! else +CPUARG = /arch:AVX +! endif +# AVX2 is only supported by VC 10 and up +! elseif "$(CPUNR)" == "avx2" +! if $(MSVC_MAJOR) < 10 +! message AVX2 Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)-$(MSVC_FULL) +! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" +! message Falling back to SSE2 +CPUARG = /arch:SSE2 +! else +CPUARG = +! endif +! elseif $(MSVC_FULL) < 180030501 +! message AVX2 Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)-$(MSVC_FULL) +! message Falling back to AVX +CPUARG = /arch:AVX +! else +CPUARG = /arch:AVX2 +! endif +! endif !endif LIBC = -- 2.13.0.windows.1
