80 likes | 327 Views
Logical instructions. And rd rs rt Nor rd rs rt Or rd rs rt Xor rd rs rt Andi rt rs Imm Ori rt rs Imm Xori rt rs Imm Careful: Immediate variants Zero-extend. How to invert each bit?. Nor fuction A B C 0 0 1 0 1 0 1 0 0 1 1 0. (One's complement) Nor rd rs $0
E N D
Logical instructions • And rd rs rt • Nor rd rs rt • Or rd rs rt • Xor rd rs rt • Andi rt rs Imm • Ori rt rs Imm • Xori rt rs Imm • Careful: Immediate variants Zero-extend
How to invert each bit? Nor fuction A B C 0 0 1 0 1 0 1 0 0 1 1 0 (One's complement) • Nor rd rs $0 • This is not! A 1 C=A' B=0
Shift instructions Logical shift left Logical shift right A B C D A B C D lost 0 lost 0 B C D 0 0 A B C
Shift instructions • Arithmetic shift right A B C D lost A A B C
Shift instructions • Sll rd rt expr Sra rd rt expr Srl rd rt expr • rd := rt shifted by expr (0..31) • Sllv rd rt rs Srav rd rt rs Srlv rd rt rs • rd := rt shifted by rs (variable)
Rotate instructions Rotate left Rotate right A B C D A B C D B C D A D A B C