From d63c44909bbd46bbb69a02061bf35e0c90af11f0 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 28 Mar 2020 20:41:59 +0000 Subject: [PATCH] add fixed-shift --- openpower/isa/fixedshift.mdwn | 236 ++++++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 openpower/isa/fixedshift.mdwn diff --git a/openpower/isa/fixedshift.mdwn b/openpower/isa/fixedshift.mdwn new file mode 100644 index 000000000..fd6adcd2c --- /dev/null +++ b/openpower/isa/fixedshift.mdwn @@ -0,0 +1,236 @@ +# Rotate Left Word Immediate then AND with Mask M-form + +rlwinm RA,RS,SH,MB,ME (Rc=0) + +rlwinm. RA,RS,SH,MB,ME (Rc=1) + + n <- SH + r <- ROTL32((RS)[32:63], n) + m <- MASK(MB+32, ME+32) + RA <- r & m + +# Rotate Left Word then AND with Mask + +rlwnm RA,RS,RB,MB,ME (Rc=0) + +rlwnm. RA,RS,RB,MB,ME (Rc=1) + + n <- (RB)[59:63] + r <- ROTL32((RS)[32:63], n) + m <- MASK(MB+32, ME+32) + RA <- r & m + +# Rotate Left Word Immediate then Mask Insert + +rlwimi RA,RS,SH,MB,ME (Rc=0) + +rlwimi. RA,RS,SH,MB,ME (Rc=1) + + n <- SH + r <- ROTL32((RS)[32:63], n) + m <- MASK(MB+32, ME+32) + RA <- r&m | (RA) & ¬m + +# Rotate Left Doubleword Immediate then Clear Left + +rldicl RA,RS,SH,MB (Rc=0) + +rldicl. RA,RS,SH,MB (Rc=1) + + n <- sh[5] || sh[0:4] + r <- ROTL64((RS), n) + b <- mb[5] || mb[0:4] + m <- MASK(b, 63) + RA <- r & m + +# Rotate Left Doubleword Immediate then Clear Right + +rldicr RA,RS,SH,ME (Rc=0) + +rldicr. RA,RS,SH,ME (Rc=1) + + n <- sh[5] || sh[0:4] + r <- ROTL64((RS), n) + e <- me[5] || me[0:4] + m <- MASK(0, e) + RA <- r & m + +# Rotate Left Doubleword Immediate then Clear + +rldic RA,RS,SH,MB (Rc=0) + +rldic. RA,RS,SH,MB (Rc=1) + + n <- sh[5] || sh[0:4] + r <- ROTL64((RS), n) + b <- mb[5] || mb[0:4] + m <- MASK(b, ¬n) + RA <- r & m + +# Rotate Left Doubleword then Clear Left + +rldcl RA,RS,RB,MB (Rc=0) + +rldcl. RA,RS,RB,MB (Rc=1) + + n <- (RB)[58:63] + r <- ROTL64((RS), n) + b <- mb[5] || mb[0:4] + m <- MASK(b, 63) + RA <- r & m + +# Rotate Left Doubleword then Clear Right + +rldcr RA,RS,RB,ME (Rc=0) + +rldcr. RA,RS,RB,ME (Rc=1) + + n <- (RB)[58:63] + r <- ROTL64((RS), n) + e <- me[5] || me[0:4] + m <- MASK(0, e) + RA <- r & m + +# Rotate Left Doubleword Immediate then Mask Insert + +rldimi RA,RS,SH,MB (Rc=0) + +rldimi. RA,RS,SH,MB (Rc=1) + + n <- sh[5] || sh[0:4] + r <- ROTL64((RS), n) + b <- mb[5] || mb[0:4] + m <- MASK(b, ¬n) + RA <- r&m | (RA)& ¬m + + +# Shift Left Word + +slw RA,RS,RB (Rc=0) + +slw. RA,RS,RB (Rc=1) + + n <- (RB)[59:63] + r <- ROTL32((RS)[32:63], n) + if (RB)58 = 0 then + m <- MASK(32, 63-n) + else m <- [0]*64 + RA <- r & m + + +# Shift Right Word + +srw RA,RS,RB (Rc=0) + +srw. RA,RS,RB (Rc=1) + + n <- (RB)[59:63] + r <- ROTL32((RS)[32:63], 64-n) + if (RB)58 = 0 then + m <- MASK(n+32, 63) + else m <- [0]*64 + RA <- r & m + +# Shift Right Algebraic Word Immediate + +srawi RA,RS,SH (Rc=0) + +srawi. RA,RS,SH (Rc=1) + + n <- SH + r <- ROTL32((RS)[32:63], 64-n) + m <- MASK(n+32, 63) + s <- (RS)[32] + RA <- r&m | ([s]*64)& ¬m + carry <- s & ((r&¬m)[32:63] != 0) + CA <- carry + CA32 <- carry + +# Shift Right Algebraic Word + +sraw RA,RS,RB (Rc=0) + +sraw. RA,RS,RB (Rc=1) + + n <- (RB)[59:63] + r <- ROTL32((RS)[32:63], 64-n) + if (RB)[58] = 0 then + m <- MASK(n+32, 63) + else m <- [0]*64 + s <- (RS)[32] + RA <- r&m | ([s]*64)& m¬ + carry <- s & ((r&¬m)[32:63] !=0) + CA <- carry + CA32 <- carry + +# Shift Left Doubleword + +sld RA,RS,RB (Rc=0) + +sld. RA,RS,RB (Rc=1) + + n <- (RB)[58:63] + r <- ROTL64((RS), n) + if (RB)[57] = 0 then + m <- MASK(0, 63-n) + else m <- [0]*64 + RA <- r & m + + +# Shift Right Doubleword + +srd RA,RS,RB (Rc=0) + +srd. RA,RS,RB (Rc=1) + + n <- (RB)[58:63] + r <- ROTL64((RS), 64-n) + if (RB)[57] = 0 then + m <- MASK(n, 63) + else m <- [0]*64 + RA <- r & m + +# Shift Right Algebraic Doubleword Immediate + +sradi RA,RS,SH (Rc=0) + +sradi. RA,RS,SH (Rc=1) + + n <- sh[5] || sh[0:4] + r <- ROTL64((RS), 64-n) + m <- MASK(n, 63) + s <- (RS)[0] + RA <- r&m | ([s]*64)& ¬m + carry <- s & ((r& ¬m) != 0) + CA <- carry + CA32 <- carry + + +# Shift Right Algebraic Doubleword + +srad RA,RS,RB (Rc=0) + +srad. RA,RS,RB (Rc=1) + + n <- (RB)[58:63] + r <- ROTL64((RS), 64-n) + if (RB)57 = 0 then + m <- MASK(n, 63) + else m <- [0]*64 + s <- (RS)0 + RA <- r&m | ([s]*64)& ¬m + carry <- s & ((r&¬m)!= 0) + CA <- carry + CA32 <- carry + +# Extend-Sign Word and Shift Left Immediate + +extswsli RA,RS,SH (Rc=0) + +extswsli. RA,RS,SH (Rc=1) + + n <- sh[5] || sh[0:4] + r <- ROTL64(EXTS64(RS[32:63]), n) + m <- MASK(0, 63-n) + RA <- r & m + -- 2.30.2