Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/rung2/enccases.sh # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / rung2 / enccases.sh` 33 lines ยท 2641 bytes Raw Blame History 1 #!/bin/sh 2 # enccases.sh -- the rung-2 encoder comparison cases, one per line: "|". 3 # Every form in src/aarch64_encoder.h, with registers and immediates at their edges. Units: the reference 4 # encoder takes load/store offsets in bytes; asm2's table takes the manual's imm12 (offset / access size), 5 # so the asm2 line holds offset/size. movz/movk: C takes the shift (0,16,32,48), asm2 the manual's hw. 6 R="0 1 7 15 30 31" 7 rx() { [ "$1" = 31 ] && echo xzr || echo "x$1"; } 8 rw() { [ "$1" = 31 ] && echo wzr || echo "w$1"; } 9 rs() { [ "$1" = 31 ] && echo sp || echo "x$1"; } 10 for f in add sub mul and orr eor subs; do for sf in 1 0; do for d in $R; do for n in $R; do for m in $R; do 11 if [ $sf = 1 ]; then echo "${f}_reg 1 $d $n $m|$f.x $(rx $d) $(rx $n) $(rx $m)"; else echo "${f}_reg 0 $d $n $m|$f.w $(rw $d) $(rw $n) $(rw $m)"; fi 12 done; done; done; done; done 13 for sf in 1 0; do for d in $R; do for m in $R; do 14 if [ $sf = 1 ]; then echo "mov_reg 1 $d $m|mov.x $(rx $d) $(rx $m)"; else echo "mov_reg 0 $d $m|mov.w $(rw $d) $(rw $m)"; fi 15 done; done; done 16 for f in movz movk; do for d in $R; do for v in 0 1 4660 65535; do 17 for s in 0 16 32 48; do echo "$f 1 $d $v $s|$f.x $(rx $d) $v $((s / 16))"; done 18 for s in 0 16; do echo "$f 0 $d $v $s|$f.w $(rw $d) $v $((s / 16))"; done 19 done; done; done 20 echo "ret|ret" 21 for v in 0 1 -1 2 -2 12345 -12345 `33554431` -`33554432`; do echo "b $v|b.raw $v"; done 22 for c in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do for v in 0 1 -1 262143 -262144 1000 -1000; do echo "b_cond $c $v|b.c.raw $c $v"; done; done 23 for f in cbz cbnz; do for t in $R; do for v in 0 1 -1 262143 -262144 777; do 24 echo "$f 1 $t $v|$f.x.raw $(rx $t) $v"; echo "$f 0 $t $v|$f.w.raw $(rw $t) $v"; done; done; done 25 for f in ldr str; do for t in $R; do for n in $R; do for k in 0 1 8 4095; do 26 echo "${f}_uoff 1 $t $n $((k * 8))|$f.x $(rx $t) $(rs $n) $k"; echo "${f}_uoff 0 $t $n $((k * 4))|$f.w $(rw $t) $(rs $n) $k"; done; done; done; done 27 for f in ldrb strb; do for t in $R; do for n in $R; do for k in 0 1 100 4095; do echo "${f}_uoff $t $n $k|$f $(rw $t) $(rs $n) $k"; done; done; done; done 28 for t in $R; do for n in $R; do for v in -256 -1 0 1 255; do 29 echo "ldr_post $t $n $v|ldr.w.post $(rw $t) $(rs $n) $v"; echo "str_post $t $n $v|str.w.post $(rw $t) $(rs $n) $v" 30 echo "ldr_x_post $t $n $v|ldr.x.post $(rx $t) $(rs $n) $v"; echo "str_x_post $t $n $v|str.x.post $(rx $t) $(rs $n) $v" 31 done; done; done 32 for d in $R; do for n in $R; do for v in 0 1 4095; do 33 echo "subs_imm 1 $d $n $v|subs.x.i $(rx $d) $(rx $n) $v"; echo "subs_imm 0 $d $n $v|subs.w.i $(rw $d) $(rw $n) $v"; done; done; done