diff options
| author | hachem <im@hachem.wtf> | 2026-09-10 05:52:08 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-10 05:52:08 +0200 |
| commit | d50af2e474281a1e88d191f783c2792824698974 (patch) | |
| tree | 571afdff3ac141bbfcee37bc61dfdb6ea8fda163 /docs | |
| parent | bf157cf09b8b0888c54a165b887309a4e801f608 (diff) | |
feat: conditional select
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/language.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/language.md b/docs/language.md index a4743b3..ecdbf19 100644 --- a/docs/language.md +++ b/docs/language.md @@ -171,6 +171,12 @@ while .countdown rcx > 0 // emits `.countdown:` … `jmp .countdown` … `.c rcx -= 1 ``` +A **conditional select** picks one of two register values without a branch: `dst = a if <cond> else b`. It lowers to `csel` on AArch64 (one instruction) and `cmov` on x86 (a default move plus a conditional move, arranged so `dst` may safely alias either source). Both sources must be registers. + +```hdass +r3 = r1 if r1 > r2 else r2 // r3 = max(r1, r2), branchless +``` + ## Dereference (`^`) `^reg` is the memory at the address in `reg` — NASM's `[reg]`. On the left of `=` it stores there. The store width comes from the value operand, so a sized sub-register picks the size: |
