we aim to self make a FPU which has its own instruction set. For easy
programming, we prefer c language to assembly code.
here's one of our instruction:
c language format: Bload(vd, value1, value2), we make it like a
funciton. vd is a special register.
binary format: 31-26 opcode, 25-21 index of vd register, 20-16 opcode,
15-11 index of the general register which keeps value1, 10-5 opcode, 4-0
index of the general register which keeps value2.
we use gcc-inline-assembly to convert it to binary code. here's the
#define Bload(vd, value1, value2) \
"add r16, r0, %0 \n\t" \
"add r14, r0, %1 \n\t" \
".long %2 \n\t" \
: "r"(value2), "r"(value1),
: "r14", "r16");
i fix the general registers(r14, r16) which keep value1 and value2. then
i make the binary code use "i" in inline-assembly. But disadvantage is
in evidence: gcc does not understand my instruction, so i can not take
it's advantage, such as selecting the most suitable general register and
eliminating unnecessary copy from register to register.
what i want is deleting the first two add instruction, let gcc select
register for me and tell me which register it selected. so i can make my
own binary code using .long instruction. But i do not want to modify the
gcc compiler to let it understand my instruction.
Thank you for your help