From b9b89f95ef87dcbe86213967ebc98258d4715dbe Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 23 Aug 2024 22:25:08 +0800 Subject: improve vectorext #5499 --- xmake/modules/core/tools/cl.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'xmake/modules/core/tools/cl.lua') 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 -- cgit v1.3.1