diff mbox

Fix PR64461, Incorrect code on coldfire targets

Message ID 54B42C3F.3050401@redhat.com
State New
Headers show

Commit Message

Jeff Law Jan. 12, 2015, 8:19 p.m. UTC
As suggested by Andreas in the PR, the simplest fix for this problem is 
to disable the various trunc* patterns for TARGET_COLDFIRE.  That's 
precisely what this patch does.

Built cross compilers with and without the m68k.md hunk.  Verified the 
test failed without the m68k.mk hunk and passed with the m68k.md hunk.

For "fun" I've got an m68k bootstrap of the trunk running.  I don't 
expect it to finish for at least a week or so, assuming it runs to 
completion.

Installed on the trunk (in separate commits due to stupidity on my part).

Jeff
PR target/64461
	* config/m68k/m68k.md (truncsiqi2): Disable for TARGET_COLDFIRE.
	(trunchiqi2, truncsihi2): Similarly.
    
	PR target/64461
	* gcc.target/m68k/pr64461.c: New test.

Comments

Andreas Schwab Jan. 13, 2015, 11:15 a.m. UTC | #1
Jeff Law <law@redhat.com> writes:

> For "fun" I've got an m68k bootstrap of the trunk running.  I don't expect
> it to finish for at least a week or so, assuming it runs to completion.

The last time I did that it took about 10 days (with all languages
enabled, running in Aranym on a moderately fast host).

Andreas.
diff mbox

Patch

diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 2783a8f..2a314c3 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -1572,7 +1572,7 @@ 
   [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
 	(truncate:QI
 	 (match_operand:SI 1 "general_src_operand" "doJS,i")))]
-  ""
+  "!TARGET_COLDFIRE"
 {
   if (GET_CODE (operands[0]) == REG)
     {
@@ -1590,7 +1590,7 @@ 
   [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
 	(truncate:QI
 	 (match_operand:HI 1 "general_src_operand" "doJS,i")))]
-  ""
+  "!TARGET_COLDFIRE"
 {
   if (GET_CODE (operands[0]) == REG
       && (GET_CODE (operands[1]) == MEM
@@ -1617,7 +1617,7 @@ 
   [(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d")
 	(truncate:HI
 	 (match_operand:SI 1 "general_src_operand" "roJS,i")))]
-  ""
+  "!TARGET_COLDFIRE"
 {
   if (GET_CODE (operands[0]) == REG)
     {

diff --git a/gcc/testsuite/gcc.target/m68k/pr64461.c b/gcc/testsuite/gcc.target/m68k/pr64461.c
new file mode 100644
index 0000000..dd70355
--- /dev/null
+++ b/gcc/testsuite/gcc.target/m68k/pr64461.c
@@ -0,0 +1,16 @@ 
+/* { dg-do assemble } */
+/* { dg-options "-mcpu=5235 -Os" } */
+
+typedef struct rtems_rfs_block_map_s
+{
+  long unsigned int blocks[(5)];
+} rtems_rfs_block_map;
+
+extern int foo (void);
+
+int
+rtems_rfs_block_map_indirect_alloc (rtems_rfs_block_map *map,
+				    unsigned char* buffer, int b)
+{
+  (buffer + b * 4)[3] = (unsigned char) map->blocks[b];
+}