Assembly MIPS如何编写测试程序来测试宏?

Assembly MIPS如何编写测试程序来测试宏?,assembly,macros,bit-manipulation,mips,Assembly,Macros,Bit Manipulation,Mips,我正在使用宏来提取第n位。我想知道如何传递值并测试这个宏 .macro extract_nth_bit($regD, $regS, $regT) srl $regS, $regS, $regT and $regD, $regS, 1 # regD contains bit position ( will contain 0x0 or 0x1 depending on nth bit being 0 or 1 # regS is the bit pattern ( source bit patte

我正在使用宏来提取第n位。我想知道如何传递值并测试这个宏

.macro extract_nth_bit($regD, $regS, $regT)
srl $regS, $regS, $regT
and $regD, $regS, 1
# regD contains bit position ( will contain 0x0 or 0x1 depending on nth bit being 0 or 1
# regS is the bit pattern ( source bit pattern )
# regT will be 0x0 or 0x1 ( bit position n (0-31)
.end_macro

如果
$regT
是一个常量(例如,您使用
提取第n位($t0,$t1,1)
调用),则
srl
是正确的。如果是寄存器(例如,
extract\n位($t0,$t1,$t2)
),则需要使用
srlv
instead@CraigEstey. 我懂了。谢谢你的指点!如果
$regT
是一个常量(例如,您使用
提取第n位($t0,$t1,1)
调用),则
srl
是正确的。如果是寄存器(例如,
extract\n位($t0,$t1,$t2)
),则需要使用
srlv
instead@CraigEstey. 我懂了。谢谢你的指点!