[PATCH for H8/300]:Fix ICE for H8SX

Naveen H.S. naveenh@KPITCummins.com
Fri Jun 30 07:57:00 GMT 2006


Hi Kazu,

>> Please turn this into a testcase suitable for the testsuite.
>> You shouldn't need main.  Since this is an ICE on valid code,
>> gcc.c-torture/compile would be appropriate.  The file name for
>> the testcase can be something like 20060624-1.c.
Done.

>> I'd suggest a pattern name like *xorqi3_h8300sx to indicate 
>> that the pattern is only for H8SX.
Done

>> I'd like you to put !TARGET_H8SX in the condition for 
>> documentation purposes. 
Done

Please find attached the modified patch as per your suggestions.
Also please comment on the patch.

No new regressions found.

ChangeLog
2006-06-30	Naveen H.S <naveenh@kpitcummins.com>

	* gcc/config/h8300/h8300.md (*xorqi3_h8300sx): New.
	(xorqi3_1): Disparage H8300SX.
	* gcc/testsuite/gcc.c-torture/compile/20060624-1.c: New File.

--- gcc/config/h8300/h8300.md	2006-01-02 22:58:54.000000000 +0530
+++ gcc/config/h8300/h8300.md	2006-06-30 13:18:15.000000000 +0530
@@ -1877,17 +1877,29 @@
 ;; XOR INSTRUCTIONS
 ;;
----------------------------------------------------------------------
 
+(define_insn "*xorqi3_h8300sx"
+  [(set (match_operand:QI 0 "bit_operand" "=rQ,r")
+        (xor:QI (match_operand:QI 1 "bit_operand" "%0,WU")
+                (match_operand:QI 2 "h8300_src_operand" "rQi,IP1>X")))]
+  "TARGET_H8300SX"
+  "@
+   xor\\t %X2,%X0
+   bnot\\t %V2,%R0"
+  [(set_attr "length" "*,8")
+   (set_attr "length_table" "logicb,*")
+   (set_attr "cc" "set_znv,none_0hit")])
+
+
 (define_insn "xorqi3_1"
   [(set (match_operand:QI 0 "bit_operand" "=r,U")
 	(xor:QI (match_operand:QI 1 "bit_operand" "%0,0")
 		(match_operand:QI 2 "h8300_src_operand" "rQi,n")))]
-  "TARGET_H8300SX || register_operand (operands[0], QImode)
-   || single_one_operand (operands[2], QImode)"
+  "((register_operand (operands[0], QImode)
+   || single_one_operand (operands[2], QImode)) && !TARGET_H8300SX)"
   "@
    xor\\t%X2,%X0
    bnot\\t%V2,%R0"
-  [(set_attr "length" "*,8")
-   (set_attr "length_table" "logicb,*")
+  [(set_attr "length" "2,8")
    (set_attr "cc" "set_znv,none_0hit")])
 
 (define_expand "xorqi3"

--- gcc/testsuite/gcc.c-torture/compile/20060624-1.c	2006-06-30
13:34:39.000000000 +0530
+++ gcc/testsuite/gcc.c-torture/compile/20060624-1.c	2006-06-30
13:15:18.000000000 +0530
@@ -0,0 +1,8 @@
+/* This test used to ICE on H8300SX.*/
+const unsigned char baCryptX[]="A";
+
+void TEST(unsigned char *ptrbVal)
+{
+  ptrbVal[0]^=baCryptX[0];
+}
+		

Regards,
Naveen.H.S.
KPIT Cummins Infosystems Ltd,
Pune (INDIA) 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH, H8 and M16C
Series.
The following site also offers free technical support to its users. 
Visit http://www.kpitgnutools.com for details. 
Latest versions of KPIT GNU tools were released on June 1, 2006. 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  




More information about the Gcc-patches mailing list