From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50703 invoked by alias); 20 Sep 2016 07:34:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 50686 invoked by uid 89); 20 Sep 2016 07:34:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 spammy=Rolling, Touch, Quad, Deliver X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Sep 2016 07:34:03 +0000 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8K7X855026773 for ; Tue, 20 Sep 2016 03:34:01 -0400 Received: from e24smtp03.br.ibm.com (e24smtp03.br.ibm.com [32.104.18.24]) by mx0b-001b2d01.pphosted.com with ESMTP id 25jpd2pjg9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 20 Sep 2016 03:34:01 -0400 Received: from localhost by e24smtp03.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Sep 2016 04:33:59 -0300 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp03.br.ibm.com (10.172.0.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 20 Sep 2016 04:33:57 -0300 Received: from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 0A27F1DC0054 for ; Tue, 20 Sep 2016 03:33:57 -0400 (EDT) Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay01.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u8K7XuBm4759670 for ; Tue, 20 Sep 2016 04:33:56 -0300 Received: from d24av05.br.ibm.com (localhost [127.0.0.1]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u8K7XunQ014681 for ; Tue, 20 Sep 2016 04:33:56 -0300 Received: from dawn.ibm.com ([9.78.140.72]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u8K7Xuxo014678; Tue, 20 Sep 2016 04:33:56 -0300 From: Edjunior Barbosa Machado To: gdb-patches@sourceware.org Cc: Edjunior Barbosa Machado , Ulrich Weigand Subject: [PATCH V2] ppc: Add Power ISA 3.0/POWER9 instructions record support Date: Tue, 20 Sep 2016 08:04:00 -0000 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16092007-0024-0000-0000-0000010AEAB0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16092007-0025-0000-0000-000015B9A18D Message-ID: <1473954198-27020-1-git-send-email-emachado@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-20_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609200096 X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00215.txt.bz2 Message-ID: <20160920080400.N8IhCM42MXM60qAv0z_sLAPSVfegNDqbvBHQHJKskbY@z> Hi, this is a new version of the patch including recent updates from final Power ISA 3.0 documentation. Thanks, -- Edjunior 2016-09-20 Edjunior Barbosa Machado * rs6000-tdep.c (PPC_DQ): New macro. (ppc_process_record_op4): Add Power ISA 3.0 instructions. (ppc_process_record_op19): Likewise. (ppc_process_record_op31): Likewise. (ppc_process_record_op59): Likewise. (ppc_process_record_op60): Likewise. (ppc_process_record_op63): Likewise. (ppc_process_record): Likewise. (ppc_process_record_op61): New function. --- gdb/rs6000-tdep.c | 470 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 457 insertions(+), 13 deletions(-) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 5f15780..c35a60f 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -3817,6 +3817,7 @@ bfd_uses_spe_extensions (bfd *abfd) #define PPC_T(insn) PPC_FIELD (insn, 6, 5) #define PPC_D(insn) PPC_SEXT (PPC_FIELD (insn, 16, 16), 16) #define PPC_DS(insn) PPC_SEXT (PPC_FIELD (insn, 16, 14), 14) +#define PPC_DQ(insn) PPC_SEXT (PPC_FIELD (insn, 16, 12), 12) #define PPC_BIT(insn,n) ((insn & (1 << (31 - (n)))) ? 1 : 0) #define PPC_OE(insn) PPC_BIT (insn, 21) #define PPC_RC(insn) PPC_BIT (insn, 31) @@ -3864,6 +3865,7 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache, { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int ext = PPC_FIELD (insn, 21, 11); + int vra = PPC_FIELD (insn, 11, 5); switch (ext & 0x3f) { @@ -3875,6 +3877,7 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache, /* FALL-THROUGH */ case 42: /* Vector Select */ case 43: /* Vector Permute */ + case 59: /* Vector Permute Right-indexed */ case 44: /* Vector Shift Left Double by Octet Immediate */ case 45: /* Vector Permute and Exclusive-OR */ case 60: /* Vector Add Extended Unsigned Quadword Modulo */ @@ -3891,14 +3894,37 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache, record_full_arch_list_add_reg (regcache, tdep->ppc_vr0_regnum + PPC_VRT (insn)); return 0; + + case 48: /* Multiply-Add High Doubleword */ + case 49: /* Multiply-Add High Doubleword Unsigned */ + case 51: /* Multiply-Add Low Doubleword */ + record_full_arch_list_add_reg (regcache, + tdep->ppc_gp0_regnum + PPC_RT (insn)); + return 0; } switch ((ext & 0x1ff)) { + case 385: + if (vra != 0 /* Decimal Convert To Signed Quadword */ + && vra != 2 /* Decimal Convert From Signed Quadword */ + && vra != 4 /* Decimal Convert To Zoned */ + && vra != 5 /* Decimal Convert To National */ + && vra != 6 /* Decimal Convert From Zoned */ + && vra != 7 /* Decimal Convert From National */ + && vra != 31) /* Decimal Set Sign */ + break; /* 5.16 Decimal Integer Arithmetic Instructions */ case 1: /* Decimal Add Modulo */ case 65: /* Decimal Subtract Modulo */ + case 193: /* Decimal Shift */ + case 129: /* Decimal Unsigned Shift */ + case 449: /* Decimal Shift and Round */ + + case 257: /* Decimal Truncate */ + case 321: /* Decimal Unsigned Truncate */ + /* Bit-21 should be set. */ if (!PPC_BIT (insn, 21)) break; @@ -3928,6 +3954,12 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache, case 198: /* Vector Compare Equal To Single-Precision */ case 454: /* Vector Compare Greater Than or Equal To Single-Precision */ case 710: /* Vector Compare Greater Than Single-Precision */ + case 7: /* Vector Compare Not Equal Byte */ + case 71: /* Vector Compare Not Equal Halfword */ + case 135: /* Vector Compare Not Equal Word */ + case 263: /* Vector Compare Not Equal or Zero Byte */ + case 327: /* Vector Compare Not Equal or Zero Halfword */ + case 391: /* Vector Compare Not Equal or Zero Word */ if (PPC_Rc (insn)) record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); record_full_arch_list_add_reg (regcache, @@ -3935,6 +3967,38 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache, return 0; } + if (ext == 1538) + { + switch (vra) + { + case 0: /* Vector Count Leading Zero Least-Significant Bits + Byte */ + case 1: /* Vector Count Trailing Zero Least-Significant Bits + Byte */ + record_full_arch_list_add_reg (regcache, + tdep->ppc_gp0_regnum + PPC_RT (insn)); + return 0; + + case 6: /* Vector Negate Word */ + case 7: /* Vector Negate Doubleword */ + case 8: /* Vector Parity Byte Word */ + case 9: /* Vector Parity Byte Doubleword */ + case 10: /* Vector Parity Byte Quadword */ + case 16: /* Vector Extend Sign Byte To Word */ + case 17: /* Vector Extend Sign Halfword To Word */ + case 24: /* Vector Extend Sign Byte To Doubleword */ + case 25: /* Vector Extend Sign Halfword To Doubleword */ + case 26: /* Vector Extend Sign Word To Doubleword */ + case 28: /* Vector Count Trailing Zeros Byte */ + case 29: /* Vector Count Trailing Zeros Halfword */ + case 30: /* Vector Count Trailing Zeros Word */ + case 31: /* Vector Count Trailing Zeros Doubleword */ + record_full_arch_list_add_reg (regcache, + tdep->ppc_vr0_regnum + PPC_VRT (insn)); + return 0; + } + } + switch (ext) { case 142: /* Vector Pack Unsigned Halfword Unsigned Saturate */ @@ -4106,10 +4170,45 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache, case 1923: /* Vector Population Count Word */ case 1987: /* Vector Population Count Doubleword */ case 1356: /* Vector Bit Permute Quadword */ + case 1484: /* Vector Bit Permute Doubleword */ + case 513: /* Vector Multiply-by-10 Unsigned Quadword */ + case 1: /* Vector Multiply-by-10 & write Carry Unsigned + Quadword */ + case 577: /* Vector Multiply-by-10 Extended Unsigned Quadword */ + case 65: /* Vector Multiply-by-10 Extended & write Carry + Unsigned Quadword */ + case 1027: /* Vector Absolute Difference Unsigned Byte */ + case 1091: /* Vector Absolute Difference Unsigned Halfword */ + case 1155: /* Vector Absolute Difference Unsigned Word */ + case 1796: /* Vector Shift Right Variable */ + case 1860: /* Vector Shift Left Variable */ + case 133: /* Vector Rotate Left Word then Mask Insert */ + case 197: /* Vector Rotate Left Doubleword then Mask Insert */ + case 389: /* Vector Rotate Left Word then AND with Mask */ + case 453: /* Vector Rotate Left Doubleword then AND with Mask */ + case 525: /* Vector Extract Unsigned Byte */ + case 589: /* Vector Extract Unsigned Halfword */ + case 653: /* Vector Extract Unsigned Word */ + case 717: /* Vector Extract Doubleword */ + case 781: /* Vector Insert Byte */ + case 845: /* Vector Insert Halfword */ + case 909: /* Vector Insert Word */ + case 973: /* Vector Insert Doubleword */ record_full_arch_list_add_reg (regcache, tdep->ppc_vr0_regnum + PPC_VRT (insn)); return 0; + case 1549: /* Vector Extract Unsigned Byte Left-Indexed */ + case 1613: /* Vector Extract Unsigned Halfword Left-Indexed */ + case 1677: /* Vector Extract Unsigned Word Left-Indexed */ + case 1805: /* Vector Extract Unsigned Byte Right-Indexed */ + case 1869: /* Vector Extract Unsigned Halfword Right-Indexed */ + case 1933: /* Vector Extract Unsigned Word Right-Indexed */ + record_full_arch_list_add_reg (regcache, + tdep->ppc_gp0_regnum + PPC_RT (insn)); + return 0; + + case 1604: /* Move To Vector Status and Control Register */ record_full_arch_list_add_reg (regcache, PPC_VSCR_REGNUM); return 0; @@ -4117,6 +4216,12 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache, record_full_arch_list_add_reg (regcache, tdep->ppc_vr0_regnum + PPC_VRT (insn)); return 0; + case 833: /* Decimal Copy Sign */ + record_full_arch_list_add_reg (regcache, + tdep->ppc_vr0_regnum + PPC_VRT (insn)); + record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); + return 0; + } fprintf_unfiltered (gdb_stdlog, "Warning: Don't know how to record %08x " @@ -4134,6 +4239,14 @@ ppc_process_record_op19 (struct gdbarch *gdbarch, struct regcache *regcache, struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int ext = PPC_EXTOP (insn); + switch(ext & 0x01f) + { + case 2: /* Add PC Immediate Shifted */ + record_full_arch_list_add_reg (regcache, + tdep->ppc_gp0_regnum + PPC_RT (insn)); + return 0; + } + switch (ext) { case 0: /* Move Condition Register Field */ @@ -4158,7 +4271,12 @@ ppc_process_record_op19 (struct gdbarch *gdbarch, struct regcache *regcache, record_full_arch_list_add_reg (regcache, tdep->ppc_lr_regnum); return 0; + case 82: /* Return From System Call Vectored */ + record_full_arch_list_add_reg (regcache, tdep->ppc_ps_regnum); + return 0; + case 150: /* Instruction Synchronize */ + case 370: /* Stop */ /* Do nothing. */ return 0; } @@ -4257,10 +4375,21 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 302: /* Move From Branch History Rolling Buffer */ case 339: /* Move From Special Purpose Register */ case 371: /* Move From Time Base [Phased-Out] */ + case 309: /* Load Doubleword Monitored Indexed */ + case 128: /* Set Boolean */ + case 755: /* Deliver A Random Number */ record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum + PPC_RT (insn)); return 0; + case 890: /* Extend-Sign Word and Shift Left Immediate (445) */ + case 890 | 1: /* Extend-Sign Word and Shift Left Immediate (445) */ + if (PPC_RC (insn)) + { + record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); + record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum); + } + /* FALL-THROUGH */ /* These only write to RA. */ case 51: /* Move From VSR Doubleword */ case 115: /* Move From VSR Word and Zero */ @@ -4273,6 +4402,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 282: /* Convert Declets To Binary Coded Decimal */ case 314: /* Convert Binary Coded Decimal To Declets */ case 508: /* Compare bytes */ + case 307: /* Move From VSR Lower Doubleword */ record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum + PPC_RA (insn)); return 0; @@ -4283,14 +4413,19 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 824: /* Shift Right Algebraic Word Immediate */ case 826: /* Shift Right Algebraic Doubleword Immediate (413) */ case 826 | 1: /* Shift Right Algebraic Doubleword Immediate (413) */ - record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum); + case 93: /* Decimal Test and Clear Sign */ record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum + PPC_RA (insn)); /* FALL-THROUGH */ + case 192: /* Compare Ranged Byte */ + case 224: /* Compare Equal Byte */ + record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum); + /* FALL-THROUGH */ case 0: /* Compare */ case 32: /* Compare logical */ case 144: /* Move To Condition Register Fields */ /* Move To One Condition Register Field */ + case 576: /* Move XER to CR Extended */ record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); return 0; @@ -4317,6 +4452,12 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 790: /* Load Halfword Byte-Reverse Indexed */ case 534: /* Load Word Byte-Reverse Indexed */ case 532: /* Load Doubleword Byte-Reverse Indexed */ + case 582: /* Load Word Atomic */ + case 614: /* Load Doubleword Atomic */ + case 265: /* Modulo Unsigned Doubleword */ + case 777: /* Modulo Signed Doubleword */ + case 267: /* Modulo Unsigned Word */ + case 779: /* Modulo Signed Word */ record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum + PPC_RT (insn)); return 0; @@ -4395,6 +4536,16 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 844: /* Load VSX Vector Doubleword*2 Indexed */ case 332: /* Load VSX Vector Doubleword & Splat Indexed */ case 780: /* Load VSX Vector Word*4 Indexed */ + case 268: /* Load VSX Vector Indexed */ + case 364: /* Load VSX Vector Word & Splat Indexed */ + case 812: /* Load VSX Vector Halfword*8 Indexed */ + case 876: /* Load VSX Vector Byte*16 Indexed */ + case 269: /* Load VSX Vector with Length */ + case 301: /* Load VSX Vector Left-justified with Length */ + case 781: /* Load VSX Scalar as Integer Byte & Zero Indexed */ + case 813: /* Load VSX Scalar as Integer Halfword & Zero Indexed */ + case 403: /* Move To VSR Word & Splat */ + case 435: /* Move To VSR Double Doubleword */ ppc_record_vsr (regcache, tdep, PPC_XT (insn)); return 0; @@ -4416,6 +4567,8 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 922: /* Extend Sign Halfword */ case 954: /* Extend Sign Byte */ case 986: /* Extend Sign Word */ + case 538: /* Count Trailing Zeros Word */ + case 570: /* Count Trailing Zeros Doubleword */ if (PPC_RC (insn)) record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); record_full_arch_list_add_reg (regcache, @@ -4458,9 +4611,19 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 727: /* Store Floating-Point Double Indexed */ case 919: /* Store Floating-Point Double Pair Indexed */ case 983: /* Store Floating-Point as Integer Word Indexed */ - if (ext == 694 || ext == 726 || ext == 150 || ext == 214 || ext == 182) + case 396: /* Store VSX Vector Indexed */ + case 940: /* Store VSX Vector Halfword*8 Indexed */ + case 1004: /* Store VSX Vector Byte*16 Indexed */ + case 909: /* Store VSX Scalar as Integer Byte Indexed */ + case 941: /* Store VSX Scalar as Integer Halfword Indexed */ + case 902: /* Paste */ + if (ext == 694 || ext == 726 || ext == 150 || ext == 214 || ext == 182 + || ext == 902) record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); + if (ext == 902) + record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum); + ra = 0; if (PPC_RA (insn) != 0) regcache_raw_read_unsigned (regcache, @@ -4487,6 +4650,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 135: /* Store Vector Element Byte Indexed */ case 215: /* Store Byte Indexed */ case 694: /* Store Byte Conditional Indexed */ + case 909: /* Store VSX Scalar as Integer Byte Indexed */ size = 1; break; case 439: /* Store Halfword with Update Indexed */ @@ -4494,6 +4658,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 407: /* Store Halfword Indexed */ case 726: /* Store Halfword Conditional Indexed */ case 918: /* Store Halfword Byte-Reverse Indexed */ + case 941: /* Store VSX Scalar as Integer Halfword Indexed */ size = 2; break; case 181: /* Store Doubleword with Update Indexed */ @@ -4511,8 +4676,14 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 231: /* Store Vector Indexed */ case 487: /* Store Vector Indexed LRU */ case 919: /* Store Floating-Point Double Pair Indexed */ + case 396: /* Store VSX Vector Indexed */ + case 940: /* Store VSX Vector Halfword*8 Indexed */ + case 1004: /* Store VSX Vector Byte*16 Indexed */ size = 16; break; + case 902: /* Paste */ + size = 128; + break; default: gdb_assert (0); } @@ -4537,6 +4708,37 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, record_full_arch_list_add_mem (addr, size); return 0; + case 397: /* Store VSX Vector with Length */ + case 429: /* Store VSX Vector Left-justified with Length */ + if (PPC_RA (insn) != 0) + regcache_raw_read_unsigned (regcache, + tdep->ppc_gp0_regnum + PPC_RA (insn), &ea); + regcache_raw_read_unsigned (regcache, + tdep->ppc_gp0_regnum + PPC_RB (insn), &rb); + nb = rb & 0xff; + if (nb != 0) + record_full_arch_list_add_mem (ea, nb); + return 0; + + case 710: /* Store Word Atomic */ + case 742: /* Store Doubleword Atomic */ + if (PPC_RA (insn) != 0) + regcache_raw_read_unsigned (regcache, + tdep->ppc_gp0_regnum + PPC_RA (insn), &ea); + switch (ext) + { + case 710: /* Store Word Atomic */ + size = 8; + break; + case 742: /* Store Doubleword Atomic */ + size = 16; + break; + default: + gdb_assert (0); + } + record_full_arch_list_add_mem (ea, size); + return 0; + case 725: /* Store String Word Immediate */ ra = 0; if (PPC_RA (insn) != 0) @@ -4602,6 +4804,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 430: /* Clear BHRB */ case 598: /* Synchronize */ case 62: /* Wait for Interrupt */ + case 30: /* Wait */ case 22: /* Instruction Cache Block Touch */ case 854: /* Enforce In-order Execution of I/O */ case 246: /* Data Cache Block Touch for Store */ @@ -4610,6 +4813,8 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, case 278: /* Data Cache Block Touch */ case 758: /* Data Cache Block Allocate */ case 982: /* Instruction Cache Block Invalidate */ + case 774: /* Copy */ + case 838: /* CP_Abort */ return 0; case 654: /* Transaction Begin */ @@ -4709,6 +4914,7 @@ ppc_process_record_op59 (struct gdbarch *gdbarch, struct regcache *regcache, case 226: /* DFP Test Data Group */ case 642: /* DFP Compare Unordered */ case 674: /* DFP Test Significance */ + case 675: /* DFP Test Significance Immediate */ record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); return 0; @@ -4808,7 +5014,17 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache, case 217: /* ditto */ case 104: /* VSX Vector Subtract Double-Precision */ case 72: /* VSX Vector Subtract Single-Precision */ + case 128: /* VSX Scalar Maximum Type-C Double-Precision */ + case 136: /* VSX Scalar Minimum Type-C Double-Precision */ + case 144: /* VSX Scalar Maximum Type-J Double-Precision */ + case 152: /* VSX Scalar Minimum Type-J Double-Precision */ + case 3: /* VSX Scalar Compare Equal Double-Precision */ + case 11: /* VSX Scalar Compare Greater Than Double-Precision */ + case 19: /* VSX Scalar Compare Greater Than or Equal + Double-Precision */ + case 27: /* VSX Scalar Compare Not Equal Double-Precision */ record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); + /* FALL-THROUGH */ case 240: /* VSX Vector Copy Sign Double-Precision */ case 208: /* VSX Vector Copy Sign Single-Precision */ case 130: /* VSX Logical AND */ @@ -4829,6 +5045,14 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache, case 2 | 0x20: /* VSX Shift Left Double by Word Immediate (SHW=1) */ case 2 | 0x40: /* VSX Shift Left Double by Word Immediate (SHW=2) */ case 2 | 0x60: /* VSX Shift Left Double by Word Immediate (SHW=3) */ + case 216: /* VSX Vector Insert Exponent Single-Precision */ + case 248: /* VSX Vector Insert Exponent Double-Precision */ + case 26: /* VSX Vector Permute */ + case 58: /* VSX Vector Permute Right-indexed */ + case 213: /* VSX Vector Test Data Class Single-Precision (DC=0) */ + case 213 | 0x8: /* VSX Vector Test Data Class Single-Precision (DC=1) */ + case 245: /* VSX Vector Test Data Class Double-Precision (DC=0) */ + case 245 | 0x8: /* VSX Vector Test Data Class Double-Precision (DC=1) */ ppc_record_vsr (regcache, tdep, PPC_XT (insn)); return 0; @@ -4840,6 +5064,7 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache, case 35: /* VSX Scalar Compare Unordered Double-Precision */ case 43: /* VSX Scalar Compare Ordered Double-Precision */ + case 59: /* VSX Scalar Compare Exponents Double-Precision */ record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); return 0; @@ -4855,6 +5080,8 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache, Equal To Single-Precision */ case 107: /* VSX Vector Compare Greater Than Double-Precision */ case 75: /* VSX Vector Compare Greater Than Single-Precision */ + case 91: /* VSX Vector Compare Not Equal Single-Precision */ + case 123: /* VSX Vector Compare Not Equal Double-Precision */ if (PPC_Rc (insn)) record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); @@ -4986,6 +5213,7 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache, case 203: /* VSX Vector Square Root Double-Precision */ case 139: /* VSX Vector Square Root Single-Precision */ record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); + /* FALL-THROUGH */ case 345: /* VSX Scalar Absolute Value Double-Precision */ case 267: /* VSX Scalar Convert Scalar Single-Precision to Vector Single-Precision format Non-signalling */ @@ -5000,9 +5228,15 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache, case 505: /* VSX Vector Negate Double-Precision */ case 441: /* VSX Vector Negate Single-Precision */ case 164: /* VSX Splat Word */ + case 165: /* VSX Vector Extract Unsigned Word */ + case 181: /* VSX Vector Insert Word */ ppc_record_vsr (regcache, tdep, PPC_XT (insn)); return 0; + case 298: /* VSX Scalar Test Data Class Single-Precision */ + case 362: /* VSX Scalar Test Data Class Double-Precision */ + record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); + /* FALL-THROUGH */ case 106: /* VSX Scalar Test for software Square Root Double-Precision */ case 234: /* VSX Vector Test for software Square Root @@ -5011,6 +5245,60 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache, Single-Precision */ record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); return 0; + + case 347: + switch (PPC_FIELD(insn, 11, 5)) + { + case 0: /* VSX Scalar Extract Exponent Double-Precision */ + case 1: /* VSX Scalar Extract Significand Double-Precision */ + record_full_arch_list_add_reg (regcache, + tdep->ppc_gp0_regnum + PPC_RT (insn)); + return 0; + case 16: /* VSX Scalar Convert Half-Precision format to + Double-Precision format */ + case 17: /* VSX Scalar round & Convert Double-Precision format + to Half-Precision format */ + record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); + ppc_record_vsr (regcache, tdep, PPC_XT (insn)); + return 0; + } + break; + + case 475: + switch (PPC_FIELD(insn, 11, 5)) + { + case 24: /* VSX Vector Convert Half-Precision format to + Single-Precision format */ + case 25: /* VSX Vector round and Convert Single-Precision format + to Half-Precision format */ + record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); + /* FALL-THROUGH */ + case 0: /* VSX Vector Extract Exponent Double-Precision */ + case 1: /* VSX Vector Extract Significand Double-Precision */ + case 7: /* VSX Vector Byte-Reverse Halfword */ + case 8: /* VSX Vector Extract Exponent Single-Precision */ + case 9: /* VSX Vector Extract Significand Single-Precision */ + case 15: /* VSX Vector Byte-Reverse Word */ + case 23: /* VSX Vector Byte-Reverse Doubleword */ + case 31: /* VSX Vector Byte-Reverse Quadword */ + ppc_record_vsr (regcache, tdep, PPC_XT (insn)); + return 0; + } + break; + } + + switch (ext) + { + case 360: /* VSX Vector Splat Immediate Byte */ + if (PPC_FIELD (insn, 11, 2) == 0) + { + ppc_record_vsr (regcache, tdep, PPC_XT (insn)); + return 0; + } + break; + case 918: /* VSX Scalar Insert Exponent Double-Precision */ + ppc_record_vsr (regcache, tdep, PPC_XT (insn)); + return 0; } if (((ext >> 3) & 0x3) == 3) /* VSX Select */ @@ -5024,6 +5312,65 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache, return -1; } +/* Parse and record instructions of primary opcode-61 at ADDR. + Return 0 if successful. */ + +static int +ppc_process_record_op61 (struct gdbarch *gdbarch, struct regcache *regcache, + CORE_ADDR addr, uint32_t insn) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ULONGEST ea = 0; + int size; + + switch (insn & 0x3) + { + case 0: /* Store Floating-Point Double Pair */ + case 2: /* Store VSX Scalar Doubleword */ + case 3: /* Store VSX Scalar Single */ + if (PPC_RA (insn) != 0) + regcache_raw_read_unsigned (regcache, + tdep->ppc_gp0_regnum + PPC_RA (insn), + &ea); + ea += PPC_DS (insn) << 2; + switch (insn & 0x3) + { + case 0: /* Store Floating-Point Double Pair */ + size = 16; + break; + case 2: /* Store VSX Scalar Doubleword */ + size = 8; + break; + case 3: /* Store VSX Scalar Single */ + size = 4; + break; + default: + gdb_assert (0); + } + record_full_arch_list_add_mem (ea, size); + return 0; + } + + switch (insn & 0x7) + { + case 1: /* Load VSX Vector */ + ppc_record_vsr (regcache, tdep, PPC_XT (insn)); + return 0; + case 5: /* Store VSX Vector */ + if (PPC_RA (insn) != 0) + regcache_raw_read_unsigned (regcache, + tdep->ppc_gp0_regnum + PPC_RA (insn), + &ea); + ea += PPC_DQ (insn) << 4; + record_full_arch_list_add_mem (ea, 16); + return 0; + } + + fprintf_unfiltered (gdb_stdlog, "Warning: Don't know how to record %08x " + "at %s.\n", insn, paddress (gdbarch, addr)); + return -1; +} + /* Parse and record instructions of primary opcode-63 at ADDR. Return 0 if successful. */ @@ -5062,6 +5409,16 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache, record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); } + switch (ext & 0xff) + { + case 5: /* VSX Scalar Round to Quad-Precision Integer */ + case 37: /* VSX Scalar Round Quad-Precision to Double-Extended + Precision */ + record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); + ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32); + return 0; + } + switch (ext) { case 2: /* DFP Add Quad */ @@ -5091,6 +5448,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache, case 226: /* DFP Test Data Group Quad */ case 642: /* DFP Compare Unordered Quad */ case 674: /* DFP Test Significance Quad */ + case 675: /* DFP Test Significance Immediate Quad */ record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); return 0; @@ -5177,6 +5535,10 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache, case 0: /* Floating Compare Unordered */ case 32: /* Floating Compare Ordered */ case 64: /* Move to Condition Register from FPSCR */ + case 132: /* VSX Scalar Compare Ordered Quad-Precision */ + case 164: /* VSX Scalar Compare Exponents Quad-Precision */ + case 644: /* VSX Scalar Compare Unordered Quad-Precision */ + case 708: /* VSX Scalar Test Data Class Quad-Precision */ record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); /* FALL-THROUGH */ case 128: /* Floating Test for software Divide */ @@ -5184,10 +5546,68 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache, record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); return 0; + case 4: /* VSX Scalar Add Quad-Precision */ + case 36: /* VSX Scalar Multiply Quad-Precision */ + case 388: /* VSX Scalar Multiply-Add Quad-Precision */ + case 420: /* VSX Scalar Multiply-Subtract Quad-Precision */ + case 452: /* VSX Scalar Negative Multiply-Add Quad-Precision */ + case 484: /* VSX Scalar Negative Multiply-Subtract + Quad-Precision */ + case 516: /* VSX Scalar Subtract Quad-Precision */ + case 548: /* VSX Scalar Divide Quad-Precision */ + record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); + /* FALL-THROUGH */ + case 100: /* VSX Scalar Copy Sign Quad-Precision */ + case 868: /* VSX Scalar Insert Exponent Quad-Precision */ + ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32); + return 0; + + case 804: + switch (PPC_FIELD(insn, 11, 5)) + { + case 0: /* VSX Scalar Absolute Quad-Precision */ + ppc_record_vsr (regcache, tdep, PPC_XT (insn)); + return 0; + + case 27: /* VSX Scalar Square Root Quad-Precision */ + record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); + /* FALL-THROUGH */ + case 2: /* VSX Scalar Extract Exponent Quad-Precision */ + case 8: /* VSX Scalar Negative Absolute Quad-Precision */ + case 16: /* VSX Scalar Negate Quad-Precision */ + case 18: /* VSX Scalar Extract Significand Quad-Precision */ + ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32); + return 0; + } + break; + + case 836: + switch (PPC_FIELD(insn, 11, 5)) + { + case 1: /* VSX Scalar truncate & Convert Quad-Precision format + to Unsigned Word format */ + case 2: /* VSX Scalar Convert Unsigned Doubleword format to + Quad-Precision format */ + case 9: /* VSX Scalar truncate & Convert Quad-Precision format + to Signed Word format */ + case 10: /* VSX Scalar Convert Signed Doubleword format to + Quad-Precision format */ + case 17: /* VSX Scalar truncate & Convert Quad-Precision format + to Unsigned Doubleword format */ + case 20: /* VSX Scalar round & Convert Quad-Precision format to + Double-Precision format */ + case 22: /* VSX Scalar Convert Double-Precision format to + Quad-Precision format */ + case 25: /* VSX Scalar truncate & Convert Quad-Precision format + to Signed Doubleword format */ + record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum); + ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32); + return 0; + } } fprintf_unfiltered (gdb_stdlog, "Warning: Don't know how to record %08x " - "at %s, 59-%d.\n", insn, paddress (gdbarch, addr), ext); + "at %s, 63-%d.\n", insn, paddress (gdbarch, addr), ext); return -1; } @@ -5220,7 +5640,8 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache, break; case 17: /* System call */ - if (PPC_LEV (insn) != 0) + /* System Call Vectored */ + if ((PPC_LEV (insn) != 0) && ((insn & 0x2) != 2) && ((insn & 0x3) != 1)) goto UNKNOWN_OP; if (tdep->ppc_syscall_record != NULL) @@ -5233,6 +5654,13 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache, printf_unfiltered (_("no syscall record support\n")); return -1; } + + record_full_arch_list_add_reg (regcache, tdep->ppc_ps_regnum); + if ((insn & 0x3) != 1) + { + record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum); + record_full_arch_list_add_reg (regcache, tdep->ppc_lr_regnum); + } break; case 7: /* Multiply Low Immediate */ @@ -5398,12 +5826,24 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache, } break; - case 57: /* Load Floating-Point Double Pair */ - if (PPC_FIELD (insn, 30, 2) != 0) - goto UNKNOWN_OP; - tmp = tdep->ppc_fp0_regnum + (PPC_RT (insn) & ~1); - record_full_arch_list_add_reg (regcache, tmp); - record_full_arch_list_add_reg (regcache, tmp + 1); + case 57: + /* Load Floating-Point Double Pair */ + if ((insn & 0x3) == 0) + { + tmp = tdep->ppc_fp0_regnum + (PPC_RT (insn) & ~1); + record_full_arch_list_add_reg (regcache, tmp); + record_full_arch_list_add_reg (regcache, tmp + 1); + return 0; + } + + /* Load VSX Scalar Doubleword */ + /* Load VSX Scalar Single */ + if (((insn & 0x3) == 2) + || ((insn & 0x3) == 3)) + { + ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32); + return 0; + } break; case 58: /* Load Doubleword */ @@ -5429,7 +5869,11 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache, return -1; break; - case 61: /* Store Floating-Point Double Pair */ + case 61: + if (ppc_process_record_op61 (gdbarch, regcache, addr, insn) != 0) + return -1; + break; + case 62: /* Store Doubleword */ /* Store Doubleword with Update */ /* Store Quadword with Update */ @@ -5438,7 +5882,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache, int size; int sub2 = PPC_FIELD (insn, 30, 2); - if ((op6 == 61 && sub2 != 0) || (op6 == 62 && sub2 > 2)) + if (sub2 > 2) goto UNKNOWN_OP; if (PPC_RA (insn) != 0) @@ -5446,7 +5890,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache, tdep->ppc_gp0_regnum + PPC_RA (insn), &addr); - size = ((op6 == 61) || sub2 == 2) ? 16 : 8; + size = (sub2 == 2) ? 16 : 8; addr += PPC_DS (insn) << 2; record_full_arch_list_add_mem (addr, size); -- 2.5.5