From 8976b9bf14aab4e7bff0eabfa1412744ed0fe832 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 29 Aug 2020 19:28:40 +0100 Subject: [PATCH] alternative mfocrf / mtocrf pseudocode --- openpower/isa/sprset.mdwn | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/openpower/isa/sprset.mdwn b/openpower/isa/sprset.mdwn index 445bb3644..00af71f59 100644 --- a/openpower/isa/sprset.mdwn +++ b/openpower/isa/sprset.mdwn @@ -64,14 +64,11 @@ XFX-Form Pseudo-code: - count <- 0 - do i = 0 to 7 + n <- 7 + do i = 7 to 0 if FXM[i] = 1 then n <- i - count <- count + 1 - if count = 1 then - CR[4*n+32:4*n+35] <- (RS)[4*n+32:4*n+35] - else CR <- undefined + CR[4*n+32:4*n+35] <- (RS)[4*n+32:4*n+35] Special Registers Altered: @@ -85,9 +82,9 @@ XFX-Form Pseudo-code: - mask <- ([FXM[0]]*4 || [FXM[1]]*4 || [FXM[2]]*4 || [FXM[3]]*4 || - [FXM[4]]*4 || [FXM[5]]*4 || [FXM[6]]*4 || [FXM[7]]*4) - CR <- ((RS)[32:63] & mask) | (CR & ¬mask) + do n = 0 to 7 + if FXM[n] = 1 then + CR[4*n+32:4*n+35] <- (RS)[4*n+32:4*n+35] Special Registers Altered: @@ -101,15 +98,12 @@ XFX-Form Pseudo-code: - RT <- undefined - count <- 0 - do i = 0 to 7 - if FXM[i] = 1 then - n <- i - count <- count + 1 - if count = 1 then - RT <- [0]*64 - RT[4*n+32:4*n+35] <- CR[4*n+32:4* n+35] + done <- 0 + RT <- [0]*64 + do n = 0 to 7 + if (done = 0) & (FXM[n] = 1) then + RT[4*n+32:4*n+35] <- CR[4*n+32:4*n+35] + done <- 1 Special Registers Altered: -- 2.30.2