.githooks/
compiler/
kernel/
lib/
examples/
std/
arch/
bits/
char/
collections/
fs/
hash/
lang/
mem/
sys/
arch.rad
68 B
bits.rad
1.6 KiB
char.rad
1.5 KiB
collections.rad
39 B
fmt.rad
11.6 KiB
fs.rad
11.0 KiB
hash.rad
41 B
intrinsics.rad
467 B
io.rad
1.7 KiB
lang.rad
335 B
mem.rad
12.0 KiB
mem.ras
919 B
process.rad
6.2 KiB
std.manifest
4.9 KiB
std.rad
349 B
sys.rad
1.0 KiB
testing.rad
2.4 KiB
tests.rad
26.6 KiB
vec.rad
3.2 KiB
scripts/
seed/
sublime/
test/
vim/
.gitignore
333 B
.gitsigners
224 B
AGENTS.md
8.3 KiB
CONTRIBUTING
2.1 KiB
LICENSE
1.1 KiB
Makefile
2.5 KiB
README
3.4 KiB
STYLE
3.2 KiB
std.lib
2.1 KiB
std.lib.test
1.1 KiB
lib/std/mem.ras
raw
| 1 | //! Byte-wide bulk memory stores. Vector state is caller-saved. |
| 2 | .text; |
| 3 | // a0 is the output address; a1 is its nonzero byte count; a2 is the value. |
| 4 | .export @"std::mem::fillBytes"; |
| 5 | @"std::mem::fillBytes" |
| 6 | vsetvli %t0 %a1 e8 m8 ta ma; |
| 7 | vmv.v.x %v8 %a2; |
| 8 | vse8.v %v8 (%a0); |
| 9 | add %a0 %a0 %t0; |
| 10 | sub %a1 %a1 %t0; |
| 11 | bnez %a1 @"std::mem::fillBytes"; |
| 12 | ret; |
| 13 | |
| 14 | // a0 is the output; a1 is the pattern; a2 is the repetition count; |
| 15 | // a3 is the pattern width. Count and width must both be nonzero. |
| 16 | .export @"std::mem::repeatBytes"; |
| 17 | @"std::mem::repeatBytes" |
| 18 | vsetvli %t0 %a2 e8 m8 ta ma; |
| 19 | mv %t1 %a0; |
| 20 | mv %t2 %a1; |
| 21 | mv %t3 %a3; |
| 22 | @repeatByte |
| 23 | lbu %t4 0(%t2); |
| 24 | vmv.v.x %v8 %t4; |
| 25 | vsse8.v %v8 (%t1) %a3; |
| 26 | addi %t1 %t1 1; |
| 27 | addi %t2 %t2 1; |
| 28 | addi %t3 %t3 -1; |
| 29 | bnez %t3 @repeatByte; |
| 30 | mul %t1 %t0 %a3; |
| 31 | add %a0 %a0 %t1; |
| 32 | sub %a2 %a2 %t0; |
| 33 | bnez %a2 @"std::mem::repeatBytes"; |
| 34 | ret; |