use widths.get(dw/sw) and test empty/non-empty after.
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 18 Sep 2022 21:08:04 +0000 (22:08 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 18 Sep 2022 21:08:04 +0000 (22:08 +0100)
src/openpower/decoder/power_insn.py

index 065eec98499daefcf15f7ea9c1e81ebb533c146b..d9707060f749f6fef8b485648304c152b47a9102 100644 (file)
@@ -1415,20 +1415,20 @@ class NormalLDSTBaseRM(BaseRM):
             sw = predicates.get((mmode, smask))
             dw = predicates.get((mmode, dmask))
             if sw:
-                yield f"sm={sw}"
+                yield "sm="+sw
             if dw:
-                yield f"dm={dw}"
+                yield "dm="+dw
 
         # elwidths: use "w=" if same otherwise dw/sw
-        dw = int(self.elwidth)
-        sw = int(self.ewsrc)
-        if all((dw, sw)) and (dw == sw):
-            yield f"w={widths[dw]}"
+        dws = widths.get(int(self.elwidth))
+        sws = widths.get(int(self.ewsrc))
+        if dws == sws and dws:
+            yield "w="+dws
         else:
-            if dw != 0b00:
-                yield f"dw={widths[dw]}"
-            if sw != 0b00:
-                yield f"sw={widths[sw]}"
+            if dws:
+                yield "dw="+dws
+            if sws:
+                yield "sw="+sws
 
         yield from super().specifiers(record=record)