add a MASK32 function which offsets by 32 on the inputs
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 23 Apr 2021 16:47:24 +0000 (17:47 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 23 Apr 2021 16:47:24 +0000 (17:47 +0100)
also fix ROTL32 so it selects value from its input

src/openpower/decoder/helpers.py
src/openpower/decoder/pseudo/pywriter.py

index c8d0044d68caadb73e781d603fcc260bf5bb99f9..70e05d9716fc503cc5a2e9a20d9c046d9ac85990 100644 (file)
@@ -78,10 +78,18 @@ def ROTL64(value, bits):
 
 
 def ROTL32(value, bits):
+    if isinstance(bits, SelectableInt):
+        bits = bits.value
     if isinstance(value, SelectableInt):
         value = SelectableInt(value.value, 64)
     return rotl(value | (value << 32), bits, 64)
 
+def MASK32(x, y):
+    if isinstance(x, SelectableInt):
+        x = x.value
+    if isinstance(y, SelectableInt):
+        y = y.value
+    return MASK(x+32, y+32)
 
 def MASK(x, y):
     if isinstance(x, SelectableInt):
index d2b6882af7faf0b7e3685999ca14422970c09afa..b61d7bf23e5a77b50f21aa2c7cd75592cc60e42d 100644 (file)
@@ -21,7 +21,8 @@ header = """\
 
 from openpower.decoder.isa.caller import inject, instruction_info
 from openpower.decoder.helpers import (EXTS, EXTS64, EXTZ64, ROTL64, ROTL32,
-                                 MASK, ne, eq, gt, ge, lt, le, ltu, gtu, length,
+                                 MASK, MASK32,
+                                 ne, eq, gt, ge, lt, le, ltu, gtu, length,
                                  trunc_divs, trunc_rems, MULS, DIVS, MODS,
                                  EXTS128, undefined)
 from openpower.decoder.selectable_int import SelectableInt