How to compile AVX instructions

I’m unable to reproduce this behavior. Is this similar in nature to my laptop being too recent, or do you have to build Julia from scratch to get AVX?

julia> foo(x,y,z) = muladd(-x,y,z)
julia> @code_native foo(1.0,2.0,3.0)
Filename: REPL[902]
        pushq   %rbp
        movq    %rsp, %rbp
Source line: 1
        mulsd   %xmm1, %xmm0
        subsd   %xmm0, %xmm2
        movapd  %xmm2, %xmm0
        popq    %rbp
        nopw    %cs:(%rax,%rax)

You don’t need to rebuild Julia itself. The system image in the binary distributions is fairly generic. To enable Julia’s LLVM to use (almost?) all of the instructions available on your system, follow the instructions in the “System image building” section of the manual.

1 Like