Commits

Jason Perkins committed 1202889

Add support for the AVX instruction set

  • Participants
  • Parent commits 64f7888

Comments (0)

Files changed (6)

File src/_premake_init.lua

 		kind = "string",
 		allowed = {
 			"Default",
+			"AVX",
 			"SSE",
 			"SSE2",
 		}

File src/actions/vstudio/vs2010_vcxproj.lua

 
 
 	function vc2010.enableEnhancedInstructionSet(cfg)
-		local map = {
-			SSE = "StreamingSIMDExtensions",
-			SSE2 = "StreamingSIMDExtensions2"
-		}
-		local value = map[cfg.vectorextensions]
+		local value
+
+		local x = cfg.vectorextensions
+		if _ACTION > "vc2010" and x == "AVX" then
+			value = "AdvancedVectorExtensions"
+		elseif x == "SSE2" then
+			value = "StreamingSIMDExtensions2"
+		elseif x == "SSE" then
+			value = "StreamingSIMDExtensions"
+		end
+
 		if value then
 			_p(3,'<EnableEnhancedInstructionSet>%s</EnableEnhancedInstructionSet>', value)
 		end

File src/tools/gcc.lua

 --
 -- gcc.lua
 -- Provides GCC-specific configuration strings.
--- Copyright (c) 2002-2013 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2014 Jason Perkins and the Premake project
 --
 
 	premake.tools.gcc = {}
 			Speed = "-O3",
 		},
 		vectorextensions = {
+			AVX = "-mavx",
 			SSE = "-msse",
 			SSE2 = "-msse2",
 		},

File src/tools/msc.lua

 --
 -- msc.lua
 -- Interface for the MS C/C++ compiler.
--- Copyright (c) 2009-2013 Jason Perkins and the Premake project
+-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
 --
 
 
 			Speed = "/O2",
 		},
 		vectorextensions = {
+			AVX = "/arch:AVX",
 			SSE = "/arch:sse",
 			SSE2 = "/arch:sse2",
 		},

File tests/actions/vs2012/test_vcxproj_clcompile.lua

+--
+-- tests/actions/vs2012/test_vcxproj_clcompile.lua
+-- Validate compiler settings in Visual Studio 2012 C/C++ projects.
+-- Copyright (c) 2014 Jason Perkins and the Premake project
+--
+
+	local suite = test.declare("vs2012_vcxproj_clcompile")
+	local vc2010 = premake.vstudio.vc2010
+	local project = premake.project
+
+
+--
+-- Setup
+--
+
+	local sln, prj, cfg
+
+	function suite.setup()
+		_ACTION = "vs2012"
+		sln, prj = test.createsolution()
+	end
+
+
+--
+-- Verify the new instruction sets.
+--
+
+	function suite.enhancedInstructionSet_onAVX()
+		vectorextensions "avx"
+		vc2010.enableEnhancedInstructionSet(test.getconfig(prj, "Debug"))
+		test.capture [[
+			<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
+		]]
+	end

File tests/premake5.lua

 	dofile("actions/vs2012/test_csproj_project_props.lua")
 	dofile("actions/vs2012/test_csproj_targets.lua")
 	dofile("actions/vs2012/test_sln_header.lua")
+	dofile("actions/vs2012/test_vcxproj_clcompile.lua")
 	dofile("actions/vs2012/test_vcxproj_config_props.lua")
 
 	-- Visual Studio 2013