adjusted popcntw to simplify by using temp vars
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 31 Aug 2021 11:19:49 +0000 (12:19 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 31 Aug 2021 11:19:49 +0000 (12:19 +0100)
https://bugs.libre-soc.org/show_bug.cgi?id=671#c50
e <- (XLEN/2)-1
s <- i*XLEN/2

openpower/isa/fixedlogical.mdwn

index c301678c1059521788426385979d41f8e7caf9de..3ab769d5f3b67f897141fae1c0f4e72fb8189bad 100644 (file)
@@ -333,12 +333,14 @@ X-Form
 
 Pseudo-code:
 
+    e <- (XLEN/2)-1
     do i = 0 to 1
+       s <- i*XLEN/2
        n <-  0
-       do j = 0 to ((XLEN/2)-1)
-          if (RS)[(i*(XLEN/2))+j] = 1 then
+       do j = 0 to e
+          if (RS)[s+j] = 1 then
               n <- n+1
-       RA[(i*(XLEN/2)):(i*(XLEN/2))+((XLEN/2)-1)] <- n
+       RA[s:s+e] <- n
 
 Special Registers Altered: