[gcc]
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Feb 2016 22:31:31 +0000 (22:31 +0000)
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Feb 2016 22:31:31 +0000 (22:31 +0000)
2016-02-09  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/68404
* config/rs6000/predicates.md (fusion_gpr_addis): Prevent fusing
an ADDIS that adds a pointer to a large constant that sets the
upper16 bits with a load operation.

[gcc/testsuite]
2016-02-09  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/68404
* gcc.target/powerpc/fusion.c: Rewrite test to use TOC fusion
instead accessing a really large arrray.
* gcc.target/powerpc/fusion3.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233255 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/predicates.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/fusion.c
gcc/testsuite/gcc.target/powerpc/fusion3.c

index 5bc8a22..4e9dd7d 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-09  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/68404
+       * config/rs6000/predicates.md (fusion_gpr_addis): Prevent fusing
+       an ADDIS that adds a pointer to a large constant that sets the
+       upper16 bits with a load operation.
+
 2016-02-09  Charles Baylis  <charles.baylis@linaro.org>
 
        PR target/68532
index 072291e..b0ab1d5 100644 (file)
   (match_code "const_int,high,plus")
 {
   HOST_WIDE_INT value;
-  rtx int_const;
 
   if (GET_CODE (op) == HIGH)
     return 1;
 
-  if (CONST_INT_P (op))
-    int_const = op;
-
-  else if (GET_CODE (op) == PLUS
-          && base_reg_operand (XEXP (op, 0), Pmode)
-          && CONST_INT_P (XEXP (op, 1)))
-    int_const = XEXP (op, 1);
-
-  else
+  if (!CONST_INT_P (op))
     return 0;
 
-  value = INTVAL (int_const);
+  value = INTVAL (op);
   if ((value & (HOST_WIDE_INT)0xffff) != 0)
     return 0;
 
index 246f0ca..3dad666 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-09  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/68404
+       * gcc.target/powerpc/fusion.c: Rewrite test to use TOC fusion
+       instead accessing a really large arrray.
+       * gcc.target/powerpc/fusion3.c: Likewise.
+
 2016-02-09  Charles Baylis  <charles.baylis@linaro.org>
 
        PR target/68532
index ed35006..6f11c50 100644 (file)
@@ -1,17 +1,28 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 /* { dg-require-effective-target powerpc_p8vector_ok } */
 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
-/* { dg-options "-mcpu=power7 -mtune=power8 -O3" } */
+/* { dg-options "-mcpu=power7 -mtune=power8 -O3 -mcmodel=medium" } */
 
-#define LARGE 0x12345
+#define SIZE 4
+struct foo {
+  unsigned char uc;
+  signed char sc;
+  unsigned short us;
+  short ss;
+  int i;
+  unsigned u;
+};
 
-int fusion_uchar (unsigned char *p){ return p[LARGE]; }
-int fusion_schar (signed char *p){ return p[LARGE]; }
-int fusion_ushort (unsigned short *p){ return p[LARGE]; }
-int fusion_short (short *p){ return p[LARGE]; }
-int fusion_int (int *p){ return p[LARGE]; }
-unsigned fusion_uns (unsigned *p){ return p[LARGE]; }
+static struct foo st[SIZE];
+struct foo *ptr_st = &st[0];
+
+int fusion_uchar (void){ return st[SIZE-1].uc; }
+int fusion_schar (void){ return st[SIZE-1].sc; }
+int fusion_ushort (void){ return st[SIZE-1].us; }
+int fusion_short (void){ return st[SIZE-1].ss; }
+int fusion_int (void){ return st[SIZE-1].i; }
+unsigned fusion_uns (void){ return st[SIZE-1].u; }
 
 /* { dg-final { scan-assembler-times "gpr load fusion"    6 } } */
 /* { dg-final { scan-assembler-times "lbz"                2 } } */
index 8eca640..2a8135d 100644 (file)
@@ -4,15 +4,24 @@
 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
 /* { dg-options "-mcpu=power7 -mtune=power9 -O3" } */
 
-#define LARGE 0x12345
+#define SIZE 4
+struct foo {
+  float f;
+  double d;
+};
 
-int fusion_float_read (float *p){ return p[LARGE]; }
-int fusion_double_read (double *p){ return p[LARGE]; }
+static struct foo st[SIZE];
+struct foo *ptr_st = &st[0];
 
-void fusion_float_write (float *p, float f){ p[LARGE] = f; }
-void fusion_double_write (double *p, double d){ p[LARGE] = d; }
+float fusion_float_read (void){ return st[SIZE].f; }
+double fusion_float_extend (void){ return (double)st[SIZE].f; }
+double fusion_double_read (void){ return st[SIZE].d; }
 
-/* { dg-final { scan-assembler "load fusion, type SF"  } } */
-/* { dg-final { scan-assembler "load fusion, type DF"  } } */
-/* { dg-final { scan-assembler "store fusion, type SF" } } */
-/* { dg-final { scan-assembler "store fusion, type DF" } } */
+void fusion_float_write (float f){ st[SIZE].f = f; }
+void fusion_float_truncate (double d){ st[SIZE].f = (float)d; }
+void fusion_double_write (double d){ st[SIZE].d = d; }
+
+/* { dg-final { scan-assembler-times "load fusion, type SF"  2 } } */
+/* { dg-final { scan-assembler-times "load fusion, type DF"  1 } } */
+/* { dg-final { scan-assembler-times "store fusion, type SF" 2 } } */
+/* { dg-final { scan-assembler-times "store fusion, type DF" 1 } } */