public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [patch]: pr33617 vector modes have to be passed via memory for x86_64-pc-mingw32
@ 2008-03-19 15:44 Kai Tietz
  2008-03-26 17:11 ` NightStrike
  0 siblings, 1 reply; 44+ messages in thread
From: Kai Tietz @ 2008-03-19 15:44 UTC (permalink / raw)
  To: GCC Patches; +Cc: NightStrike, jh

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

Hello,

This bug was found by running testsuite gcc.c-torture for test pr33617.c 
for target x86_64-pc-mingw32. By ABI complex and vector types have to be 
returned via memory and passed as memory reference for functions. This 
patch fixes the ICE happening.

ChangeLog entries for gcc

2008-03-19  Kai Tietz  <kai.tietz@onevision.com>

        * gcc/config/i386/i386.c (return_in_memory_ms_64): Vector and 
block
          types are passed via memory. (testsuite 
gcc.c-torture/compile/pr33617.c).
        (ix86_pass_by_reference): Check for complex and vector modes.

Tested for x86_64-pc-mingw32 target. Other targets are not affected.
Is this patch OK for apply?

Cheers,
  Kai


|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.
 

[-- Attachment #2: mingw64_pr33617.txt --]
[-- Type: text/plain, Size: 1533 bytes --]

Index: gcc/gcc/config/i386/i386.c
===================================================================
--- gcc.orig/gcc/config/i386/i386.c
+++ gcc/gcc/config/i386/i386.c
@@ -4506,11 +4506,15 @@ ix86_pass_by_reference (CUMULATIVE_ARGS 
 	    }
 	}
 
-      /* __m128 is passed by reference.  */
-      /* ??? How to handle complex?  For now treat them as structs,
-	 and pass them by reference if they're too large.  */
-      if (GET_MODE_SIZE (mode) > 8)
-	return true;
+      if (COMPLEX_MODE_P (mode) || VECTOR_MODE_P (mode))
+        return true;
+      switch (GET_MODE_SIZE (mode))
+        {
+          case 1: case 2: case 4: case 8:
+            break;
+          default:
+            return true;
+        }
     }
   else if (TARGET_64BIT && type && int_size_in_bytes (type) == -1)
     return 1;
@@ -4823,13 +4827,14 @@ return_in_memory_ms_64 (const_tree type,
 {
   HOST_WIDE_INT size = int_size_in_bytes (type);
 
-  /* __m128 and friends are returned in xmm0.  */
-  if (!COMPLEX_MODE_P (mode) && size == 16 && VECTOR_MODE_P (mode))
-    return 0;
+  /* Structures pass always via memory.  */
+  if (mode == BLKmode)
+    return 1;
 
-  /* Otherwise, the size must be exactly in [1248]. But not for complex. */
+  /* Otherwise, the size must be exactly in [1248]. But not for complex
+     and vector. */
   return (size != 1 && size != 2 && size != 4 && size != 8)
-         || COMPLEX_MODE_P (mode);
+         || COMPLEX_MODE_P (mode) || VECTOR_MODE_P (mode);
 }
 
 int
=

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

end of thread, other threads:[~2008-03-26 15:18 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.64.0801312346090.5937@digraph.polyomino.org.uk>
2008-02-01 11:04 ` Ping - old patch from April - mingw support for I32/I64 MS printf formatters to c-format.c Kai Tietz
2008-02-01 15:52   ` Joseph S. Myers
2008-02-04 14:23     ` Kai Tietz
2008-02-13 18:32       ` Joseph S. Myers
2008-02-19  9:22         ` Kai Tietz
2008-02-19 12:38           ` Joseph S. Myers
2008-02-19 13:30             ` Kai Tietz
2008-02-19 14:10               ` Joseph S. Myers
2008-02-19 15:16                 ` Kai Tietz
2008-02-25 16:46                   ` NightStrike
2008-02-25 16:58                     ` Joseph S. Myers
2008-02-25 17:42                       ` NightStrike
2008-02-25 18:53                   ` Joseph S. Myers
2008-03-04 19:25                     ` Joseph S. Myers
2008-03-10 11:06                     ` Kai Tietz
2008-03-10 22:29                       ` Joseph S. Myers
2008-03-13  0:03                         ` Danny Smith
2008-03-13  8:43                           ` Kai Tietz
2008-03-13  9:29                           ` Kai Tietz
2008-03-13 19:24                             ` Ralf Wildenhues
2008-03-14  9:32                               ` Kai Tietz
2008-03-13 20:52                             ` Danny Smith
2008-03-14 11:00                               ` Kai Tietz
2008-03-16  5:54                                 ` Danny Smith
2008-03-16 12:16                                   ` Kai Tietz
2008-03-18  9:12                                     ` [patch]: pr33617 vector modes have to be passed via memory for x86_64-pc-mingw32 Kai Tietz
2008-03-18  9:54                                       ` Kai Tietz
2008-03-18 13:20                                   ` Ping - old patch from April - mingw support for I32/I64 MS printf formatters to c-format.c Kai Tietz
2008-03-18 13:44                                     ` NightStrike
2008-03-18 13:51                                       ` Kai Tietz
2008-03-18 15:07                                       ` Kai Tietz
2008-03-19  5:01                                         ` NightStrike
2008-03-19  6:22                                         ` Danny Smith
2008-03-19  9:42                                           ` Kai Tietz
2008-03-19 13:43                                             ` NightStrike
2008-03-19 13:51                                             ` NightStrike
2008-03-20  1:18                                             ` Danny Smith
2008-03-20  1:18                                               ` NightStrike
2008-03-20  9:54                                               ` Kai Tietz
2008-02-13 21:27       ` Danny Smith
2008-02-19  9:17         ` Kai Tietz
2008-03-19 15:44 [patch]: pr33617 vector modes have to be passed via memory for x86_64-pc-mingw32 Kai Tietz
2008-03-26 17:11 ` NightStrike
2008-03-26 17:22   ` Kai Tietz

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).