This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi I know little about using constraints with asm statements and so would like some clarification. With egcs-1.1b I now get bad code generated. This did not happen with egcs-1.0.2. The code is C++. I use the following macro to access an 8bit device : #define WRITE_REGISTER_8(addr, data) \ asm volatile (" move.b %0,%1@ " : : "g" (data), "a" (addr)) The target is a cpu32 (68360) and the compiler is egcs-1.1b. The bad code is : tsi_cmds.s: Assembler messages: tsi_cmds.s:1117: Error: operands mismatch -- statement `move.b %a6,%a1@' ignored Can the 'g' constraint be used like this or is this some sort problem with the compiler which I should report to the egcs people ? I know I can use 'd' instead of 'g', how-ever 'd' generates register pressure when doing the following types of operations : WRITE_REGISTER_8(0xf000000, 1); WRITE_REGISTER_8(0xf000001, 2); WRITE_REGISTER_8(0xf000002, 3); The code is slower due to the need to load a 'd' register. The required pushing and poping from the stack on entry and exit to a function to free the 'd' registers slows the code even more. The 'g' constraint drops the overhead to about 2 instructions. -- Chris Johns Networks, Plessey Asia Pacfic Pty. Ltd. mailto:ccj@acm.org mailto:cjohns@plessey.com.au ________________________________________________ To get help for the crossgcc list, send mail to crossgcc-request@cygnus.com with the text 'help' (without the quotes) in the body of the message.