32 lines
791 B
LLVM
32 lines
791 B
LLVM
; expect: run
|
|
; result: [90,103,61,61]
|
|
; phase: 1
|
|
; spec: docs/spec/16-standard-library.md §2.6.2; docs/spec/07a-air-instructions.md
|
|
; Independent RFC 4648 vector: encoding byte 102 produces ASCII Zg==.
|
|
module test.text_encode
|
|
air 0
|
|
lang 0.1
|
|
features [arrays, ownership]
|
|
|
|
fn @main() -> array<u8, 4>
|
|
effects []
|
|
entry:
|
|
%storage = local.alloc array<u8, 4>
|
|
%pad = const.u8 61
|
|
%initial = array.splat array<u8, 4> %pad
|
|
local.store %storage, %initial
|
|
%m = borrow.mut %storage
|
|
%zero = const.usize 0
|
|
%one = const.usize 1
|
|
%a = const.u8 90
|
|
%b = const.u8 103
|
|
%e0 = borrow.index %m, %zero
|
|
store %e0, %a
|
|
borrow.end %e0
|
|
%e1 = borrow.index %m, %one
|
|
store %e1, %b
|
|
borrow.end %e1
|
|
borrow.end %m
|
|
%result = local.load %storage
|
|
ret %result
|