作者wheels ()
看板Grad-ProbAsk
標題Re: [理工] 計組
時間Tue Jan 31 17:00:00 2012
※ 引述《Byzantin (拜占庭)》之銘言:
: Suppose that all of conditional branch instructions except
: beq and bne were removed from MIPS instruction set along with
: slt and all of its variants.
: Show how to perform
: slt $t0,$s0,$s1
我的答案,再改一次XD
可以參考一下:)
sub $t3, $s0, $s1
sll $t4, $t3, 1
srl $t4, $t4, 1
xor $t2, $t3, t4
add $t0, $zero, $zero
beq $t2, $zero, NOT_SET
addi $t0, $t0, 1
NOT_SET:add $t0, $t0, $zero
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.30.141
※ 編輯: wheels 來自: 140.112.30.141 (01/31 17:11)
→ wheels:推文的比較好。 01/31 17:15
→ metalalive:請教先 sll再srl的理由是? 3q @O@ 01/31 17:20
→ wheels:為了讓MSB變0,MSB以外的位置不變,所以XOR完必定是0。 01/31 17:22
→ wheels:這樣可以抓出相減完的sign。 01/31 17:23