gdb: s390: Correct record/replay of may/mayr insn

Message ID 20241128134314.3604709-1-jremus@linux.ibm.com
State New
Headers
Series gdb: s390: Correct record/replay of may/mayr insn |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Jens Remus Nov. 28, 2024, 1:43 p.m. UTC
  The IBM z/Architecture Principles of Operation [1] specifies that the
R1 operand of the may and mayr instructions designates may designate
either the lower- or higher-numbered register of a floating-point-
register (FPR) pair.

[1]: IBM z/Architecture Principles of Operation, SA22-7832-13, IBM z16,
     https://publibfp.dhe.ibm.com/epubs/pdf/a227832d.pdf

gdb/
	* s390-tdep.c (s390_process_record): may/mayr operand R1 may
	designate lower- or higher numbered register of FPR pair.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
 gdb/s390-tdep.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
  

Patch

diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index be176f07c6f7..d4b9a2468809 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -4014,6 +4014,13 @@  s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
 	/* 0xb330-0xb335 undefined */
 
 	case 0xb33a: /* MAYR - multiply and add unnormalized */
+	  /* float pair destination [RRD]; R1 may designate lower- or
+	     higher-numbered register of pair */
+	  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[4] & 13)))
+	    return -1;
+	  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[4] | 2)))
+	    return -1;
+	  break;
 	case 0xb33b: /* MYR - multiply unnormalized */
 	  /* float pair destination [RRD] */
 	  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[4]))
@@ -6333,6 +6340,13 @@  s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
 	/* 0xed36 undefined */
 
 	case 0xed3a: /* MAY - multiply and add unnormalized */
+	  /* float pair destination [RXF]; R1 may designate lower- or
+	     higher-numbered register of pair */
+	  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[8] & 13)))
+	    return -1;
+	  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[8] | 2)))
+	    return -1;
+	  break;
 	case 0xed3b: /* MY - multiply unnormalized */
 	  /* float pair destination [RXF] */
 	  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[8]))