It might help if you explain something about what you want to do with the
binary representation.
For example,
julia> f(x::Float64) = reinterpret(Float64, reinterpret(UInt64, x) &
0x7fffffffffffffff)
f (generic function with 1 method)
generates very simple LLVM code
julia> code_llvm(f, (Float64,))
define double @julia_f_21398(double) {
top:
%1 = bitcast double %0 to i64
%2 = and i64 %1, 9223372036854775807
%3 = bitcast i64 %2 to double
ret double %3
}
which is compiled by LLVM into
julia> code_native(f, (Float64,))
.text
Filename: none
Source line: 0
pushq %rbp
movq %rsp, %rbp
Source line: 1
vmovq %xmm0, %rax
movabsq $9223372036854775807, %rcx # imm = 0x7FFFFFFFFFFFFFFF
andq %rax, %rcx
vmovq %rcx, %xmm0
popq %rbp
retq
nopl (%rax)
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movq (%rsi), %rax
vmovsd (%rax), %xmm0
movabsq $f, %rax
callq *%rax
vmovsd %xmm0, -8(%rbp)
movabsq $__pool_alloc, %rax
callq *%rax
movabsq $140629191800336, %rcx # imm = 0x7FE6C905B610
movq %rcx, -8(%rax)
vmovsd -8(%rbp), %xmm0
vmovsd %xmm0, (%rax)
addq $16, %rsp
popq %rbp
retq
The lines up to the first retq look reasonable to me but I have no idea
what's up with the rest of the output. Possibly a bug in code_native.
Den måndag 19 oktober 2015 kl. 06:59:29 UTC+2 skrev Uliano Guerrini:
> I see, however my question is if there is a way to perform the conversion
> shown (or the like) without any (or minimal) run time penalty that is the
> reason why when I found that reinterpret was calling intrinsics I focussed
> on them. In C time penalty is 0 If Julia proposes itself as solving the two
> language problem I should not think to write parts of the code in C
>
>