Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Richard Sandiford <richard@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: Make all four mipsisa* simulators support mipsisa{32,64}{,r2}
Date: Mon, 25 Jun 2007 18:17:00 -0000	[thread overview]
Message-ID: <878xa81c99.fsf@firetop.home> (raw)

Although most mipsisa* GNU tools support all four of MIPS32, MIP32r2,
MIPS64 and MIPS64r2, the gdb simulator doesn't.  So while the gcc
configurations build multilibs for all four targets, it usually isn't
possible to test them all using one configuration's simulator.

Would it be OK to:

  - make the all four simulators support all four targets,
  - select the target specified by the binary, if any, and
  - use the target triplet to set the default architecture otherwise

?  This patch does that by reusing the mips64vr* MULTI infrastructure.

I've been testing this locally for a while with no ill effects.
One specific test I tried today was to build mipsisa64-elf-run
with and without the patch, then create four tests:

1. mips32.c:
---------------------------------
int main (void)
{
  asm ("maddp $2,$2");
  return 0;
}
---------------------------------
compiled as:

    mipsisa32r2-elf-gcc -Tidt32.ld mips32.c -mips32 \
       -Wa,-msmartmips -o mips32

2. mips32r2.c:
---------------------------------
int main (void)
{
  asm ("maddp $2,$2");
  asm ("seb $2,$2");
  return 0;
}
---------------------------------
compiled as:

    mipsisa32r2-elf-gcc -Tidt32.ld mips32r2.c -mips32r2 \
      -Wa,-msmartmips -o mips32r2

3. mips64.c:
---------------------------------
int main (void)
{
  asm ("dmult $2,$2");
  return 0;
}
---------------------------------
compiled as:

    mipsisa32r2-elf-gcc -Tidt32.ld mips64.c -mips64 -o mips64

4. mips64r2.c:
---------------------------------
int main (void)
{
  asm ("drotr $2,$2,1");
  return 0;
}
---------------------------------
compiled as:

    mipsisa32r2-elf-gcc -Tidt32.ld mips64r2.c -mips64 \
      -Wa,-mips64r2 -o mips64r2

As expected, (3) worked OK with the unpatched compiler, but (1),
(2) and (4) raised a ReservedInstruction exception.  (1)-(4) all
worked correctly with the patched simulator.  I also tried using
the patched simulator to run the mips32r2 tests with the architecture
forced to mips32; as expected, it too raised ReservedInstruction.
I did the same thing for mips64r2 with the architecture forced
to mips64, and it failed in the same way.

OK to install?

Richard


sim/mips/
	* configure.ac (sim_mipsisa3264_configs): New variable.
	(mipsis32*-*-, mipsisa32r2*-*-*, mips64*-*-*, mips64r2*-*-*): Make
	every configuration support all four targets, using the triplet to
	determine the default.
	* configure: Regenerate.

Index: sim/mips/configure.ac
===================================================================
--- sim/mips/configure.ac	(revision 172263)
+++ sim/mips/configure.ac	(working copy)
@@ -109,6 +109,12 @@ sim_igen_filter="32,64,f"
 sim_m16_filter="16"
 sim_mach_default="mips8000"
 
+sim_mipsisa3264_configs="\
+  mipsisa32:mips32,mips16,mips16e,smartmips:32,f:mipsisa32\
+  mipsisa32r2:mips32r2,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2\
+  mipsisa64:mips64,mips3d,mips16,mips16e,mdmx:32,64,f:mipsisa64\
+  mipsisa64r2:mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2:32,64,f:mipsisa64r2"
+
 case "${target}" in
   mips*tx39*)		sim_gen=IGEN
 			sim_igen_filter="32,f"
@@ -152,34 +158,26 @@ case "${target}" in
 			sim_igen_filter="32,64,f"
 			sim_m16_filter="16"
 			;;
-  mipsisa32r2*-*-*)	sim_gen=M16
-			sim_igen_machine="-M mips32r2,mips16,mips16e,mdmx,dsp,dsp2,smartmips"
-			sim_m16_machine="-M mips16,mips16e,mips32r2"
-			sim_igen_filter="32,f"
-			sim_mach_default="mipsisa32r2"
-			;;
-  mipsisa32*-*-*)	sim_gen=M16
-			sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
-			sim_m16_machine="-M mips16,mips16e,mips32"
-			sim_igen_filter="32,f"
-			sim_mach_default="mipsisa32"
-			;;
-  mipsisa64r2*-*-*)	sim_gen=M16
-			sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
-			sim_m16_machine="-M mips16,mips16e,mips64r2"
-			sim_igen_filter="32,64,f"
-			sim_mach_default="mipsisa64r2"
+  mipsisa32r2*-*-*)	sim_gen=MULTI
+			sim_multi_configs=$sim_mipsisa3264_configs
+			sim_multi_default="mipsisa32r2"
+			;;
+  mipsisa32*-*-*)	sim_gen=MULTI
+			sim_multi_configs=$sim_mipsisa3264_configs
+			sim_multi_default="mipsisa32"
+			;;
+  mipsisa64r2*-*-*)	sim_gen=MULTI
+			sim_multi_configs=$sim_mipsisa3264_configs
+			sim_multi_default="mipsisa64r2"
 			;;
   mipsisa64sb1*-*-*)	sim_gen=IGEN
 			sim_igen_machine="-M mips64,mips3d,sb1"
 			sim_igen_filter="32,64,f"
 			sim_mach_default="mips_sb1"
 			;;
-  mipsisa64*-*-*)	sim_gen=M16
-			sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
-			sim_m16_machine="-M mips16,mips16e,mips64"
-			sim_igen_filter="32,64,f"
-			sim_mach_default="mipsisa64"
+  mipsisa64*-*-*)	sim_gen=MULTI
+			sim_multi_configs=$sim_mipsisa3264_configs
+			sim_multi_default="mipsisa64"
 			;;
   mips*lsi*)		sim_gen=M16
 			sim_igen_machine="-M mipsIII,mips16"


             reply	other threads:[~2007-06-25 11:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-25 18:17 Richard Sandiford [this message]
2007-06-26 13:14 ` Thiemo Seufer
2007-06-26 19:11 ` Joel Brobecker
2007-06-28  9:41   ` Richard Sandiford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878xa81c99.fsf@firetop.home \
    --to=richard@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox