summarylogtreecommitdiffstats
path: root/march_native.patch
blob: a182c7099b675f61d45a31574fb096e35cbbf51f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
diff --git a/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxToolChain.cs b/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxToolChain.cs
index fb38ffe34fe..c26c447ad3d 100644
--- a/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxToolChain.cs
+++ b/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxToolChain.cs
@@ -57,6 +57,11 @@ namespace UnrealBuildTool
 		/// When we support larger the 4GB files with objcopy.exe this can be removed!
 		/// </summary>
 		DisableSplitDebugInfoWithObjCopy = 0x40,
+		
+		/// <summary>
+		/// Enable Native Instruction sets for the cpu
+		/// </summary>
+		EnableNativeInstructionSet = 0x80
 	}
 
 	class LinuxToolChain : ISPCToolChain
@@ -789,6 +794,11 @@ namespace UnrealBuildTool
 				}
 			}
 
+			if (Options.HasFlag(LinuxToolChainOptions.EnableNativeInstructionSet))
+			{
+				Result += " -march=native";
+			}
+
 			if (!CompileEnvironment.bUseInlining)
 			{
 				Result += " -fno-inline-functions";
diff --git a/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/UEBuildLinux.cs b/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/UEBuildLinux.cs
index 2f0acc23d7a..efd662a7c35 100644
--- a/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/UEBuildLinux.cs
+++ b/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/UEBuildLinux.cs
@@ -73,6 +73,13 @@ namespace UnrealBuildTool
 		[CommandLine("-ThinLTO")]
 		public bool bEnableThinLTO = false;
 
+		/// <summary>
+		/// Enables Native cpu instruction set
+		/// </summary>
+		[CommandLine("-EnableNativeInstructionSet")]
+		[XmlConfigFile(Category = "BuildConfiguration", Name = "bEnableNativeInstructionSet")]
+		public bool bEnableNativeInstructionSet = false;
+
 		/// <summary>
 		/// Whether or not to preserve the portable symbol file produced by dump_syms
 		/// </summary>
@@ -137,6 +144,11 @@ namespace UnrealBuildTool
 			get { return Inner.bEnableThinLTO; }
 		}
 
+		public bool bEnableNativeInstructionSet
+		{
+			get { return Inner.bEnableNativeInstructionSet; }
+		}
+
 		#if !__MonoCS__
 		#pragma warning restore CS1591
 		#endif
@@ -617,6 +629,11 @@ namespace UnrealBuildTool
 				Options |= LinuxToolChainOptions.EnableThinLTO;
 			}
 
+			if (Target.LinuxPlatform.bEnableNativeInstructionSet)
+			{
+				Options |= LinuxToolChainOptions.EnableNativeInstructionSet;
+			}
+
 			// When building a monolithic editor we have to avoid using objcopy.exe as it cannot handle files
 			// larger then 4GB. This is only an issue with our binutils objcopy.exe.
 			// llvm-objcopy.exe does not have this issue and once we switch over to using that in clang 10.0.1 we can remove this!