aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2011-08-03 14:07:32 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2011-08-03 07:07:32 -0700
commit72c2f8102c81e3c3a030db87cdd2f4c73590886a (patch)
treea53d70f41f275e588ae6951259a5681a377657ad /gcc
parenta130fb24411061b0edf14203bd76ff1c3aad89b8 (diff)
downloadgcc-72c2f8102c81e3c3a030db87cdd2f4c73590886a.zip
gcc-72c2f8102c81e3c3a030db87cdd2f4c73590886a.tar.gz
gcc-72c2f8102c81e3c3a030db87cdd2f4c73590886a.tar.bz2
Add testcases for PR target/47744.
2011-08-03 H.J. Lu <hongjiu.lu@intel.com> PR target/47744 * gcc.dg/torture/pr47744-1.c: New. * gcc.dg/torture/pr47744-2.c: Likewise. * gcc.dg/torture/pr47744-3.c: Likewise. From-SVN: r177271
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr47744-1.c21
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr47744-2.c40
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr47744-3.c74
4 files changed, 142 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1e70bbd..59175c6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/47744
+ * gcc.dg/torture/pr47744-1.c: New.
+ * gcc.dg/torture/pr47744-2.c: Likewise.
+ * gcc.dg/torture/pr47744-3.c: Likewise.
+
2011-08-03 Richard Guenther <rguenther@suse.de>
PR middle-end/49958
diff --git a/gcc/testsuite/gcc.dg/torture/pr47744-1.c b/gcc/testsuite/gcc.dg/torture/pr47744-1.c
new file mode 100644
index 0000000..0f7efa9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr47744-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fpic" { target fpic } } */
+
+typedef int int32_t;
+static const int init_jk[] = {2,3,4,6};
+ int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2)
+{
+ int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
+ double z,fw,f[20],fq[20],q[20];
+ jk = init_jk[prec];
+ jp = jk;
+ jx = nx-1;
+ for (i=0;i<=jk;i++) {
+ for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
+ }
+ for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
+ z = q[j-1]+fw;
+ }
+ n = (int32_t) z;
+ return n&7;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr47744-2.c b/gcc/testsuite/gcc.dg/torture/pr47744-2.c
new file mode 100644
index 0000000..82f6151
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr47744-2.c
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-std=gnu99" } */
+
+typedef long unsigned int size_t;
+typedef long int ssize_t;
+typedef ssize_t index_type;
+typedef __int128_t GFC_INTEGER_16;
+typedef struct descriptor_dimension
+{
+ index_type _stride;
+ index_type _lbound;
+ index_type _ubound;
+}
+descriptor_dimension;
+typedef struct { GFC_INTEGER_16 *data; size_t offset; index_type dtype; descriptor_dimension dim[7];} gfc_array_i16;
+void
+matmul_i16 (gfc_array_i16 * const restrict retarray,
+ gfc_array_i16 * const restrict a,
+ GFC_INTEGER_16 bbase_yn)
+{
+ GFC_INTEGER_16 * restrict dest;
+ index_type rxstride, rystride;
+ index_type x, y, n, count, xcount;
+ GFC_INTEGER_16 * restrict dest_y;
+ GFC_INTEGER_16 s;
+ const GFC_INTEGER_16 * restrict abase_n;
+ rxstride = ((retarray)->dim[0]._stride);
+ rystride = ((retarray)->dim[1]._stride);
+ xcount = ((a)->dim[0]._ubound + 1 - (a)->dim[0]._lbound);
+ dest = retarray->data;
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ dest_y[x] += abase_n[x] * bbase_yn;
+ for (x = 0; x < xcount; x++)
+ {
+ for (n = 0; n < count; n++)
+ dest_y[x*rxstride] = (GFC_INTEGER_16) 0;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr47744-3.c b/gcc/testsuite/gcc.dg/torture/pr47744-3.c
new file mode 100644
index 0000000..5a5dd33
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr47744-3.c
@@ -0,0 +1,74 @@
+/* { dg-do compile } */
+
+typedef union rtunion_def {
+ struct rtx_def *rtx;
+} rtunion;
+typedef struct rtx_def {
+ unsigned short code;
+ rtunion fld[1];
+} *rtx;
+extern rtx recog_operand[];
+extern rtx *recog_operand_loc[];
+extern int reload_n_operands;
+extern void find_dummy_reload (int, int);
+extern int asm_noperands (rtx);
+extern int n_occurrences (char **);
+char operands_match[10][10];
+void find_reloads (rtx insn, int n_alternatives, int commutative)
+{
+ register int i, j;
+ int noperands;
+ char *constraints[10];
+ int address_reloaded[10];
+ int this_alternative[10];
+ char this_alternative_win[10];
+ int this_alternative_matches[10];
+ int this_alternative_number;
+ rtx body = ((insn)->fld[3].rtx);
+ int operand_mode[10];
+ if (body->code == 1)
+ {
+ reload_n_operands = noperands = asm_noperands (body);
+ n_alternatives = n_occurrences (constraints);
+ }
+ for (this_alternative_number = 0;
+ this_alternative_number < n_alternatives;
+ this_alternative_number++)
+ for (i = 0;
+ i < noperands;
+ i++)
+ {
+ register char *p = constraints[i];
+ register int win = 0;
+ int badop = 1;
+ int c;
+ register rtx operand = recog_operand[i];
+ int force_reload = 0;
+ this_alternative_win[i] = 0;
+ this_alternative[i] = 1;
+ while (*p && (c = *p++) != ',')
+ switch (c)
+ {
+ case '4':
+ c -= '0';
+ this_alternative_matches[i] = c;
+ if ((c != commutative
+ || i != commutative + 1)
+ && operands_match[c][i])
+ win = this_alternative_win[c];
+ else
+ find_dummy_reload (operand_mode[i], this_alternative[c]);
+ if (! win || force_reload)
+ for (j = 0; j < i; j++)
+ if (this_alternative_matches[j]
+ == this_alternative_matches[i])
+ badop = 1;
+ break;
+ case '<':
+ if (operand->code == 2
+ && ! address_reloaded[i]
+ && operand->fld[0].rtx->code == 3)
+ win = 1;
+ }
+ }
+}