GnoStiC
Member
first of all, sorry if this is already discussed before..
this is C version:
let's say i want to rewrite this in asm:
now,
can i write
instead of
and is it safe to assume that r0 (and r1) are always likely to be cloberred in a function call, so i don't need to put them on my "regs to be clobberred" list?
&
can i set a global clobber list?
this is C version:
Code:
/* BTST.L Dn,Dn */
unsigned long REGPARAM2 CPUFUNC(op_0100_0)(uae_u32 opcode, struct regstruct *regs)
{
uae_u32 srcreg = ((opcode >> 9) & 7);
uae_u32 dstreg = opcode & 7;
{{ uae_s32 src = m68k_dreg (regs, srcreg);
{ uae_s32 dst = m68k_dreg (regs, dstreg);
src &= 31;
SET_ZFLG (®s->ccrflags, 1 ^ ((dst >> src) & 1));
}}} m68k_incpc (regs, 2);
return 4 * 256;
}
let's say i want to rewrite this in asm:
Code:
unsigned long REGPARAM2 CPUFUNC(op_0100_0)(uae_u32 opcode, struct regstruct *regs)
{
// r0 = opcode
// r1 = *regs
asm volatile (
"mov r3, r0,lsr#9 \n\t"; r3 = r0 >> 9
"and r3, r3, #7 \n\t"; r3 & 7 (r3 = srcreg)
"and r0, r0, #7 \n\t"; r0 & 7 (r0 = dstreg)
"ldr r2, [r1,r3,lsl#2] \n\t"; r2 = (regs, srcreg) (r2 = src)
"ldr r3, [r1,r0,lsl#2] \n\t"; r3 = (regs, dstreg) (r3 = dst)
"and r2, r2, #0x1F \n\t"; r2 & 31
"ldr r0, [r1,#0x40] \n\t"; r0 = regs->crrflgs
"mov r3, r3,asr r2 \n\t"; r3 >> r2
"and r3, r3, #1 \n\t"; r3 & 1
...
now,
can i write
Code:
"mov r3, opcode,lsr#9 \n\t"; r3 = r0 >> 9
instead of
Code:
"mov r3, r0,lsr#9 \n\t"; r3 = r0 >> 9
and is it safe to assume that r0 (and r1) are always likely to be cloberred in a function call, so i don't need to put them on my "regs to be clobberred" list?
&
can i set a global clobber list?