This commit is contained in:
Darin Minamoto 2026-04-20 10:49:06 +00:00 committed by GitHub
commit 80cc8ccccc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View file

@ -20,9 +20,9 @@ FindOldestPerson:
b 10f // enter loop
1: ldr w5, [x3, p.age] // fetch loop ptr -> age
cmp w2, w5 // compare to oldest_age
csel w2, w2, w5, gt // update based on cmp
csel x0, x0, x3, gt // update based on cmp
cmp w5, w2 // compare to oldest_age
csel w2, w5, w2, gt // update based on cmp
csel x0, x3, x0, gt // update based on cmp
add x3, x3, 24 // increment loop ptr
10: cmp x3, x4 // has loop ptr reached end_ptr?
blt 1b // no, not yet

View file

@ -503,9 +503,9 @@ FindOldestPerson: // 13
b 10f // enter loop // 20
// 21
1: ldr w5, [x3, p.age] // fetch loop ptr -> age // 22
cmp w2, w5 // compare to oldest_age // 23
csel w2, w2, w5, gt // update based on cmp // 24
csel x0, x0, x3, gt // update based on cmp // 25
cmp w5, w2 // compare to oldest_age // 23
csel w2, w5, w2, gt // update based on cmp // 24
csel x0, x3, x0, gt // update based on cmp // 25
add x3, x3, 24 // increment loop ptr // 26
10: cmp x3, x4 // has loop ptr reached end_ptr? // 27
blt 1b // no, not yet // 28
@ -670,15 +670,15 @@ resulted in a less than zero, zero, or more than zero result.
`Lines 24` and `25` read:
```asm
csel w2, w2, w5, gt // update based on cmp // 24
csel x0, x0, x3, gt // update based on cmp // 25
csel w2, w5, w2, gt // update based on cmp // 24
csel x0, x3, x0, gt // update based on cmp // 25
```
These are identical to this:
```c
w2 = (w5 > w2) ? w5 : w2;
x0 = (x5 > x2) ? x3 : x0;
x0 = (w5 > w2) ? x3 : x0;
```
**Remember that the condition or status bits have already been set based

Binary file not shown.