arch-power: Fix move condition field instructions
authorSandipan Das <sandipan@linux.ibm.com>
Sat, 6 Feb 2021 11:52:19 +0000 (17:22 +0530)
committerSandipan Das <sandipan@linux.ibm.com>
Mon, 15 Feb 2021 08:32:38 +0000 (14:02 +0530)
This introduces the S field for X form instructions which
is used to specify signed versus unsigned comparison. The
Power ISA does not specify a formal name for the third
1-bit opcode field required for decoding XFX form move to
and from CR field instructions, the S field can be used
to achieve the same as it has the same span and position.
This fixes the following instructions.
  * Move To Condition Register Fields (mtcrf)
  * Move From Condition Register (mfcr)

Change-Id: I8d291f707cd063781f0497f7226bebfc47bd9e63
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
src/arch/power/isa/bitfields.isa
src/arch/power/isa/decoder.isa

index 3bfea530658533f6f3ffc7a586c2ee306554bc29..276242eae3fb81845857a2deaa87c630ecae4f36 100644 (file)
@@ -73,6 +73,7 @@ def bitfield SPR           <20:11>;
 
 // FXM field for mtcrf instruction
 def bitfield FXM           <19:12>;
+def bitfield S             <20>;
 
 // Branch fields
 def bitfield BO            <25:21>;
index 5f95834366cbcabd99e481281127828fb1dd055a..7f79d3c8801a1ae85d542efa976425b153d40221 100644 (file)
@@ -972,17 +972,21 @@ decode PO default Unknown::unknown() {
                             0x1f9: mttar({{ TAR = Rs; }});
                         }
 
-                        144: mtcrf({{
-                            uint32_t mask = 0;
-                            for (int i = 0; i < 8; ++i) {
-                                if (((FXM >> i) & 0x1) == 0x1) {
-                                    mask |= 0xf << (4 * i);
+                        144: decode S {
+                            0: mtcrf({{
+                                uint32_t mask = 0;
+                                for (int i = 0; i < 8; ++i) {
+                                    if ((FXM >> i) & 0x1) {
+                                        mask |= 0xf << (4 * i);
+                                    }
                                 }
-                            }
-                            CR = (Rs & mask) | (CR & ~mask);
-                        }});
+                                CR = (Rs & mask) | (CR & ~mask);
+                            }});
+                        }
 
-                        19: mfcr({{ Rt = CR; }});
+                        19: decode S {
+                            0: mfcr({{ Rt = CR; }});
+                        }
 
                         512: mcrxr({{
                             CR = insertCRField(CR, BF, XER<31:28>);