Skip to content

Commit

Permalink
Add test for optimizing first-class view operation
Browse files Browse the repository at this point in the history
  • Loading branch information
titzer committed Oct 19, 2024
1 parent 1dbcabc commit 0f7ef34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/allopts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ local misc
combine adjacent loads/stores
byteswap recognition
reorder bounds checks of a[0], a[1], a[2]...
ordering of strength-reduction and direct call recording (inlining)

local control flow optimizations
* branch folding
Expand Down
6 changes: 6 additions & 0 deletions test/core/opt_view00.v3
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//@execute 0=0; 1=1; 256=1; 65537=2; 16909060=10
def main(x: int) -> int {
def u = u8.view<int>;
var a = u(x >> 0), b = u(x >> 8), c = u(x >> 16), d = u(x >> 24);
return a + b + c + d;
}

0 comments on commit 0f7ef34

Please sign in to comment.