+2005-11-18 Richard Henderson <rth@redhat.com>
+
+ * gcc.target/ia64/20010423-1.c, gcc.target/ia64/20020313-1.c,
+ gcc.target/ia64/20020326-1.c, gcc.target/ia64/20030225-2.c,
+ gcc.target/ia64/20030405-1.c, gcc.target/ia64/20030811-1.c,
+ gcc.target/ia64/20040303-1.c: Move from gcc.dg/.
+ * gcc.target/ia64/asm-1.c, gcc.target/ia64/float80-1.c,
+ gcc.target/ia64/float80-2.c, gcc.target/ia64/got-1.c,
+ gcc.target/ia64/postinc-1.c, gcc.target/ia64/types-1.c,
+ gcc.target/ia64/types-2.c, gcc.target/ia64/visibility-1.c,
+ gcc.target/ia64/visibility-2.c: Move from gcc.dg/, with
+ renaming to remove initial "ia64-".
+
2005-11-18 Eric Botcazou <ebotcazou@adacore.com>
* ada/acats/run_all.sh (target_run): Revert 2005-11-17 patch.
+++ /dev/null
-/* { dg-do compile { target ia64-*-* } } */
-/* { dg-options "-O2" } */
-
-int __sync_fetch_and_add_si (int *, int);
-
-inline unsigned int
-bar (volatile unsigned int *mem, unsigned int val)
-{
- return __sync_fetch_and_add_si((int *)mem, (int)val);
-}
-
-volatile unsigned int x;
-
-void foo (unsigned short *a)
-{
- *a = bar (&x, 1) + 1;
-}
+++ /dev/null
-/* PR 5312
- The problem here is that the ia64 scheduler saw a sequence of L L M type
- insns, and messed up its internal state on which slot it was issuing
- to, and aborted. */
-
-/* { dg-do compile { target ia64-*-* } } */
-/* In ILP32 mode, we get warnings about large integer constants.
- Those cause spurious FAILs. */
-/* { dg-options "-w -O2 -mconstant-gp" } */
-
-typedef unsigned long __u64;
-typedef unsigned int __u32;
-typedef struct { } spinlock_t;
-struct cpuinfo_ia64 {
- union {
- struct {
- __u32 irq_count;
- __u32 bh_count;
- } f;
- __u64 irq_and_bh_counts;
- } irq_stat;
- __u32 softirq_pending;
-} __attribute__ ((aligned ((1UL << 14)))) ;
-enum
-{
- TCA_UNSPEC,
- TCA_KIND,
- TCA_OPTIONS,
- TCA_STATS,
- TCA_XSTATS,
- TCA_RATE,
-};
-struct tc_stats
-{
- __u64 bytes;
- __u32 packets;
- __u32 drops;
- __u32 overlimits;
- __u32 bps;
- __u32 pps;
- __u32 qlen;
- __u32 backlog;
- spinlock_t *lock;
-};
-struct sk_buff {
- unsigned int data_len;
- unsigned char *tail;
- unsigned char *end;
-};
-static inline int skb_is_nonlinear(const struct sk_buff *skb)
-{
- return skb->data_len;
-}
-static inline int skb_tailroom(const struct sk_buff *skb)
-{
- return skb_is_nonlinear(skb) ? 0 : skb->end-skb->tail;
-}
-struct rtattr
-{
- unsigned short rta_len;
- unsigned short rta_type;
-};
-int qdisc_copy_stats(struct sk_buff *skb, struct tc_stats *st)
-{
- do { do { (((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->irq_stat.f.bh_count)++; __asm__ __volatile__("": : :"memory"); } while (0); (void)(st->lock); } while (0);
- ({ if (skb_tailroom(skb) < (int)( (((( ((sizeof(struct rtattr))+4 -1) & ~(4 -1) ) + ((char*)&st->lock - (char*)st)))+4 -1) & ~(4 -1) )) goto rtattr_failure; __rta_fill(skb, TCA_STATS, (char*)&st->lock - (char*)st, st); });
- do { do { } while(0); do { do { __asm__ __volatile__("": : :"memory"); (((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->irq_stat.f.bh_count)--; } while (0); if (__builtin_expect((((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->softirq_pending), 0) && (((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->irq_stat.f.bh_count) == 0) do_softirq(); } while (0); } while (0);
- return 0;
-rtattr_failure:
- do { do { } while(0); do { do { __asm__ __volatile__("": : :"memory"); (((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->irq_stat.f.bh_count)--; } while (0); if (__builtin_expect((((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->softirq_pending), 0) && (((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->irq_stat.f.bh_count) == 0) do_softirq(); } while (0); } while (0);
- return -1;
-}
+++ /dev/null
-/* PR target/6054 */
-/* { dg-do compile { target ia64-*-* } } */
-/* { dg-options "-O -mconstant-gp" } */
-/* { dg-final { scan-assembler "mov r1 =" } } */
-
-extern void direct (void);
-void foo(void (*indirect) (void))
-{
- indirect ();
- direct ();
-}
+++ /dev/null
-/* { dg-do run { target ia64-*-linux* } } */
-/* { dg-options "-O3" } */
-
-extern void abort (void);
-extern void exit (int);
-
-int __attribute__((noinline, const))
-ret4 (float value)
-{
- return 4;
-}
-
-int __attribute__((noinline, const))
-ret0 (float value)
-{
- return 0;
-}
-
-float __attribute__((noinline))
-test (float x, float y)
-{
- int clsx = ret4 (x);
- int clsy = ret0 (y);
-
- if (clsx == 0 || clsy == 0
- || (y < 0 && clsx == 1 && clsy == 1))
- return x - y;
-
- return x < y ? 0 : x - y;
-}
-
-float a = 0.0, b;
-
-int main (void)
-{
- unsigned long e;
- b = a / a;
- __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (e));
- e &= ~0x7e000UL;
- __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (e) : "memory");
- a = test (0, b);
- __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (e));
- if (e & 0x2000)
- abort ();
- exit (0);
-}
+++ /dev/null
-/* { dg-do compile { target ia64-*-* } } */
-/* { dg-options "-O2" } */
-
-int
-foo (int x, int y)
-{
- if (y == 0)
- {
- register long r8 asm ("r8");
- register long r15 asm ("r15") = 1;
- long retval;
- __asm __volatile ("foo" : "=r" (r8), "=r" (r15) : "1" (r15));
- retval = r8;
- y = retval;
- }
-
- {
- register long r8 asm ("r8");
- register long r15 asm ("r15") = 2;
- long retval;
- register long _out1 asm ("out1") = x;
- register long _out0 asm ("out0") = y;
- __asm __volatile ("foo"
- : "=r" (r8), "=r" (r15) , "=r" (_out0), "=r" (_out1)
- : "1" (r15) , "2" (_out0), "3" (_out1));
- retval = r8;
- return retval;
- }
-}
+++ /dev/null
-/* Origin: PR target/11693 from Andreas Schwab <schwab@suse.de> */
-/* { dg-do compile { target ia64-*-linux* } } */
-/* { dg-options "-O2 -frename-registers" } */
-
-static inline unsigned long
-foo (void)
-{
- unsigned long x;
- __asm__ __volatile__ ("" : "=r" (x) :: "memory");
- return x;
-}
-
-static inline void
-bar (unsigned long x, unsigned long y)
-{
- __asm__ __volatile__ ("" :: "r"(x), "r"(y) : "memory");
-}
-
-static inline void
-baz (unsigned long x, unsigned long y, unsigned long z, unsigned long p,
- unsigned long q)
-{
- __asm__ __volatile__ ("" :: "r" (q << 2) : "memory");
- __asm__ __volatile__ ("" :: "r" (z) : "memory");
- if (x & 0x1)
- __asm__ __volatile__ ("" :: "r" (y), "r" (p) : "memory");
- if (x & 0x2)
- __asm__ __volatile__ ("" :: "r" (y), "r" (p) : "memory");
-}
-
-static inline unsigned long
-ffz (unsigned long x)
-{
- unsigned long r;
- __asm__ ("" : "=r" (r) : "r" (x & (~x - 1)));
- return r;
-}
-
-void die (const char *, ...) __attribute__ ((noreturn));
-
-void
-test (void *x)
-{
- unsigned long a, c;
-
- a = foo ();
- bar (0xc000000000000000, 0x660);
- bar (0xa00000000000c000, 0x539);
- baz (2, 1, 0xa000000000008000,
- ({ unsigned long b;
- b = ({ unsigned long d; __asm__ ("" : "=r" (d) : "r" (x)); d; })
- + 0x10000000000661;
- b;
- }),
- 14);
- c = ffz (0x1fffffffffffffff);
- if (c < 51 || c > 61)
- die ("die", c - 1);
-}
+++ /dev/null
-/* Test floating point division on ia64. There was a bug in the
- max-throughput version of the inline division code. Expecting an
- exact value from a floating point expression is unwise but GCC
- depends on it in allocno_compare. */
-
-/* { dg-do run { target ia64-*-* } } */
-/* { dg-options "-minline-float-divide-max-throughput" { target ia64-*-* } } */
-
-extern void abort (void);
-
-volatile int i = 24;
-volatile int j = 30;
-volatile int k = 1;
-
-int main()
-{
- int pri2 = (((double) i / j) * (10000 / 1000) * k);
- if (pri2 != 8) abort();
- return 0;
-}
+++ /dev/null
-/* { dg-do run { target ia64-*-* } } */
-/* { dg-options } */
-
-extern void abort (void);
-
-/* Test that "=S" properly avoids the post-increment on the memory address. */
-
-static void foo(int *x)
-{
- long i;
- for (i = 0; i < 100; ++i)
- __asm__("st4 %0 = r0" : "=S"(x[i]));
-}
-
-int main()
-{
- int array[100];
- long i;
-
- for (i = 0; i < 100; ++i)
- array[i] = -1;
-
- foo(array);
-
- for (i = 0; i < 100; ++i)
- if (array[i])
- abort ();
- return 0;
-}
+++ /dev/null
-/* Bug 14610 */
-/* { dg-do run { target ia64-*-* } } */
-
-extern void abort(void);
-volatile __float80 x = 30.0;
-
-int main(void)
-{
- double d = x;
- if (d != 30.0) abort ();
- return 0;
-}
+++ /dev/null
-/* Bug 14610 */
-/* { dg-do run { target ia64-*-* } } */
-/* { dg-options "-minline-int-divide-max-throughput" } */
-
-extern void abort(void);
-volatile int j = 30;
-
-int main(void)
-{
- if (29 % j != 29) abort();
- if (30 % j != 0) abort();
- return 0;
-}
+++ /dev/null
-/* { dg-do run { target ia64-*-linux* } } */
-/* { dg-options "-O2" } */
-
-/* Test function descriptor access. */
-
-extern unsigned long *_GLOBAL_OFFSET_TABLE_;
-extern void abort(void);
-
-struct ia64_fdesc
-{
- unsigned long func;
- unsigned long gp;
-};
-
-void
-os_boot_rendez (void)
-{
-}
-
-static int
-check (unsigned long gp)
-{
- return gp != (unsigned long) &_GLOBAL_OFFSET_TABLE_;
-}
-
-int
-main (int argc, char **argv)
-{
- int i;
- int res = 0;
-
- for (i = 0; i < 1; i++)
- res += check (((struct ia64_fdesc *) os_boot_rendez)->gp);
- if (res)
- abort ();
- return res;
-}
+++ /dev/null
-/* { dg-do compile { target ia64*-*-* } } */
-/* { dg-options "-O2 -fPIC" } */
-
-/* { dg-final { scan-assembler "@ltoffx\\(object#\\)" } } */
-/* { dg-final { scan-assembler "@ltoffx\\(object#\[-+\]16384\\)" } } */
-/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]1\\)" } } */
-/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]8191\\)" } } */
-/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]8192\\)" } } */
-/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]8193\\)" } } */
-/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]16383\\)" } } */
-/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]16385\\)" } } */
-
-/* must not be in sdata */
-extern char object[];
-
-#define r(n) char *r_##n (void) { return &object[n]; }
-#define R(n) char *R_##n (void) { return &object[-n]; }
-
-#define t(n) r(n) R(n)
-
-t(0) t(1)
-t(8191) t(8192) t(8193)
-t(16383) t(16384) t(16385)
+++ /dev/null
-/* { dg-do compile { target ia64-*-* } } */
-/* { dg-options "-O2" } */
-/* { dg-options "-O2 -mlp64" { target ia64-*-hpux* } } */
-
-void copy_loop_ldouble (void *xdest,
- const void *xsrc,
- long roff,
- long soff,
- long len,
- long shift)
-{ __float128 *dest = xdest;
- const long double *src;
- long i;
- roff /= sizeof (__float128);
- soff /= sizeof (__float128);
- src = xsrc;
- src += shift * soff;
- for (i = 0; i < len - shift; ++i) {
- *dest = *src;
- dest += roff;
- src += soff;
- }
-}
+++ /dev/null
-/* { dg-do compile { target ia64*-hp-hpux* } } */
-
-/* Test that __fpreg is distinct from any other builtin type. */
-
-extern float fr1; /* { dg-error "" } */
-extern __fpreg fr1; /* { dg-error "" } */
-extern double fr2; /* { dg-error "" } */
-extern __fpreg fr2; /* { dg-error "" } */
-extern long double fr3; /* { dg-error "" } */
-extern __fpreg fr3; /* { dg-error "" } */
-extern __float80 fr4; /* { dg-error "" } */
-extern __fpreg fr4; /* { dg-error "" } */
-extern __float128 fr5; /* { dg-error "" } */
-extern __fpreg fr5; /* { dg-error "" } */
-
-/* Test that __float80 is distinct from any other builtin type. */
-
-extern float f801; /* { dg-error "" } */
-extern __float80 f801; /* { dg-error "" } */
-extern double f802; /* { dg-error "" } */
-extern __float80 f802; /* { dg-error "" } */
-extern long double f803; /* { dg-error "" } */
-extern __float80 f803; /* { dg-error "" } */
-extern __fpreg f804; /* { dg-error "" } */
-extern __float80 f804; /* { dg-error "" } */
-extern __float128 f805; /* { dg-error "" } */
-extern __float80 f805; /* { dg-error "" } */
-
-/* Test that __float128 is distinct from any other builtin type --
- except "long double", for which it is a synonym. */
-
-extern float f1281; /* { dg-error "" } */
-extern __float128 f1281; /* { dg-error "" } */
-extern double f1282; /* { dg-error "" } */
-extern __float128 f1282; /* { dg-error "" } */
-extern long double f1283;
-extern __float128 f1283;
-extern __fpreg f1284; /* { dg-error "" } */
-extern __float128 f1284; /* { dg-error "" } */
-extern __float80 f1285; /* { dg-error "" } */
-extern __float128 f1285; /* { dg-error "" } */
+++ /dev/null
-/* { dg-do run { target ia64*-hp-hpux* } } */
-/* { dg-options } */
-
-/* Test that the sizes and alignments of the extra floating-point
- types are correct. */
-
-int main () {
- if (sizeof (__fpreg) != 16)
- return 1;
- if (__alignof__ (__fpreg) != 16)
- return 2;
-
- if (sizeof (__float80) != 16)
- return 3;
- if (__alignof__ (__float80) != 16)
- return 4;
-
- return 0;
-}
-
+++ /dev/null
-/* Test visibility attribute. */
-/* { dg-do compile { target ia64*-*-linux* } } */
-/* { dg-options "-O2 -fpic" } */
-/* { dg-final { scan-assembler "\\.hidden.*variable_j" } } */
-/* { dg-final { scan-assembler "\\.hidden.*variable_m" } } */
-/* { dg-final { scan-assembler "\\.protected.*baz" } } */
-/* { dg-final { scan-assembler "gprel.*variable_i" } } */
-/* { dg-final { scan-assembler "gprel.*variable_j" } } */
-/* { dg-final { scan-assembler "ltoff.*variable_k" } } */
-/* { dg-final { scan-assembler "gprel.*variable_l" } } */
-/* { dg-final { scan-assembler "gprel.*variable_m" } } */
-/* { dg-final { scan-assembler "ltoff.*variable_n" } } */
-
-static int variable_i;
-int variable_j __attribute__((visibility ("hidden")));
-int variable_k;
-struct A { char a[64]; };
-static struct A variable_l __attribute__((section (".sbss")));
-struct A variable_m __attribute__((visibility ("hidden"), section(".sbss")));
-struct A variable_n __attribute__((section (".sbss")));
-
-int foo (void)
-{
- return variable_i + variable_j + variable_k;
-}
-
-void bar (void)
-{
- variable_l.a[10] = 0;
- variable_m.a[10] = 0;
- variable_n.a[10] = 0;
-}
-
-void __attribute__((visibility ("protected"))) baz (void)
-{
-}
+++ /dev/null
-/* Test visibility attribute. */
-/* { dg-do link { target ia64*-*-linux* } } */
-/* { dg-options "-O2 -fpic" } */
-
-int foo (int x);
-int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
-int bar (int x)
-{
- return x;
-}
-
-int main ()
-{
- return 0;
-}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int __sync_fetch_and_add_si (int *, int);
+
+inline unsigned int
+bar (volatile unsigned int *mem, unsigned int val)
+{
+ return __sync_fetch_and_add_si((int *)mem, (int)val);
+}
+
+volatile unsigned int x;
+
+void foo (unsigned short *a)
+{
+ *a = bar (&x, 1) + 1;
+}
--- /dev/null
+/* PR 5312
+ The problem here is that the ia64 scheduler saw a sequence of L L M type
+ insns, and messed up its internal state on which slot it was issuing
+ to, and aborted. */
+
+/* { dg-do compile } */
+/* In ILP32 mode, we get warnings about large integer constants.
+ Those cause spurious FAILs. */
+/* { dg-options "-w -O2 -mconstant-gp" } */
+
+typedef unsigned long __u64;
+typedef unsigned int __u32;
+typedef struct { } spinlock_t;
+struct cpuinfo_ia64 {
+ union {
+ struct {
+ __u32 irq_count;
+ __u32 bh_count;
+ } f;
+ __u64 irq_and_bh_counts;
+ } irq_stat;
+ __u32 softirq_pending;
+} __attribute__ ((aligned ((1UL << 14)))) ;
+enum
+{
+ TCA_UNSPEC,
+ TCA_KIND,
+ TCA_OPTIONS,
+ TCA_STATS,
+ TCA_XSTATS,
+ TCA_RATE,
+};
+struct tc_stats
+{
+ __u64 bytes;
+ __u32 packets;
+ __u32 drops;
+ __u32 overlimits;
+ __u32 bps;
+ __u32 pps;
+ __u32 qlen;
+ __u32 backlog;
+ spinlock_t *lock;
+};
+struct sk_buff {
+ unsigned int data_len;
+ unsigned char *tail;
+ unsigned char *end;
+};
+static inline int skb_is_nonlinear(const struct sk_buff *skb)
+{
+ return skb->data_len;
+}
+static inline int skb_tailroom(const struct sk_buff *skb)
+{
+ return skb_is_nonlinear(skb) ? 0 : skb->end-skb->tail;
+}
+struct rtattr
+{
+ unsigned short rta_len;
+ unsigned short rta_type;
+};
+int qdisc_copy_stats(struct sk_buff *skb, struct tc_stats *st)
+{
+ do { do { (((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->irq_stat.f.bh_count)++; __asm__ __volatile__("": : :"memory"); } while (0); (void)(st->lock); } while (0);
+ ({ if (skb_tailroom(skb) < (int)( (((( ((sizeof(struct rtattr))+4 -1) & ~(4 -1) ) + ((char*)&st->lock - (char*)st)))+4 -1) & ~(4 -1) )) goto rtattr_failure; __rta_fill(skb, TCA_STATS, (char*)&st->lock - (char*)st, st); });
+ do { do { } while(0); do { do { __asm__ __volatile__("": : :"memory"); (((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->irq_stat.f.bh_count)--; } while (0); if (__builtin_expect((((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->softirq_pending), 0) && (((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->irq_stat.f.bh_count) == 0) do_softirq(); } while (0); } while (0);
+ return 0;
+rtattr_failure:
+ do { do { } while(0); do { do { __asm__ __volatile__("": : :"memory"); (((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->irq_stat.f.bh_count)--; } while (0); if (__builtin_expect((((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->softirq_pending), 0) && (((struct cpuinfo_ia64 *) (0xa000000000000000 + 2*(1UL << 14)))->irq_stat.f.bh_count) == 0) do_softirq(); } while (0); } while (0);
+ return -1;
+}
--- /dev/null
+/* PR target/6054 */
+/* { dg-do compile } */
+/* { dg-options "-O -mconstant-gp" } */
+/* { dg-final { scan-assembler "mov r1 =" } } */
+
+extern void direct (void);
+void foo(void (*indirect) (void))
+{
+ indirect ();
+ direct ();
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+extern void abort (void);
+extern void exit (int);
+
+int __attribute__((noinline, const))
+ret4 (float value)
+{
+ return 4;
+}
+
+int __attribute__((noinline, const))
+ret0 (float value)
+{
+ return 0;
+}
+
+float __attribute__((noinline))
+test (float x, float y)
+{
+ int clsx = ret4 (x);
+ int clsy = ret0 (y);
+
+ if (clsx == 0 || clsy == 0
+ || (y < 0 && clsx == 1 && clsy == 1))
+ return x - y;
+
+ return x < y ? 0 : x - y;
+}
+
+float a = 0.0, b;
+
+int main (void)
+{
+ unsigned long e;
+ b = a / a;
+ __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (e));
+ e &= ~0x7e000UL;
+ __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (e) : "memory");
+ a = test (0, b);
+ __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (e));
+ if (e & 0x2000)
+ abort ();
+ exit (0);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (int x, int y)
+{
+ if (y == 0)
+ {
+ register long r8 asm ("r8");
+ register long r15 asm ("r15") = 1;
+ long retval;
+ __asm __volatile ("foo" : "=r" (r8), "=r" (r15) : "1" (r15));
+ retval = r8;
+ y = retval;
+ }
+
+ {
+ register long r8 asm ("r8");
+ register long r15 asm ("r15") = 2;
+ long retval;
+ register long _out1 asm ("out1") = x;
+ register long _out0 asm ("out0") = y;
+ __asm __volatile ("foo"
+ : "=r" (r8), "=r" (r15) , "=r" (_out0), "=r" (_out1)
+ : "1" (r15) , "2" (_out0), "3" (_out1));
+ retval = r8;
+ return retval;
+ }
+}
--- /dev/null
+/* Origin: PR target/11693 from Andreas Schwab <schwab@suse.de> */
+/* { dg-do compile } */
+/* { dg-options "-O2 -frename-registers" } */
+
+static inline unsigned long
+foo (void)
+{
+ unsigned long x;
+ __asm__ __volatile__ ("" : "=r" (x) :: "memory");
+ return x;
+}
+
+static inline void
+bar (unsigned long x, unsigned long y)
+{
+ __asm__ __volatile__ ("" :: "r"(x), "r"(y) : "memory");
+}
+
+static inline void
+baz (unsigned long x, unsigned long y, unsigned long z, unsigned long p,
+ unsigned long q)
+{
+ __asm__ __volatile__ ("" :: "r" (q << 2) : "memory");
+ __asm__ __volatile__ ("" :: "r" (z) : "memory");
+ if (x & 0x1)
+ __asm__ __volatile__ ("" :: "r" (y), "r" (p) : "memory");
+ if (x & 0x2)
+ __asm__ __volatile__ ("" :: "r" (y), "r" (p) : "memory");
+}
+
+static inline unsigned long
+ffz (unsigned long x)
+{
+ unsigned long r;
+ __asm__ ("" : "=r" (r) : "r" (x & (~x - 1)));
+ return r;
+}
+
+void die (const char *, ...) __attribute__ ((noreturn));
+
+void
+test (void *x)
+{
+ unsigned long a, c;
+
+ a = foo ();
+ bar (0xc000000000000000, 0x660);
+ bar (0xa00000000000c000, 0x539);
+ baz (2, 1, 0xa000000000008000,
+ ({ unsigned long b;
+ b = ({ unsigned long d; __asm__ ("" : "=r" (d) : "r" (x)); d; })
+ + 0x10000000000661;
+ b;
+ }),
+ 14);
+ c = ffz (0x1fffffffffffffff);
+ if (c < 51 || c > 61)
+ die ("die", c - 1);
+}
--- /dev/null
+/* Test floating point division on ia64. There was a bug in the
+ max-throughput version of the inline division code. Expecting an
+ exact value from a floating point expression is unwise but GCC
+ depends on it in allocno_compare. */
+
+/* { dg-do run } */
+/* { dg-options "-minline-float-divide-max-throughput" } */
+
+extern void abort (void);
+
+volatile int i = 24;
+volatile int j = 30;
+volatile int k = 1;
+
+int main()
+{
+ int pri2 = (((double) i / j) * (10000 / 1000) * k);
+ if (pri2 != 8) abort();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-options } */
+
+extern void abort (void);
+
+/* Test that "=S" properly avoids the post-increment on the memory address. */
+
+static void foo(int *x)
+{
+ long i;
+ for (i = 0; i < 100; ++i)
+ __asm__("st4 %0 = r0" : "=S"(x[i]));
+}
+
+int main()
+{
+ int array[100];
+ long i;
+
+ for (i = 0; i < 100; ++i)
+ array[i] = -1;
+
+ foo(array);
+
+ for (i = 0; i < 100; ++i)
+ if (array[i])
+ abort ();
+ return 0;
+}
--- /dev/null
+/* Bug 14610 */
+/* { dg-do run } */
+
+extern void abort(void);
+volatile __float80 x = 30.0;
+
+int main(void)
+{
+ double d = x;
+ if (d != 30.0) abort ();
+ return 0;
+}
--- /dev/null
+/* Bug 14610 */
+/* { dg-do run } */
+/* { dg-options "-minline-int-divide-max-throughput" } */
+
+extern void abort(void);
+volatile int j = 30;
+
+int main(void)
+{
+ if (29 % j != 29) abort();
+ if (30 % j != 0) abort();
+ return 0;
+}
--- /dev/null
+/* { dg-do run { target ia64-*-linux* } } */
+/* { dg-options "-O2" } */
+
+/* Test function descriptor access. */
+
+extern unsigned long *_GLOBAL_OFFSET_TABLE_;
+extern void abort(void);
+
+struct ia64_fdesc
+{
+ unsigned long func;
+ unsigned long gp;
+};
+
+void
+os_boot_rendez (void)
+{
+}
+
+static int
+check (unsigned long gp)
+{
+ return gp != (unsigned long) &_GLOBAL_OFFSET_TABLE_;
+}
+
+int
+main (int argc, char **argv)
+{
+ int i;
+ int res = 0;
+
+ for (i = 0; i < 1; i++)
+ res += check (((struct ia64_fdesc *) os_boot_rendez)->gp);
+ if (res)
+ abort ();
+ return res;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIC" } */
+
+/* { dg-final { scan-assembler "@ltoffx\\(object#\\)" } } */
+/* { dg-final { scan-assembler "@ltoffx\\(object#\[-+\]16384\\)" } } */
+/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]1\\)" } } */
+/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]8191\\)" } } */
+/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]8192\\)" } } */
+/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]8193\\)" } } */
+/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]16383\\)" } } */
+/* { dg-final { scan-assembler-not "@ltoffx\\(object#\[-+\]16385\\)" } } */
+
+/* must not be in sdata */
+extern char object[];
+
+#define r(n) char *r_##n (void) { return &object[n]; }
+#define R(n) char *R_##n (void) { return &object[-n]; }
+
+#define t(n) r(n) R(n)
+
+t(0) t(1)
+t(8191) t(8192) t(8193)
+t(16383) t(16384) t(16385)
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mlp64" { target ia64-*-hpux* } } */
+
+void copy_loop_ldouble (void *xdest,
+ const void *xsrc,
+ long roff,
+ long soff,
+ long len,
+ long shift)
+{ __float128 *dest = xdest;
+ const long double *src;
+ long i;
+ roff /= sizeof (__float128);
+ soff /= sizeof (__float128);
+ src = xsrc;
+ src += shift * soff;
+ for (i = 0; i < len - shift; ++i) {
+ *dest = *src;
+ dest += roff;
+ src += soff;
+ }
+}
--- /dev/null
+/* { dg-do compile { target ia64*-hp-hpux* } } */
+
+/* Test that __fpreg is distinct from any other builtin type. */
+
+extern float fr1; /* { dg-error "" } */
+extern __fpreg fr1; /* { dg-error "" } */
+extern double fr2; /* { dg-error "" } */
+extern __fpreg fr2; /* { dg-error "" } */
+extern long double fr3; /* { dg-error "" } */
+extern __fpreg fr3; /* { dg-error "" } */
+extern __float80 fr4; /* { dg-error "" } */
+extern __fpreg fr4; /* { dg-error "" } */
+extern __float128 fr5; /* { dg-error "" } */
+extern __fpreg fr5; /* { dg-error "" } */
+
+/* Test that __float80 is distinct from any other builtin type. */
+
+extern float f801; /* { dg-error "" } */
+extern __float80 f801; /* { dg-error "" } */
+extern double f802; /* { dg-error "" } */
+extern __float80 f802; /* { dg-error "" } */
+extern long double f803; /* { dg-error "" } */
+extern __float80 f803; /* { dg-error "" } */
+extern __fpreg f804; /* { dg-error "" } */
+extern __float80 f804; /* { dg-error "" } */
+extern __float128 f805; /* { dg-error "" } */
+extern __float80 f805; /* { dg-error "" } */
+
+/* Test that __float128 is distinct from any other builtin type --
+ except "long double", for which it is a synonym. */
+
+extern float f1281; /* { dg-error "" } */
+extern __float128 f1281; /* { dg-error "" } */
+extern double f1282; /* { dg-error "" } */
+extern __float128 f1282; /* { dg-error "" } */
+extern long double f1283;
+extern __float128 f1283;
+extern __fpreg f1284; /* { dg-error "" } */
+extern __float128 f1284; /* { dg-error "" } */
+extern __float80 f1285; /* { dg-error "" } */
+extern __float128 f1285; /* { dg-error "" } */
--- /dev/null
+/* { dg-do run { target ia64*-hp-hpux* } } */
+/* { dg-options } */
+
+/* Test that the sizes and alignments of the extra floating-point
+ types are correct. */
+
+int main () {
+ if (sizeof (__fpreg) != 16)
+ return 1;
+ if (__alignof__ (__fpreg) != 16)
+ return 2;
+
+ if (sizeof (__float80) != 16)
+ return 3;
+ if (__alignof__ (__float80) != 16)
+ return 4;
+
+ return 0;
+}
+
--- /dev/null
+/* Test visibility attribute. */
+/* { dg-do compile { target ia64*-*-linux* } } */
+/* { dg-options "-O2 -fpic" } */
+/* { dg-final { scan-assembler "\\.hidden.*variable_j" } } */
+/* { dg-final { scan-assembler "\\.hidden.*variable_m" } } */
+/* { dg-final { scan-assembler "\\.protected.*baz" } } */
+/* { dg-final { scan-assembler "gprel.*variable_i" } } */
+/* { dg-final { scan-assembler "gprel.*variable_j" } } */
+/* { dg-final { scan-assembler "ltoff.*variable_k" } } */
+/* { dg-final { scan-assembler "gprel.*variable_l" } } */
+/* { dg-final { scan-assembler "gprel.*variable_m" } } */
+/* { dg-final { scan-assembler "ltoff.*variable_n" } } */
+
+static int variable_i;
+int variable_j __attribute__((visibility ("hidden")));
+int variable_k;
+struct A { char a[64]; };
+static struct A variable_l __attribute__((section (".sbss")));
+struct A variable_m __attribute__((visibility ("hidden"), section(".sbss")));
+struct A variable_n __attribute__((section (".sbss")));
+
+int foo (void)
+{
+ return variable_i + variable_j + variable_k;
+}
+
+void bar (void)
+{
+ variable_l.a[10] = 0;
+ variable_m.a[10] = 0;
+ variable_n.a[10] = 0;
+}
+
+void __attribute__((visibility ("protected"))) baz (void)
+{
+}
--- /dev/null
+/* Test visibility attribute. */
+/* { dg-do link { target ia64*-*-linux* } } */
+/* { dg-options "-O2 -fpic" } */
+
+int foo (int x);
+int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
+int bar (int x)
+{
+ return x;
+}
+
+int main ()
+{
+ return 0;
+}