Skip to content

Commit

Permalink
add a warning and two explicit inlines
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Feb 13, 2020
1 parent 9e00a1c commit 291459d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/LLVM_intrinsics.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# LLVM operations and intrinsics
module Intrinsics

# Note, that in the functions below, some care needs to be taken when passing
# Julia Bools to LLVM. Julia passes Bools as LLVM i8 but expect them to only
# have the last bit as non-zero. Failure to comply with this can give weird errors
# like false !== false where the first false is the result of some computation.

# Note, no difference is made between Julia usigned integers and signed integers
# when passed to LLVM. It is up to the caller to make sure that the correct
# intrinsic is called (e.g uitofp vs sitofp).

# TODO: fastmath flags

import ..SIMD: SIMD, VE, LVec, FloatingTypes
# Inlcude Bool in IntegerTypes
# Inlcude Bool in IntegerTypes
const IntegerTypes = Union{SIMD.IntegerTypes, Bool}

const d = Dict{DataType, String}(
Expand Down Expand Up @@ -552,6 +561,7 @@ for (fs, c) in zip([HORZ_REDUCTION_OPS_FLOAT, HORZ_REDUCTION_OPS_INT],
ret $(d[T]) %res
"""
return quote
$(Expr(:meta, :inline));
Base.llvmcall($(decl, s2), T, Tuple{LVec{N, T},}, x)
end
end
Expand All @@ -570,6 +580,7 @@ for (f, neutral) in [(:fadd, "0.0"), (:fmul, "1.0")]
ret $(d[T]) %res
"""
return quote
$(Expr(:meta, :inline));
Base.llvmcall($(decl, s2), T, Tuple{LVec{N, T},}, x)
end
end
Expand Down

0 comments on commit 291459d

Please sign in to comment.