It looks like it’s an LLVM bug:
julia> primitive type UInt256 256 end
julia> x = reinterpret(UInt256, rand(UInt128, 2))[]
UInt256(0x48805fdfb72d71fadaf8daa563cf816383f755d9d9e70d703fa348f556c717ad)
julia> f(x) = Base.lshr_int(x, 0x8)
f (generic function with 1 method)
julia> @code_llvm optimize=false f(x)
; @ REPL[22]:1 within `f'
define void @julia_f_392(i256* noalias nocapture sret %0, i256 %1) {
top:
%2 = call {}*** @julia.ptls_states()
%3 = bitcast {}*** %2 to {}**
%4 = getelementptr inbounds {}*, {}** %3, i64 4
%5 = bitcast {}** %4 to i64**
%6 = load i64*, i64** %5
%7 = lshr i256 %1, 8
%8 = select i1 true, i256 0, i256 %7
store i256 %8, i256* %0, align 8
ret void
}
julia> @code_llvm optimize=true f(x)
; @ REPL[22]:1 within `f'
define void @julia_f_394(i256* noalias nocapture sret %0, i256 %1) {
top:
store i256 0, i256* %0, align 8
ret void
}
Would you mind opening an issue on GitHub?