C bootstrap (phases 0-9):
cmd/wwc, cmd/6c, cmd/6a, cmd/6l, cmd/ww, rt, lib/*.
ww-side self-host (phase 10):
selfhost/cmd/wwc — ww-cgen frontend; bootstrap fixed point.
selfhost/cmd/6a — assembler; byte-identical to C 6a (test 991).
selfhost/cmd/6l — linker w/ archive (.a) support; byte-identical
to C 6l (test 992).
selfhost/cmd/ww — driver (build/run/version); byte-identical to
C ww (test 993).
make test: 15/15. make bootstrap: ww2.s == ww3.s, ww2.o == ww3.o,
ww2 == ww3 byte-identical, with the full ww-tooled chain.
28 lines
620 B
ArmAsm
28 lines
620 B
ArmAsm
// rt/streq.s — string equality at the runtime layer.
|
|
//
|
|
// Called from cgen for `a == b` / `a != b` when both operands are str.
|
|
// SysV ABI: a.ptr in DI, a.len in SI, b.ptr in DX, b.len in CX.
|
|
// Returns 1 in AX if equal, 0 otherwise. Caller flips for !=.
|
|
|
|
TEXT rt_streq,$0
|
|
CMPQ CX, SI // lengths must match
|
|
JNE rt_streq_no
|
|
// SI now holds the (shared) length; iterate while SI > 0
|
|
rt_streq_loop:
|
|
CMPQ $0, SI
|
|
JE rt_streq_yes
|
|
MOVZBQ (DI), AX
|
|
MOVZBQ (DX), R8
|
|
CMPQ R8, AX
|
|
JNE rt_streq_no
|
|
ADDQ $1, DI
|
|
ADDQ $1, DX
|
|
SUBQ $1, SI
|
|
JMP rt_streq_loop
|
|
rt_streq_yes:
|
|
MOVQ $1, AX
|
|
RET
|
|
rt_streq_no:
|
|
MOVQ $0, AX
|
|
RET
|