Last active
April 2, 2022 12:17
-
-
Save Seelengrab/2806847e54c2a5b5a7949a309c32eaac to your computer and use it in GitHub Desktop.
Weird `extractvalue`s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using InteractiveUtils | |
struct Foo | |
a::UInt | |
b::NTuple{32, UInt8} | |
c::NTuple{4096, UInt8} | |
d::NTuple{4096, UInt8} | |
end | |
ident(_) = 0x0 | |
Foo() = Foo(0, ntuple(ident, 0x20), ntuple(ident, 0x1000), ntuple(ident, 0x1000)) | |
function access_tuple(array, vars...) | |
@inbounds vars[1] | |
end | |
function set_array(array, vars...) | |
@inbounds array[1] = vars[1] | |
array | |
end | |
function read_array(array, vars...) | |
@inbounds array[1] | |
end | |
function main() | |
for func in (access_tuple, set_array, read_array) | |
println("Doing function ", func, " llvm") | |
open("code_llvm_$func.ll", "w") do io | |
code_llvm(io, func, (Vector{Foo}, Tuple{Foo}); raw=true) | |
end | |
println("Doing function ", func, " native") | |
open("code_native_$func.asm", "w") do io | |
code_native(io, func, (Vector{Foo}, Tuple{Foo})) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment