You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running this command: zig build-obj ./src/llvm_code.zig -O ReleaseFast -target x86_64-linux -mcpu znver4 --verbose-llvm-ir -fstrip >llvm_code.ll 2>&1 sheds a little light on the situation:
This Godbolt link shows that if we change the i8's to i3's in the LLVM IR of @init we can get the optimization we want out of LLVM. I did not verify that this makes 100% sense to do, but potentially this issue can be solved by using operations on i3's rather than i8's.
Expected Behavior
Both functions should compile down to mov byte ptr [rdi], 5
The text was updated successfully, but these errors were encountered:
Validark
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Nov 3, 2024
"When loading a value of a type like i20 with a size that is not an integral number of bytes, the result is undefined if the value was not originally written using a store of the same type."
Zig Version
0.14.0-dev.2097+d30e28754
Steps to Reproduce and Observed Behavior
This code: Godbolt link
Results in this assembly for x86-64:
Running this command:
zig build-obj ./src/llvm_code.zig -O ReleaseFast -target x86_64-linux -mcpu znver4 --verbose-llvm-ir -fstrip >llvm_code.ll 2>&1
sheds a little light on the situation:This Godbolt link shows that if we change the i8's to i3's in the LLVM IR of
@init
we can get the optimization we want out of LLVM. I did not verify that this makes 100% sense to do, but potentially this issue can be solved by using operations on i3's rather than i8's.Expected Behavior
Both functions should compile down to
mov byte ptr [rdi], 5
The text was updated successfully, but these errors were encountered: