This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][PR target/43264] Fix 24-28 ASHIFTRT for H8/300



The H8/300 port was mis-compiling 24-28 bit ASHIFTRTs for the H8/300. These shifts are implemented by a copying the high byte to the low byte, then extending the sign bit through the low middle, high middle and high bytes (with compensation code for 25,26,27,28 bit shifts).

The problem was the sign extension part of this code was not setting the upper middle or upper bytes properly. Opps.

No separate testcase as this is covered by the testcase for pr61306.

Built gcc, libgcc, newlib and ran the regression suite for h8300-elf{-mh/-mint32,-ms/-mint32,}.

Applied to the trunk.
commit 6e5dc637c92a02eb1c0186125fa84c7c39bd8292
Author: Jeff Law <law@redhat.com>
Date:   Thu Feb 5 22:29:12 2015 -0700

    	PR target/43264
    	* config/h8300/h8300.c (get_shift_alg): Fix ASHIFTRT by
    	24 to 28 bits for the H8/300.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 90cee31..2bbfeb3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-05  Jeff Law  <law@redhat.com>
+
+	PR target/43264
+	* config/h8300/h8300.c (get_shift_alg): Fix ASHIFTRT by
+	24 to 28 bits for the H8/300.
+
 2015-02-06  Alan Modra  <amodra@gmail.com>
 
 	PR target/64876
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 5968e55..4bd4787 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -4384,7 +4384,7 @@ get_shift_alg (enum shift_type shift_type, enum shift_mode shift_mode,
 	      info->cc_inline = CC_SET_ZNV;
 	      goto end;
 	    case SHIFT_ASHIFTRT:
-	      info->special = "mov.b\t%z0,%w0\n\tbld\t#7,%w0\n\tsubx\t%x0,%x0\n\tsubx\t%x0,%x0\n\tsubx\t%x0,%x0";
+	      info->special = "mov.b\t%z0,%w0\n\tbld\t#7,%w0\n\tsubx\t%x0,%x0\n\tsubx\t%y0,%y0\n\tsubx\t%z0,%z0";
 	      info->shift1  = "shar.b\t%w0";
 	      info->cc_inline = CC_SET_ZNV;
 	      goto end;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]