[patch RFC] SHmedia: Fix the failure for pr22493-1.c

Kaz Kojima kkojima@rr.iij4u.or.jp
Thu Oct 27 23:43:00 GMT 2005


Andrew Pinski <pinskia@physics.uc.edu> wrote:
> You want unless flag_wrapv is set and not flag_unsafe_math_optimizations.
> 
> Because this is question about if signed types overflow is defined or
> not.

You are right.  I should read docs more carefully.  The attatched
is the revised patch.  Thank you for pointing it out.

Regards,
	kaz
--
	* config/sh/sh.md (cmpsi): Do sign extention for SHmedia
	if flag_wrapv is set.

diff -u3prN ORIG/gcc/gcc/config/sh/sh.md LOCAL/gcc/gcc/config/sh/sh.md
--- ORIG/gcc/gcc/config/sh/sh.md	Fri Oct  7 05:51:48 2005
+++ LOCAL/gcc/gcc/config/sh/sh.md	Thu Oct 27 19:42:43 2005
@@ -639,6 +639,13 @@
   if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == T_REG
       && GET_CODE (operands[1]) != CONST_INT)
     operands[0] = copy_to_mode_reg (SImode, operands[0]);
+  if (TARGET_SHMEDIA && flag_wrapv)
+    {
+      rtx zero = gen_rtx_REG (SImode, 63);
+      emit_insn (gen_addsi3_media (operands[0], zero, operands[0]));
+      if (GET_CODE (operands[1]) != CONST_INT)
+	emit_insn (gen_addsi3_media (operands[1], zero, operands[1]));
+    }
   sh_compare_op0 = operands[0];
   sh_compare_op1 = operands[1];
   DONE;



More information about the Gcc-patches mailing list