Attached, is an updated patch (with change logs).

The test cases are now in gcc.target/i386 and the
target selection is "dg-require-effective-target int128" only.

Verified that the tests correctly detect the presence/lack
of TImode support.

- Gary
Index: gcc/config/i386/i386.h
===================================================================
--- gcc/config/i386/i386.h      (revision 190398)
+++ gcc/config/i386/i386.h      (working copy)
@@ -1816,6 +1816,10 @@ do {                                                     
\
 #define BRANCH_COST(speed_p, predictable_p) \
   (!(speed_p) ? 2 : (predictable_p) ? 0 : ix86_branch_cost)
 
+/* An integer expression for the size in bits of the largest integer machine
+   mode that should actually be used.  We allow pairs of registers.  */
+#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TARGET_64BIT ? TImode : DImode)
+
 /* Define this macro as a C expression which is nonzero if accessing
    less than a word of memory (i.e. a `char' or a `short') is no
    faster than accessing a word of memory, i.e., if such access
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog       (revision 190398)
+++ gcc/ChangeLog       (working copy)
@@ -1,3 +1,10 @@
+2012-08-14  Gary Funck <g...@intrepid.com>
+
+       PR target/20020
+       * config/i386/i386.h (MAX_FIXED_MODE_SIZE): Allow use of TImode
+       for use with appropriately sized structures and unions
+       on 64-bit (x86) targets.
+
 2012-08-14  Uros Bizjak  <ubiz...@gmail.com>
 
        * config/i386/i386.md (enabled): Add comment with explanation
Index: gcc/testsuite/gcc.target/i386/pr20020-1.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr20020-1.c   (revision 0)
+++ gcc/testsuite/gcc.target/i386/pr20020-1.c   (revision 0)
@@ -0,0 +1,23 @@
+/* Check that 128-bit struct's are represented as TImode values.  */
+/* { dg-require-effective-target int128 } */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-rtl-expand" } */
+
+struct shared_ptr_struct
+{
+  unsigned long long phase:48;
+  unsigned short thread:16;
+  void *addr;
+};
+typedef struct shared_ptr_struct sptr_t;
+
+sptr_t S;
+
+sptr_t
+sptr_result (void)
+{
+  return S;
+}
+/* { dg-final { scan-rtl-dump "\\\(set \\\(reg:TI \[0-9\]* \\\[ <retval> 
\\\]\\\)" "expand" } } */
+/* { dg-final { scan-rtl-dump "\\\(set \\\(reg/i:TI 0 ax\\\)" "expand" } } */
+/* { dg-final { cleanup-rtl-dump "expand" } } */
Index: gcc/testsuite/gcc.target/i386/pr20020-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr20020-2.c   (revision 0)
+++ gcc/testsuite/gcc.target/i386/pr20020-2.c   (revision 0)
@@ -0,0 +1,21 @@
+/* Check that 128-bit struct's are represented as TImode values.  */
+/* { dg-require-effective-target int128 } */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-rtl-expand" } */
+
+struct shared_ptr_struct
+{
+  unsigned long long phase:48;
+  unsigned short thread:16;
+  void *addr;
+};
+typedef struct shared_ptr_struct sptr_t;
+
+void
+copy_sptr (sptr_t *dest, sptr_t src)
+{
+  *dest = src;
+}
+
+/* { dg-final { scan-rtl-dump "\\\(set \\\(reg:TI \[0-9\]*" "expand" } } */
+/* { dg-final { cleanup-rtl-dump "expand" } } */
Index: gcc/testsuite/gcc.target/i386/pr20020-3.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr20020-3.c   (revision 0)
+++ gcc/testsuite/gcc.target/i386/pr20020-3.c   (revision 0)
@@ -0,0 +1,24 @@
+/* Check that 128-bit struct's are represented as TImode values.  */
+/* { dg-require-effective-target int128 } */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-rtl-expand" } */
+
+struct shared_ptr_struct
+{
+  unsigned long long phase:48;
+  unsigned short thread:16;
+  void *addr;
+};
+typedef struct shared_ptr_struct sptr_t;
+
+sptr_t sptr_1, sptr_2;
+
+void
+copy_sptr (void)
+{
+  sptr_1 = sptr_2;  
+}
+
+/* { dg-final { scan-rtl-dump "\\\(set \\\(reg:TI \[0-9\]*" "expand" } } */
+/* { dg-final { scan-rtl-dump "\\\(set \\\(mem/c:TI" "expand" } } */
+/* { dg-final { cleanup-rtl-dump "expand" } } */
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog     (revision 190398)
+++ gcc/testsuite/ChangeLog     (working copy)
@@ -1,3 +1,10 @@
+2012-08-14  Gary Funck <g...@intrepid.com>
+
+       PR target/20020
+       * gcc.target/i386/pr20020-1.c: New.
+       * gcc.target/i386/pr20020-2.c: New.
+       * gcc.target/i386/pr20020-3.c: New.
+
 2012-08-14  Oleg Endo  <olege...@gcc.gnu.org>
 
        PR target/52933

Reply via email to