Skip to content

Commit c1654e0

Browse files
committed
Skip checking aes-ni on Apple ARM platforms.
1 parent 8341084 commit c1654e0

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/Random123.jl

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,23 @@ include("philox.jl")
3030
export R123_USE_AESNI
3131

3232
"True when AES-NI has been enabled."
33-
const R123_USE_AESNI = try
34-
cmd = Base.julia_cmd()
35-
push!(
36-
cmd.exec, "-e",
37-
"const __m128i = NTuple{2, VecElement{UInt64}};" *
38-
"@assert ccall(\"llvm.x86.aesni.aeskeygenassist\", " *
39-
"llvmcall, __m128i, (__m128i, UInt8), " *
40-
"__m128i((0x0123456789123450, 0x9876543210987654)), 0x1) ≡ " *
41-
"__m128i((0x857c266f7c266e85, 0x2346382146382023))"
42-
)
43-
success(cmd)
44-
catch e
33+
const R123_USE_AESNI = @static if Sys.isapple() && Sys.ARCH :aarch64
4534
false
35+
else
36+
try
37+
cmd = Base.julia_cmd()
38+
push!(
39+
cmd.exec, "-e",
40+
"const __m128i = NTuple{2, VecElement{UInt64}};" *
41+
"@assert ccall(\"llvm.x86.aesni.aeskeygenassist\", " *
42+
"llvmcall, __m128i, (__m128i, UInt8), " *
43+
"__m128i((0x0123456789123450, 0x9876543210987654)), 0x1) ≡ " *
44+
"__m128i((0x857c266f7c266e85, 0x2346382146382023))"
45+
)
46+
success(cmd)
47+
catch e
48+
false
49+
end
4650
end
4751

4852
@static if R123_USE_AESNI
@@ -52,7 +56,7 @@ end
5256
include("./aesni.jl")
5357
include("./ars.jl")
5458
else
55-
@warn "AES-NI is not enabled, so AESNI and ARS are not available."
59+
@warn "AES-NI instruction set is not enabled, so the related RNGs (AESNI and ARS) are not available."
5660
end
5761

5862
end

0 commit comments

Comments
 (0)