Skip to content

Commit

Permalink
Move Float16 software implementation to a Julia runtime library.
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy authored and maleadt committed Oct 14, 2020
1 parent 6615292 commit 3851ac5
Show file tree
Hide file tree
Showing 8 changed files with 387 additions and 204 deletions.
4 changes: 4 additions & 0 deletions base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ end
include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "build_h.jl")) # include($BUILDROOT/base/build_h.jl)
include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "version_git.jl")) # include($BUILDROOT/base/version_git.jl)

# run-time library
include("runtime/runtime.jl")
using .Runtime

# numeric operations
include("hashing.jl")
include("rounding.jl")
Expand Down
6 changes: 3 additions & 3 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -779,11 +779,11 @@ Unsigned(x::Int64) = UInt64(x)
Signed(x::UInt128) = Int128(x)
Unsigned(x::Int128) = UInt128(x)

Signed(x::Union{Float32, Float64, Bool}) = Int(x)
Unsigned(x::Union{Float32, Float64, Bool}) = UInt(x)
Signed(x::Union{Float16, Float32, Float64, Bool}) = Int(x)
Unsigned(x::Union{Float16, Float32, Float64, Bool}) = UInt(x)

Integer(x::Integer) = x
Integer(x::Union{Float32, Float64}) = Int(x)
Integer(x::Union{Float16, Float32, Float64}) = Int(x)

# Binding for the julia parser, called as
#
Expand Down
2 changes: 0 additions & 2 deletions base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,6 @@ julia> reinterpret(Float32, UInt32[1 2 3 4 5])
```
"""
reinterpret(::Type{T}, x) where {T} = bitcast(T, x)
reinterpret(::Type{Unsigned}, x::Float16) = reinterpret(UInt16,x)
reinterpret(::Type{Signed}, x::Float16) = reinterpret(Int16,x)

"""
sizeof(T::DataType)
Expand Down
Loading

0 comments on commit 3851ac5

Please sign in to comment.