-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Benjamin Grēgoire <[email protected]>
- Loading branch information
Showing
6 changed files
with
132 additions
and
54 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
export | ||
fn main() -> reg u32 { | ||
stack u32[2] s; | ||
reg ptr u32[1] p; | ||
reg u32 z; | ||
z = 0; | ||
|
||
s[0] = z; | ||
s[1] = z; | ||
|
||
p = s[u8 1:4]; | ||
|
||
reg u32 r; | ||
r = p[#unaligned 0]; | ||
|
||
return r; | ||
} | ||
|
||
fn load(reg ptr u32[1] a) -> reg u32 { | ||
reg u32 v; | ||
v = a[#unaligned 0]; | ||
return v; | ||
} | ||
|
||
export | ||
fn deref_unaligned() -> reg u32 { | ||
stack u32[2] s; // s mod u32 = -1 | ||
reg u32 z; | ||
z = 0; | ||
inline int i; | ||
for i = 0 to 8 { | ||
s[u8 i] = z; | ||
} | ||
|
||
reg u32 r; | ||
r = load(s.[1:1]); | ||
|
||
return r; | ||
} | ||
|
||
export | ||
fn deref_aligned() -> reg u32 { | ||
stack u32[1] s; | ||
reg u32 z; | ||
z = 0; | ||
inline int i; | ||
for i = 0 to 4 { | ||
s[u8 i] = z; | ||
} | ||
|
||
reg u32 r; | ||
r = load(s.[0:1]); | ||
|
||
return r; | ||
} |
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
Oops, something went wrong.