Skip to content

Commit 4d7ced0

Browse files
committed
RnD openDerivation/godbolt README: the side-by-side listings as one text block, not an HTML table
Viewers that do not render raw HTML showed the <table> markup as text. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PttWicEZBc92PTtygV18zb
1 parent a0c9db7 commit 4d7ced0

1 file changed

Lines changed: 30 additions & 67 deletions

File tree

‎.RnD/openDerivation/godbolt/README.md‎

Lines changed: 30 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -15,76 +15,39 @@ it is not a comparison with anything outside HAPI.
1515

1616
Both compiled as C++ with AVR gcc 7.3.0, `-std=c++17 -Os -mmcu=atmega328p`. `verify.sh` produced these listings (`verify.log`).
1717

18-
<table>
19-
<tr><th>HAPI (<code>wave4_apiof.cpp</code>): 28 instructions, 56 B</th><th>plain C (<code>wave4_c.c</code>): 27 instructions, 54 B</th></tr>
20-
<tr><td>
21-
22-
```asm
23-
movw r30, r24
24-
ldd r25, Z+3 ; x[3]
25-
mov r24, r25 ; <- the extra instruction
26-
adc r24, r24
27-
eor r24, r24
28-
adc r24, r24 ; x[3] >> 7
29-
ldd r25, Z+2 ; x[2]
30-
lsr r25
18+
```text
19+
HAPI (wave4_apiof.cpp): 28 instructions, 56 B plain C (wave4_c.c): 27 instructions, 54 B
20+
--------------------------------------------- ------------------------------------------
21+
movw r30, r24 movw r30, r24
22+
ldd r25, Z+3 ; x[3] ldd r25, Z+2 ; x[2]
23+
mov r24, r25 ; <- the extra instruction lsr r25
24+
adc r24, r24 lsr r25 ; x[2] >> 2
25+
eor r24, r24 ldd r24, Z+3 ; x[3]
26+
adc r24, r24 ; x[3] >> 7 adc r24, r24
27+
ldd r25, Z+2 ; x[2] eor r24, r24
28+
lsr r25 adc r24, r24 ; x[3] >> 7
3129
lsr r25 ; x[2] >> 2
32-
add r25, r24
33-
subi r25, 0x51 ; + 175
34-
ld r18, Z ; x[0]
35-
lsr r18
36-
lsr r18
37-
subi r18, 0x92 ; + 110
38-
andi r18, 0xBA
39-
add r25, r18
40-
ldd r24, Z+1 ; x[1]
41-
lsr r24
42-
lsr r24
43-
subi r24, 0xB0 ; + 80
44-
andi r24, 0xBF
45-
add r24, r25
46-
com r24
47-
adc r24, r24
48-
eor r24, r24
49-
adc r24, r24 ; sum < 128
50-
ret
30+
add r25, r24 add r25, r24
31+
subi r25, 0x51 ; + 175 subi r25, 0x51 ; + 175
32+
ld r18, Z ; x[0] ld r18, Z ; x[0]
33+
lsr r18 lsr r18
34+
lsr r18 lsr r18
35+
subi r18, 0x92 ; + 110 subi r18, 0x92 ; + 110
36+
andi r18, 0xBA andi r18, 0xBA
37+
add r25, r18 add r25, r18
38+
ldd r24, Z+1 ; x[1] ldd r24, Z+1 ; x[1]
39+
lsr r24 lsr r24
40+
lsr r24 lsr r24
41+
subi r24, 0xB0 ; + 80 subi r24, 0xB0 ; + 80
42+
andi r24, 0xBF andi r24, 0xBF
43+
add r24, r25 add r24, r25
44+
com r24 com r24
45+
adc r24, r24 adc r24, r24
46+
eor r24, r24 eor r24, r24
47+
adc r24, r24 ; sum < 128 adc r24, r24 ; sum < 128
48+
ret ret
5149
```
5250

53-
</td><td>
54-
55-
```asm
56-
movw r30, r24
57-
ldd r25, Z+2 ; x[2]
58-
lsr r25
59-
lsr r25 ; x[2] >> 2
60-
ldd r24, Z+3 ; x[3]
61-
adc r24, r24
62-
eor r24, r24
63-
adc r24, r24 ; x[3] >> 7
64-
add r25, r24
65-
subi r25, 0x51 ; + 175
66-
ld r18, Z ; x[0]
67-
lsr r18
68-
lsr r18
69-
subi r18, 0x92 ; + 110
70-
andi r18, 0xBA
71-
add r25, r18
72-
ldd r24, Z+1 ; x[1]
73-
lsr r24
74-
lsr r24
75-
subi r24, 0xB0 ; + 80
76-
andi r24, 0xBF
77-
add r24, r25
78-
com r24
79-
adc r24, r24
80-
eor r24, r24
81-
adc r24, r24 ; sum < 128
82-
ret
83-
```
84-
85-
</td></tr>
86-
</table>
87-
8851
What this shows, and what it does not:
8952

9053
- **The same computation.** Both do the same loads, shifts, adds and masks, with the same constants. Neither has a call, a

0 commit comments

Comments
 (0)