public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Another fix for the mcore simulator
@ 2023-11-26 18:47 Jeff Law
  2023-11-27 20:06 ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Law @ 2023-11-26 18:47 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]


Here we go again.  About a month ago a change to GCC's generic 
optimizers triggered a "regression" for mcore-elf.  In simplest terms 
the change eliminated a zero extension and after a quick analysis it was 
pretty clear the zero extension should have made no difference in the 
visible behavior of the code.

Naturally I suspected another problem with the mcore-elf simulator when 
run on a 64 bit host.  I wasn't disappointed.  This time it was the 
logical right shift instruction that was clearly wrong.

This fixes around 500 more tests in the GCC testsuite and knocks about 
40 minutes off its runtime -- it's now only about 2-3X slower than other 
comparable targets.  Which is a massive improvement over where it was 
before I fixed the sext instructions.

No doubt there's more 64 bit host issues in the mcore simulator.  I 
can't justify chasing them all down preemptively.  But I'll obviously 
continue to fault in fixes if/when the GCC testsuite shows a regression.

OK for the trunk?

jeff

[-- Attachment #2: P --]
[-- Type: text/plain, Size: 1042 bytes --]

diff --git a/sim/mcore/.interp.c.swp b/sim/mcore/.interp.c.swp
new file mode 100644
index 00000000000..a11d2df9077
Binary files /dev/null and b/sim/mcore/.interp.c.swp differ
diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c
index 48d9ff8645a..0bbb2c399b2 100644
--- a/sim/mcore/interp.c
+++ b/sim/mcore/interp.c
@@ -1060,7 +1060,7 @@ step_once (SIM_DESC sd, SIM_CPU *cpu)
 	case 0x3E: case 0x3F:				/* lsrc, lsri */
 	  {
 	    unsigned imm = IMM5;
-	    unsigned long tmp = gr[RD];
+	    uint32_t tmp = gr[RD];
 	    if (imm == 0)
 	      {
 		NEW_C (tmp);
diff --git a/sim/testsuite/mcore/lsri.s b/sim/testsuite/mcore/lsri.s
new file mode 100644
index 00000000000..fe15213d6b0
--- /dev/null
+++ b/sim/testsuite/mcore/lsri.s
@@ -0,0 +1,21 @@
+# check that sext.b/sext.h work correctly
+# mach: mcore
+
+.include "testutils.inc"
+
+	start
+	# Construct -1
+	bmaski	r2, 32
+
+	# logical shift right by 24
+	lsri	r2, 24
+
+	# Construct 255
+	bmaski	r1, 8
+
+	# Compare them, they should be equal
+	cmpne	r2,r1
+	jbt	.L1
+	pass
+.L1:
+	fail

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-01 14:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-26 18:47 Another fix for the mcore simulator Jeff Law
2023-11-27 20:06 ` Tom Tromey
2023-11-28  5:46   ` Jeff Law
2023-11-28 15:09     ` Tom Tromey
2023-12-01  2:45       ` Jeff Law
2023-12-01  3:56         ` Tom Tromey
2023-12-01 14:27           ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).