35.3.9.5. INTEGER BITS AND BITS STRINGS ON POWER PC



0..5	opcode1
6..10	S
11..15	A
16..20	0s
21.30	opcode2
31	Rc


			Rc		opcode
cntlzw	rA,rS		0		31.26	Count Leading Zeroes Word
cntlzw.	rA,rS		1

		n <- 0
		do while n < 32
			if rS[n] = 1 then leave
			n <- n + 1
		enddo
		rA <- n


0..5	opcode1
6..10	S
11..15	A
16..20	SH		B
21..25	MB
26..30	ME
31	Rc

				Rc	opcode	
rlwimi	rA,rS,SH,MB,ME		0	20	Rotate Left Word Immediate	
rlwimi.	rA,rS,SH,MB,ME		1		then Mask Insert

	n <- SH
	r <- ROTL(rS,n)
	m <- MASK(MB,ME)
	rA <- (r AND m) OR (rA AND (NOT m))


rlwinm	rA,rS,SH,MB,ME		0	21	Rotate Left Word Immediate	
rlwinm.	rA,rS,SH,MB,ME		1		then AND with Mask 
		
	n <- SH
	r <- ROTL(rS,n)
	m <- MASK(MB,ME)
	rA <- r AND m


rlwnm	rA,rS,rB,MB,ME		0	23	Rotate Left Word then AND
rlwnm.	rA,rS,rB,MB,ME		1		with Mask


	n <- rB[27..31]
	r <- ROTL(rS,n)
	m <- MASK(MB,ME)
	rA <- r AND m


// ----------------------------------------------------------------------


Index Prev Next