MPC: Inline assembly info

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MPC: Inline assembly info

3,303件の閲覧回数
MGotcha
Contributor I
I am using CW v8.6 for PPC, and am attempting to use the inline assy feature to simplify some lower level stuff from 'C', but there does not seem to be any documentation on this in the 'C' or 'C++' ref manual as stated in Assembler Reference Manual. In particular, I need to use a command like "lbz rD,d(rA)" where rD and rA are 'C' register types, and 'd' is a constant. I can use "lbzx rD,rA,rB" OK by simply calling out "asm(lbzx vara,varb,varc)" but I do not know how to handle the immediate field 'd' with the "lbz rD,d(rA)" command. Thanks for any guidance!

Message Edited by CrasyCat on 2007-04-13 11:40 AM

ラベル(1)
タグ(1)
0 件の賞賛
返信
2 返答(返信)

978件の閲覧回数
MGotcha
Contributor I
I could not find a section in the "Targeting Embedded PowerPC" manual, but the example you gave does work, and I had thought I tried this before without success after refering to some other info on GCC inline asm extensions. Anyway, problem solved! Thanks!
0 件の賞賛
返信

978件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
Did you have a look into the "Working With the Inline Assembler" chapter of the Targeting_Embedded_PowerPC.pdf manual?

Anyway, not sure what the problem is you try to solve, the following code builds fine for me:

static int test(register int reg_b)
{
 register int reg_a;
 __asm(lbz reg_a,1(reg_b));
 return reg_a;
}


Daniel
0 件の賞賛
返信