summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-08-23 22:25:08 +0800
committerruki <[email protected]>2024-08-23 22:25:08 +0800
commitb9b89f95ef87dcbe86213967ebc98258d4715dbe (patch)
treee9c220e69703c8eaa8142b9a361921e999263514
parent57df37f3d8e15a74cf9148471ba0cf6d13a11c53 (diff)
improve vectorext #5499
-rw-r--r--xmake/modules/core/tools/cl.lua15
1 files changed, 12 insertions, 3 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index c4eede192..db2f32662 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -216,9 +216,18 @@ function nf_vectorext(self, extension)
, fma = "-arch:AVX2"
, all = {"-arch:SSE", "-arch:SSE2", "/d2archSSE42", "-arch:AVX", "-arch:AVX2", "-arch:AVX512"}
}
- local flag = maps[extension]
- if flag and self:has_flags(flag, "cxflags") then
- return flag
+ local flags = maps[extension]
+ if flags then
+ -- @see https://github.com/xmake-io/xmake/issues/5499
+ local result = {}
+ for _, flag in ipairs(flags) do
+ if self:has_flags(flag, "cxflags") then
+ table.insert(result, flag)
+ end
+ end
+ if #result > 0 then
+ return table.unwrap(result)
+ end
end
end