Mail Archives: djgpp/1998/07/15/03:42:47
On Tue, 14 Jul 1998, Jedediah Smith wrote:
> I need to optimize a little inner loop in a 16 bit C prog and I want to
> use the 32 bit general purpose registers (EAX,EBX,ECX,EDX). I don't need
> to do any flat memory addressing or anything like that, just use those 4
> regs to temporarily store data and do arithmetic. I can stick the
> machine code into the C source using the _emit_ macro but I want to know
> what I have to do to the CPU state before I can use the registers.
Use the GCC inline assembly facilities. They allow you to explain to the
compiler which registers does your assembly fragment use, and the
compiler will then take care of saving and restoring these registers.
The inline assembly facilities are described in the GCC on-line docs.
From the DOS prompt, type this:
info gcc "C Extensions" "Extended Asm"
(note the quotes: they are important) and read there.
- Raw text -