Subject: there _is_ a problem with gcc-3.3.3
To: None <port-mips@netbsd.org, tech-toolchain@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: port-mips
Date: 03/04/2004 21:58:16
Hi -
on mipsel, I've found a case where gcc without options produces
bad code, and "gcc -O2" does well:
A signal handler:
void
sigfpe(int s, siginfo_t *si, void *c)
{
int code = si->si_code;
printf("caught code %x\n", code);
signal_caught = 1;
exit (0);
}
gets translated without gcc flags to:
sigfpe:
.frame $fp,48,$31 # vars= 8, regs= 3/0, args= 16, extra=
8
.mask 0xd0000000,-8
.fmask 0x00000000,0
.set noreorder
.cpload $25
.set reorder
subu $sp,$sp,48
.cprestore 16
sw $31,40($sp)
sw $fp,36($sp)
sw $28,32($sp)
move $fp,$sp
sw $4,48($fp)
sw $5,52($fp)
sw $6,56($fp)
lw $2,52($fp)
lw $2,4($2)
sw $2,24($fp)
la $4,$LC10
lw $5,24($fp)
la $25,printf
jal $31,$25
li $2,1 # 0x1
[...],
with -O2 this is:
sigfpe:
.frame $sp,32,$31 # vars= 0, regs= 2/0, args= 16, extra=
8
.mask 0x90000000,-4
.fmask 0x00000000,0
.set noreorder
.cpload $25
.set reorder
subu $sp,$sp,32
.cprestore 16
sw $31,28($sp)
sw $28,24($sp)
lw $5,4($5)
la $4,$LC10
la $25,printf
jal $31,$25
li $2,1 # 0x1
[...]
best regards
Matthias