avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: [avr-gcc-list] dev and mod may not be optimized


From: Haase Bjoern (PT/EMM1)
Subject: AW: [avr-gcc-list] dev and mod may not be optimized
Date: Tue, 11 Dec 2007 15:15:43 +0100

The source of this problem is a deeply buried internal issue of the RTL 
handling within the compiler.

Description of the internal problem:

The expand pass generates strange RTL sequences refering to hard registers for 
the div and mod operations and uses specific insn RTL for calling the 
respective functions. This way the compiler does not need to save and restore 
all of the call-clobbered registers but only those that the functions alter.

Unfortunately div and mod could not be optimized this way because the combine 
and CSE passes do not operate on hard registers :-(.


Unfortunately there is no easy solution of this issue :-(.

Yours,

Bjoern. 

-----Ursprüngliche Nachricht-----
Von: address@hidden [mailto:address@hidden Im Auftrag von Nathan Moore
Gesendet: Montag, 10. Dezember 2007 23:02
An: address@hidden
Betreff: [avr-gcc-list] dev and mod may not be optimized

I appologize if I'm misunderstanding something about the code that is
being produced, but while auditing some code to try to make some code
smaller I noticed that __udivmodqi4 is being called twice to generate
code for:
 
        unsigned char a, b, c;
        c = some_input_function();
LABEL:
        a = c/10;
        b = c%10;
        ...

***************************************** 
LABEL:
        mov r24,r18
        ldi r22,lo8(10)
        call __udivmodqi4
        mov r19,r24
.LM436:
        mov r24,r18
        call __udivmodqi4

If I'm understanding __udivmodqi4 it produces the results of both of
these with one call.  
My compile command is:
avr-gcc -S -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall
-Wstrict-prototypes -Wa,-ahlms=gekv2c.lst -DETHERNUT2 -D__HARVARD_ARCH__
-gdwarf-2 -IC:/ethernut-4.4.0/nut/include file.c -o file.s

And as the -I tells, this is on Windows.  The GCC version is 3.4.6 .

I do not subscribe to this list, so please CC me on any replies.

Nathan Moore



_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list




reply via email to

[Prev in Thread] Current Thread [Next in Thread]