Hi,
We are trying to determine minimal method to profile using TSC register. Using _itoll() is affecting the code we're trying to profile -- it substantially increases cycle count. So now we're using inline asm code shown below:
__asm(" STDW B1:B0, *--SP(128)"); /* save B1:B0 on stack */
__asm(" STW A0, *--SP(16)"); /* save A0 on stack */
__asm(" BNOP TSC_Read_Done, 1");
__asm(" MVC TSCL, B0");
__asm(" MVC TSCH, B1");
__asm(" MVKL conv_fx_profile_begin, A0");
__asm(" MVKH conv_fx_profile_begin, A0");
__asm("TSC_Read_Done:");
__asm(" STDW B1:B0, *A0");
__asm(" NOP 5");
__asm(" LDW *SP++(16), A0"); /* restore A0 from stack */
__asm(" LDDW *SP++(128), B1:B0"); /* restore B1:B0 from stack */
:
: code to profile
:
__asm(" STDW B1:B0, *--SP(128)"); /* save B1:B0 on stack */
__asm(" STW A0, *--SP(16)"); /* save A0 on stack */
__asm(" BNOP TSC_Read_Done2, 1");
__asm(" MVC TSCL, B0");
__asm(" MVC TSCH, B1");
__asm(" MVKL conv_fx_profile, A0");
__asm(" MVKH conv_fx_profile, A0");
__asm("TSC_Read_Done2:");
__asm(" STDW B1:B0, *A0");
__asm(" NOP 5");
__asm(" LDW *SP++(16), A0"); /* restore A0 from stack */
__asm(" LDDW *SP++(128), B1:B0"); /* restore B1:B0 from stack */
conv_fx_profile = conv_fx_profile - conv_fx_profile_begin;
conv_fx_total_cycles+=conv_fx_profile;
This mostly works well, but in some functions I have a crash. What is the correct way to save A0, B0, and B1 on the stack ?
Alternatively, is there another method ? The objective is the least amount of impact on the code being measured, for example if the function is inlined then I don't want another function call.
-- Thanks! Regards, Sarvani Chadalapaka HPC Systems Engineer Signalogic Inc.