estdlib icon indicating copy to clipboard operation
estdlib copied to clipboard

Optimization: Verbose to_chars_opt (AVR Arduino)

Open malachib opened this issue 1 year ago • 0 comments

Unfavorable output on AVR, looks like it's dying for optimization

Output comes from embr Arduino bits test

Appears we are not calling specialized to_chars_opt but rather runtime loading integer base

    10c0:	83 70       	andi	r24, 0x03	; 3
    10c2:	82 30       	cpi	r24, 0x02	; 2
    10c4:	d1 f1       	breq	.+116    	; 0x113a <main+0x290>
    10c6:	83 30       	cpi	r24, 0x03	; 3
    10c8:	c1 f0       	breq	.+48     	; 0x10fa <main+0x250>
    10ca:	81 30       	cpi	r24, 0x01	; 1
    10cc:	21 f5       	brne	.+72     	; 0x1116 <main+0x26c>
    10ce:	0a e0       	ldi	r16, 0x0A	; 10
    10d0:	10 e0       	ldi	r17, 0x00	; 0
    10d2:	b3 01       	movw	r22, r6
    10d4:	ce 01       	movw	r24, r28
    10d6:	01 96       	adiw	r24, 0x01	; 1
    10d8:	0e 94 89 03 	call	0x712	; 0x712 <_ZN4estd12to_chars_optImEENS_9enable_ifIXsrNS_14numeric_limitsIT_EE10is_integerENS_6detail15to_chars_resultIPcEEE4typeES7_S7_S3_i>
    10dc:	cb 01       	movw	r24, r22
    10de:	1c 86       	std	Y+12, r1	; 0x0c
    10e0:	b3 01       	movw	r22, r6
    10e2:	15 c0       	rjmp	.+42     	; 0x110e <main+0x264>
    10e4:	20 e1       	ldi	r18, 0x10	; 16
    10e6:	30 e0       	ldi	r19, 0x00	; 0
    10e8:	b6 01       	movw	r22, r12
    10ea:	ce 01       	movw	r24, r28
    10ec:	01 96       	adiw	r24, 0x01	; 1
    10ee:	0e 94 db 03 	call	0x7b6	; 0x7b6 <_ZN4estd12to_chars_optIjEENS_9enable_ifIXsrNS_14numeric_limitsIT_EE10is_integerENS_6detail15to_chars_resultIPcEEE4typeES7_S7_S3_i>
    10f2:	cb 01       	movw	r24, r22
    10f4:	1e 82       	std	Y+6, r1	; 0x06
    10f6:	b6 01       	movw	r22, r12
    10f8:	c1 cf       	rjmp	.-126    	; 0x107c <main+0x1d2>
    10fa:	08 e0       	ldi	r16, 0x08	; 8
    10fc:	10 e0       	ldi	r17, 0x00	; 0
    10fe:	b4 01       	movw	r22, r8
    1100:	ce 01       	movw	r24, r28
    1102:	01 96       	adiw	r24, 0x01	; 1
    1104:	0e 94 89 03 	call	0x712	; 0x712 <_ZN4estd12to_chars_optImEENS_9enable_ifIXsrNS_14numeric_limitsIT_EE10is_integerENS_6detail15to_chars_resultIPcEEE4typeES7_S7_S3_i>
    1108:	cb 01       	movw	r24, r22
    110a:	1d 86       	std	Y+13, r1	; 0x0d
    110c:	b4 01       	movw	r22, r8
    110e:	68 1b       	sub	r22, r24
    1110:	79 0b       	sbc	r23, r25
    1112:	0e 94 3a 03 	call	0x674	; 0x674 

malachib avatar May 30 '24 15:05 malachib