Skip to content

Commit

Permalink
Merge pull request #37510 from JuliaLang/tb/half
Browse files Browse the repository at this point in the history
Switch Float16 to LLVM's half
  • Loading branch information
maleadt authored Oct 15, 2020
2 parents 6d35f5a + b1b4def commit 2eb5da0
Show file tree
Hide file tree
Showing 19 changed files with 592 additions and 231 deletions.
2 changes: 1 addition & 1 deletion base/atomics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ const llvmtypes = IdDict{Any,String}(
Int32 => "i32", UInt32 => "i32",
Int64 => "i64", UInt64 => "i64",
Int128 => "i128", UInt128 => "i128",
Float16 => "i16", # half
Float16 => "half",
Float32 => "float",
Float64 => "double",
)
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 2eb5da0

Please sign in to comment.