Skip to contentSkip to conversation

How to print value of float instruction argument

Qemu-devel Programmingkid 2 participants 3 messages Oct 31, 2016 – Nov 2, 2016

lore
Share & tools
lore
#0 lore raw

I'm trying to print the value of the arguments sent to gen_fmadds() in target-ppc/translate/fp-impl.inc.c. How do I do this? I have tried printf("cpu_fpr[rA(ctx->opcode)] = %d\n", cpu_fpr[rA(ctx->opcode)]), but that always prints the same value of 138 even if I change the values sent to fmadds.

#1 lore raw
Quoted 5 lines · Programmingkid

I'm trying to print the value of the arguments sent to gen_fmadds() in target-ppc/translate/fp-impl.inc.c. How do I do this? I have tried printf("cpu_fpr[rA(ctx->opcode)] = %d\n", cpu_fpr[rA(ctx->opcode)]), but that always prints the same value of 138 even if I change the values sent to fmadds.

At translate time we do not know the values in registers:
those are only available at runtime. The cpu_fpr[] values are TCGv_i64 which are opaque datatypes (and just track that FP register 5 is a unique thing that's not the same as FP register 6, and so on).

For runtime information you need to turn on the -d tracing with suitable flags for what you care about. Where generated code calls a helper function you can put a breakpoint or tracing in the helper to show the arguments it prints, because the helper is called at runtime, not translate time.

thanks
-- PMM

#2 lore raw
Quoted 20 lines · Peter Maydell
Quoted 5 lines · Programmingkid

I'm trying to print the value of the arguments sent to gen_fmadds() in target-ppc/translate/fp-impl.inc.c. How do I do this? I have tried printf("cpu_fpr[rA(ctx->opcode)] = %d\n", cpu_fpr[rA(ctx->opcode)]), but that always prints the same value of 138 even if I change the values sent to fmadds.

At translate time we do not know the values in registers:
those are only available at runtime. The cpu_fpr[] values are TCGv_i64 which are opaque datatypes (and just track that FP register 5 is a unique thing that's not the same as FP register 6, and so on).

For runtime information you need to turn on the -d tracing with suitable flags for what you care about. Where generated code calls a helper function you can put a breakpoint or tracing in the helper to show the arguments it prints, because the helper is called at runtime, not translate time.

Quoted 2 lines

thanks
-- PMM

Thank you very much for your help. I guess I should explain what I want. The C99 standard defines functions that are IEEE 754 complaint. I'm hoping to replace QEMU's fmadd implementation (for the PowerPC) with the fma() function. The fma() function does the exact same thing that fmadd does. I just don't know where exactly I can access the values being sent to the emulated fmadd instruction. Would you have a suggestion as to where I can place the fma() function?