Merge AVX2 support

This commit is contained in:
Jason Perkins 2015-03-26 11:11:59 -04:00
commit 208d0abaae
11 changed files with 207 additions and 105 deletions

View File

@ -23,4 +23,4 @@ Since 5.0-alpha1:
* New API: debugremotehost(), debugport(), debugremoteprotocol()
* New API: debugsearchpaths()
* os.outputof() now returns command exit code as second value
* Added AVX2 to vectorextensions()

View File

@ -202,12 +202,12 @@
pathVars = true,
}
api.register {
name = "debugconnectcommands",
scope = "config",
kind = "list:string",
tokens = true,
}
api.register {
name = "debugconnectcommands",
scope = "config",
kind = "list:string",
tokens = true,
}
api.register {
name = "debugdir",
@ -225,12 +225,12 @@
pathVars = true,
}
api.register {
name = "debugextendedprotocol",
scope = "config",
kind = "boolean",
}
api.register {
name = "debugextendedprotocol",
scope = "config",
kind = "boolean",
}
api.register {
name = "debugformat",
scope = "config",
@ -240,32 +240,32 @@
},
}
api.register {
name = "debugport",
scope = "config",
kind = "integer",
}
api.register {
name = "debugremotehost",
scope = "config",
kind = "string",
tokens = true,
}
api.register {
name = "debugport",
scope = "config",
kind = "integer",
}
api.register {
name = "debugsearchpaths",
scope = "config",
kind = "list:path",
tokens = true,
}
api.register {
name = "debugstartupcommands",
scope = "config",
kind = "list:string",
tokens = true,
}
api.register {
name = "debugremotehost",
scope = "config",
kind = "string",
tokens = true,
}
api.register {
name = "debugsearchpaths",
scope = "config",
kind = "list:path",
tokens = true,
}
api.register {
name = "debugstartupcommands",
scope = "config",
kind = "list:string",
tokens = true,
}
api.register {
name = "defaultplatform",
@ -864,6 +864,7 @@
allowed = {
"Default",
"AVX",
"AVX2",
"SSE",
"SSE2",
}

View File

@ -1047,19 +1047,19 @@
function m.enableEnhancedInstructionSet(cfg, condition)
local value
local v
local x = cfg.vectorextensions
if _ACTION > "vc2010" and x == "AVX" then
value = "AdvancedVectorExtensions"
if x == "AVX" and _ACTION > "vs2010" then
v = "AdvancedVectorExtensions"
elseif x == "AVX2" and _ACTION > "vs2012" then
v = "AdvancedVectorExtensions2"
elseif x == "SSE2" then
value = "StreamingSIMDExtensions2"
v = "StreamingSIMDExtensions2"
elseif x == "SSE" then
value = "StreamingSIMDExtensions"
v = "StreamingSIMDExtensions"
end
if value then
m.element('EnableEnhancedInstructionSet', condition, value)
if v then
m.element('EnableEnhancedInstructionSet', condition, v)
end
end
@ -1626,7 +1626,7 @@
end
end
function m.treatSpecificWarningsAsErrors(cfg, condition)
if #cfg.fatalwarnings > 0 then
local fatal = table.concat(cfg.fatalwarnings, ";")

View File

@ -69,6 +69,7 @@
},
vectorextensions = {
AVX = "-mavx",
AVX2 = "-mavx2",
SSE = "-msse",
SSE2 = "-msse2",
},

View File

@ -54,8 +54,9 @@
},
vectorextensions = {
AVX = "/arch:AVX",
SSE = "/arch:sse",
SSE2 = "/arch:sse2",
AVX2 = "/arch:AVX2",
SSE = "/arch:SSE",
SSE2 = "/arch:SSE2",
},
warnings = {
Extra = "/W4",

View File

@ -104,6 +104,7 @@ return {
"actions/vstudio/vc2010/test_excluded_configs.lua",
"actions/vstudio/vc2010/test_extension_settings.lua",
"actions/vstudio/vc2010/test_extension_targets.lua",
"actions/vstudio/vc2010/test_floatingpoint.lua",
"actions/vstudio/vc2010/test_globals.lua",
"actions/vstudio/vc2010/test_header.lua",
"actions/vstudio/vc2010/test_files.lua",
@ -121,6 +122,7 @@ return {
"actions/vstudio/vc2010/test_resource_compile.lua",
"actions/vstudio/vc2010/test_rule_vars.lua",
"actions/vstudio/vc2010/test_user_file.lua",
"actions/vstudio/vc2010/test_vectorextensions.lua",
-- Makefile tests
"actions/make/test_make_escaping.lua",

View File

@ -463,59 +463,6 @@
end
--
-- Check handling of floating point and SSE flags.
--
function suite.instructionSet_onSSE()
vectorextensions "SSE"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
]]
end
function suite.instructionSet_onSSE2()
vectorextensions "SSE2"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
]]
end
function suite.floatingPoint_onFloatFast()
flags "FloatFast"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<FloatingPointModel>Fast</FloatingPointModel>
]]
end
function suite.floatingPoint_onFloatStrict()
flags "FloatStrict"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<FloatingPointModel>Strict</FloatingPointModel>
]]
end
--
-- Verify character handling.
--

View File

@ -0,0 +1,49 @@
---
-- tests/actions/vstudio/vc2010/test_floatingpoint.lua
-- Validate handling of vectorextensions() in VS 2010 C/C++ projects.
--
-- Created 26 Mar 2015 by Jason Perkins
-- Copyright (c) 2015 Jason Perkins and the Premake project
---
local suite = test.declare("vs2010_vc_floatingpoint")
local m = premake.vstudio.vc2010
local sln, prj
function suite.setup()
_ACTION = "vs2010"
sln, prj = test.createsolution()
end
local function prepare()
local cfg = test.getconfig(prj, "Debug")
m.floatingPointModel(cfg)
end
function suite.instructionSet_onNotSet()
test.isemptycapture()
end
function suite.floatingPoint_onFloatFast()
flags "FloatFast"
prepare()
test.capture [[
<FloatingPointModel>Fast</FloatingPointModel>
]]
end
function suite.floatingPoint_onFloatStrict()
flags "FloatStrict"
prepare()
test.capture [[
<FloatingPointModel>Strict</FloatingPointModel>
]]
end

View File

@ -0,0 +1,77 @@
---
-- tests/actions/vstudio/vc2010/test_vectorextensions.lua
-- Validate handling of vectorextensions() in VS 2010 C/C++ projects.
--
-- Created 26 Mar 2015 by Jason Perkins
-- Copyright (c) 2015 Jason Perkins and the Premake project
---
local suite = test.declare("vs2010_vc_vectorextensions")
local m = premake.vstudio.vc2010
local sln, prj
function suite.setup()
_ACTION = "vs2010"
sln, prj = test.createsolution()
end
local function prepare()
local cfg = test.getconfig(prj, "Debug")
m.enableEnhancedInstructionSet(cfg)
end
function suite.instructionSet_onNotSet()
test.isemptycapture()
end
function suite.instructionSet_onSSE()
vectorextensions "SSE"
prepare()
test.capture [[
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
]]
end
function suite.instructionSet_onSSE2()
vectorextensions "SSE2"
prepare()
test.capture [[
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
]]
end
function suite.instructionSet_onAVX()
_ACTION = "vs2013"
vectorextensions "AVX"
prepare()
test.capture [[
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
]]
end
function suite.instructionSet_onAVX_onVS2010()
vectorextensions "AVX"
prepare()
test.isemptycapture()
end
function suite.instructionSet_onAVX2()
_ACTION = "vs2013"
vectorextensions "AVX2"
prepare()
test.capture [[
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
]]
end
function suite.instructionSet_onAVX2_onVS2012()
_ACTION = "vs2012"
vectorextensions "AVX2"
prepare()
test.isemptycapture()
end

View File

@ -123,6 +123,18 @@
test.contains({ "-msse2" }, gcc.getcflags(cfg))
end
function suite.cflags_onAVX()
vectorextensions "AVX"
prepare()
test.contains({ "-mavx" }, gcc.getcflags(cfg))
end
function suite.cflags_onAVX()
vectorextensions "AVX2"
prepare()
test.contains({ "-mavx2" }, gcc.getcflags(cfg))
end
--
-- Check the defines and undefines.

View File

@ -167,13 +167,25 @@
function suite.cflags_onSSE()
vectorextensions "SSE"
prepare()
test.contains("/arch:sse", msc.getcflags(cfg))
test.contains("/arch:SSE", msc.getcflags(cfg))
end
function suite.cflags_onSSE2()
vectorextensions "SSE2"
prepare()
test.contains("/arch:sse2", msc.getcflags(cfg))
test.contains("/arch:SSE2", msc.getcflags(cfg))
end
function suite.cflags_onAVX()
vectorextensions "AVX"
prepare()
test.contains("/arch:AVX", msc.getcflags(cfg))
end
function suite.cflags_onAVX2()
vectorextensions "AVX2"
prepare()
test.contains("/arch:AVX2", msc.getcflags(cfg))
end