tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] Is this a duplicate ASM operation?


From: YX Hao
Subject: [Tinycc-devel] Is this a duplicate ASM operation?
Date: Sun, 18 Jan 2015 14:10:52 +0800


Hi there,
 
I found this while debugging app compliled by tcc (i386).
 
char  *mbc_s;
 
int16_t B2 = *((int16_t*)mbc_s);
 
----------
Use monospaced font please.
CPU Disasm
Address   Hex dump          Command                                  Comments
0040106F  |.  8B45 F8       MOV EAX,DWORD PTR SS:[LOCAL.2]           ; !
00401072  |.  0FBF08        MOVSX ECX,WORD PTR DS:[EAX]
00401075  |.  66:894D F0    MOV WORD PTR SS:[LOCAL.4],CX
00401079  |.  8B45 F8       MOV EAX,DWORD PTR SS:[LOCAL.2]           ; <== dup?
0040107C  |.  0FBF4D F0     MOVSX ECX,WORD PTR SS:[LOCAL.4]
00401080  |.  51            PUSH ECX                                 ; /<%d>
00401081  |.  0FBE08        MOVSX ECX,BYTE PTR DS:[EAX]              ; |
00401084  |.  51            PUSH ECX                                 ; |<%c>
00401085  |.  B8 28204000   MOV EAX,OFFSET 00402028                  ; |ASCII "%c:\t%d\n"
0040108A  |.  50            PUSH EAX                                 ; |format => "%c:\t%d\n"
0040108B  |.  E8 00020000   CALL <JMP.&msvcrt.printf>                ; \MSVCRT.printf
----------
 
I don't know much about ASM and how tcc translates c code into ASM. If the 2nd MOV is not necessary, can we optimize it in tcc?

reply via email to

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