public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kai Tietz <Kai.Tietz@onevision.com>
To: "GCC Patches" <gcc-patches@gcc.gnu.org>
Cc: NightStrike <nightstrike@gmail.com>, jh@suse.cz
Subject: Re: [patch]: pr33617 vector modes have to be passed via memory for x86_64-pc-mingw32
Date: Wed, 19 Mar 2008 15:44:00 -0000	[thread overview]
Message-ID: <OF445D58A0.DB8FFB97-ONC1257411.0053021F-C1257411.0053A18A@onevision.de> (raw)

[-- 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
=

             reply	other threads:[~2008-03-19 15:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19 15:44 Kai Tietz [this message]
2008-03-26 17:11 ` NightStrike
2008-03-26 17:22   ` Kai Tietz
  -- strict thread matches above, loose matches on Subject: below --
2008-03-16 12:16 Ping - old patch from April - mingw support for I32/I64 MS printf formatters to c-format.c 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OF445D58A0.DB8FFB97-ONC1257411.0053021F-C1257411.0053A18A@onevision.de \
    --to=kai.tietz@onevision.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jh@suse.cz \
    --cc=nightstrike@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).