diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg')
48 files changed, 501 insertions, 39 deletions
diff --git a/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c b/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c index d89e72f8171..b6c783ddaba 100644 --- a/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c +++ b/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c @@ -1,8 +1,9 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ +/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of __atomic_compare_exchange_n builtin for a long_long. */ diff --git a/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c b/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c index e716dcb350c..4cc0209b33f 100644 --- a/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c +++ b/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c @@ -1,8 +1,8 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128 } */ -/* { dg-options "-mcx16" { target { x86_64-*-* } } } */ +/* { dg-require-effective-target sync_int_128_runtime } */ +/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ /* Test the execution of __atomic_compare_exchange_n builtin for an int_128. */ diff --git a/gcc/testsuite/gcc.dg/atomic-exchange-4.c b/gcc/testsuite/gcc.dg/atomic-exchange-4.c index f0530fc462c..13022dd38d2 100644 --- a/gcc/testsuite/gcc.dg/atomic-exchange-4.c +++ b/gcc/testsuite/gcc.dg/atomic-exchange-4.c @@ -1,8 +1,9 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ +/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of the __atomic_X builtin for a long_long. */ diff --git a/gcc/testsuite/gcc.dg/atomic-exchange-5.c b/gcc/testsuite/gcc.dg/atomic-exchange-5.c index 13fd6d1b8ec..b0c84b17fd3 100644 --- a/gcc/testsuite/gcc.dg/atomic-exchange-5.c +++ b/gcc/testsuite/gcc.dg/atomic-exchange-5.c @@ -1,8 +1,8 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128 } */ -/* { dg-options "-mcx16" { target { x86_64-*-* } } } */ +/* { dg-require-effective-target sync_int_128_runtime } */ +/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ /* Test the execution of the __atomic_X builtin for a 16 byte value. */ diff --git a/gcc/testsuite/gcc.dg/atomic-generic-aux.c b/gcc/testsuite/gcc.dg/atomic-generic-aux.c index a6b552a5dfd..2f4cb2a88f7 100644 --- a/gcc/testsuite/gcc.dg/atomic-generic-aux.c +++ b/gcc/testsuite/gcc.dg/atomic-generic-aux.c @@ -19,17 +19,30 @@ __atomic_exchange (size_t size, void *obj, void *val, void *ret, int model) } +/* Note that the external version of this routine has the boolean weak/strong + parameter removed. This is required by teh external library. */ bool -__atomic_compare_exchange (size_t size, void *obj, void *expected, +__atomic_compare_exchange (size_t size, void *obj, void *expected, void *desired, int model1, int model2) { + bool ret; if (!memcmp (obj, expected, size)) { memcpy (obj, desired, size); - return true; + ret = true; } - memcpy (expected, obj, size); - return false; + else + { + memcpy (expected, obj, size); + ret = false; + } + + /* Make sure the parameters have been properly adjusted for the external + function call (no weak/strong parameter. */ + if (model1 != __ATOMIC_SEQ_CST || model2 != __ATOMIC_ACQUIRE) + ret = !ret; + + return ret; } diff --git a/gcc/testsuite/gcc.dg/atomic-generic.c b/gcc/testsuite/gcc.dg/atomic-generic.c index 8a5528c3653..d77e97dbf8a 100644 --- a/gcc/testsuite/gcc.dg/atomic-generic.c +++ b/gcc/testsuite/gcc.dg/atomic-generic.c @@ -41,12 +41,12 @@ main () if (memcmp (&b, &ones, size)) abort (); - if (!__atomic_compare_exchange (&a, &b, &zero, false, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) + if (!__atomic_compare_exchange (&a, &b, &zero, false, __ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE)) abort(); if (memcmp (&a, &zero, size)) abort (); - if (__atomic_compare_exchange (&a, &b, &ones, false, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) + if (__atomic_compare_exchange (&a, &b, &ones, false, __ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE)) abort(); if (memcmp (&b, &zero, size)) abort (); diff --git a/gcc/testsuite/gcc.dg/atomic-load-4.c b/gcc/testsuite/gcc.dg/atomic-load-4.c index 5cb7659da70..032ad246fd0 100644 --- a/gcc/testsuite/gcc.dg/atomic-load-4.c +++ b/gcc/testsuite/gcc.dg/atomic-load-4.c @@ -1,8 +1,9 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ +/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ extern void abort(void); diff --git a/gcc/testsuite/gcc.dg/atomic-load-5.c b/gcc/testsuite/gcc.dg/atomic-load-5.c index 2991e4d6c7a..31d806633e1 100644 --- a/gcc/testsuite/gcc.dg/atomic-load-5.c +++ b/gcc/testsuite/gcc.dg/atomic-load-5.c @@ -1,8 +1,8 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128 } */ -/* { dg-options "-mcx16" { target { x86_64-*-* } } } */ +/* { dg-require-effective-target sync_int_128_runtime } */ +/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ extern void abort(void); diff --git a/gcc/testsuite/gcc.dg/atomic-noinline-aux.c b/gcc/testsuite/gcc.dg/atomic-noinline-aux.c index b05460e469b..deab7ae1de3 100644 --- a/gcc/testsuite/gcc.dg/atomic-noinline-aux.c +++ b/gcc/testsuite/gcc.dg/atomic-noinline-aux.c @@ -30,9 +30,15 @@ __atomic_store_1 (char *p, char v, int i) *p = 1; } -int __atomic_compare_exchange_2 (short *p, short *a, short b, int x, int y, int z) +int __atomic_compare_exchange_2 (short *p, short *a, short b, int y, int z) { - *p = 1; + /* Fail if the memory models aren't correct as that will indicate the external + call has failed to remove the weak/strong parameter as required by the + library. */ + if (y != __ATOMIC_SEQ_CST || z != __ATOMIC_ACQUIRE) + *p = 0; + else + *p = 1; } char __atomic_fetch_add_1 (char *p, char v, int i) diff --git a/gcc/testsuite/gcc.dg/atomic-noinline.c b/gcc/testsuite/gcc.dg/atomic-noinline.c index eb0866e549e..626254d8a9a 100644 --- a/gcc/testsuite/gcc.dg/atomic-noinline.c +++ b/gcc/testsuite/gcc.dg/atomic-noinline.c @@ -31,7 +31,7 @@ main () if (ac != 1) abort (); - __atomic_compare_exchange_n (&as, &bs, cs, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); + __atomic_compare_exchange_n (&as, &bs, cs, 0, __ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE); if (as != 1) abort (); diff --git a/gcc/testsuite/gcc.dg/atomic-op-4.c b/gcc/testsuite/gcc.dg/atomic-op-4.c index 39650213edf..7c4a819bfaa 100644 --- a/gcc/testsuite/gcc.dg/atomic-op-4.c +++ b/gcc/testsuite/gcc.dg/atomic-op-4.c @@ -1,8 +1,9 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ +/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of the __atomic_*OP builtin routines for long long. */ diff --git a/gcc/testsuite/gcc.dg/atomic-op-5.c b/gcc/testsuite/gcc.dg/atomic-op-5.c index 2ca71adc8f1..e78d8150997 100644 --- a/gcc/testsuite/gcc.dg/atomic-op-5.c +++ b/gcc/testsuite/gcc.dg/atomic-op-5.c @@ -1,8 +1,8 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128 } */ -/* { dg-options "-mcx16" { target { x86_64-*-* } } } */ +/* { dg-require-effective-target sync_int_128_runtime } */ +/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ /* Test the execution of the __atomic_*OP builtin routines for an int_128. */ diff --git a/gcc/testsuite/gcc.dg/atomic-pr51256.c b/gcc/testsuite/gcc.dg/atomic-pr51256.c new file mode 100644 index 00000000000..2d39549c890 --- /dev/null +++ b/gcc/testsuite/gcc.dg/atomic-pr51256.c @@ -0,0 +1,47 @@ +/* Test generic __atomic routines for various errors. */ +/* { dg-do compile } */ +/* { dg-require-effective-target sync_int_long } */ +/* { dg-options "-ansi" } */ + +void f1 (void* p) +{ + __atomic_compare_exchange(p, p, p, 0, 0, 0); /* { dg-error "must be a non-void pointer type" } */ +} + +void f2 (int n) +{ + int a[n], b[n]; + __atomic_load (&a, &b, __ATOMIC_SEQ_CST); /* { dg-error "must be a pointer to a constant size" } */ +} + +struct s { }; +void f3 (void) +{ + struct s a,b; + __atomic_load (&a, &b, __ATOMIC_SEQ_CST); /* { dg-error "must be a pointer to a nonzero size" } */ +} + +void f4 (int a, int b, int c) +{ + __atomic_load (&a, &b, &c, __ATOMIC_SEQ_CST); /* { dg-error "incorrect number of arguments" } */ +} + +void f5 (int a, int b) +{ + __atomic_load (&a, b, __ATOMIC_SEQ_CST); /* { dg-error "must be a pointer type" } */ +} + +void f6 (int a, char b) +{ + __atomic_load (&a, &b, __ATOMIC_SEQ_CST); /* { dg-error "size mismatch in argument" } */ +} + +void f7 (int a, int b) +{ + __atomic_load (&a, &b, 45); /* { dg-warning "invalid memory model argument" } */ +} + +void f8 (int a, int b, float c) +{ + __atomic_load (&a, &b, c); /* { dg-error "non-integer memory model argument" } */ +} diff --git a/gcc/testsuite/gcc.dg/atomic-store-4.c b/gcc/testsuite/gcc.dg/atomic-store-4.c index f77e1831ad8..0863be99d01 100644 --- a/gcc/testsuite/gcc.dg/atomic-store-4.c +++ b/gcc/testsuite/gcc.dg/atomic-store-4.c @@ -1,8 +1,9 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ +/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of the __atomic_store_n builtin for a long long. */ diff --git a/gcc/testsuite/gcc.dg/atomic-store-5.c b/gcc/testsuite/gcc.dg/atomic-store-5.c index f976a052c7c..763d29e240c 100644 --- a/gcc/testsuite/gcc.dg/atomic-store-5.c +++ b/gcc/testsuite/gcc.dg/atomic-store-5.c @@ -1,8 +1,8 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128 } */ -/* { dg-options "-mcx16" { target { x86_64-*-* } } } */ +/* { dg-require-effective-target sync_int_128_runtime } */ +/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ /* Test the execution of the __atomic_store_n builtin for a 16 byte value. */ diff --git a/gcc/testsuite/gcc.dg/autopar/pr49960-1.c b/gcc/testsuite/gcc.dg/autopar/pr49960-1.c new file mode 100644 index 00000000000..ac9d5678499 --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/pr49960-1.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ + +#include <stdlib.h> +#include <stdio.h> + +int main() +{ + unsigned int x, y, idx, H = 1024, W = 1024; + + int * tmps = (int *)malloc(H*W*sizeof(int)); + + /* This loop gets parallelized even though output dependences exist + between writes to 'tmps' that prevent parallelization. + For example: tmps[1] = 1, ..., tmps[1] = 17. */ + + for(x = 1; x < H; x++) + { + for(y = 1; y < W; y++) + { + idx = x*W+y; + tmps[idx % 4096] = idx; + } + } + + for(x = 1; x < 8; x++) + printf("tmps[%d]=%d\n", x, tmps[x]); + + return 0; +} +/* Check that no loop gets parallelized. */ + +/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 0 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "loopfn" 0 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/autopar/pr49960.c b/gcc/testsuite/gcc.dg/autopar/pr49960.c new file mode 100644 index 00000000000..1f3482f170d --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/pr49960.c @@ -0,0 +1,49 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ + +#include <stdio.h> +#define MB 100 +#define NA 450 +#define MA 400 + +int T[MA][MB],A[MA][NA],B[MB][NA]; +void MRTRBR(int MA_1, int NA_1, int MB_1) +{ + int i,j, t,k; + + /* The outer most loop is not parallel because for different k's there + is write-write dependency for T[i][j]. */ + + /* The two inner loops don't get parallelized due to low number of + iterations. */ + + for (k = 3; k < NA_1; k++) + for (i = 3; i < MA_1; i++) + for (j = 3; j < MB_1; j++) + { + t = T[i][j]; + T[i][j] = t+2+A[i][k]*B[j][k]; + } +} +void main () +{ + int j,i; + + for (i = 3; i < MA; i++) + for (j = 3; j < MB; j++) + T[i][j] = (i>j?i:j); + + MRTRBR (MA,NA,MB); + + for (i = MA-1; i < MA; i++) + for (j = MB-10; j < MB; j++) + printf ("i %d j %d T[i][j] = %d\n",i,j,T[i][j]); +} + + +/* Check that the outer most loop doesn't get parallelized (thus no loop gets parallelized) */ + +/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 0 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "loopfn" 0 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "parloops" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/cpp/assert4.c b/gcc/testsuite/gcc.dg/cpp/assert4.c index a05ef130206..514195313b3 100644 --- a/gcc/testsuite/gcc.dg/cpp/assert4.c +++ b/gcc/testsuite/gcc.dg/cpp/assert4.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2006, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2006, 2008, 2009, 2011 Free Software Foundation, Inc. Test builtin preprocessor assertions. By Kaveh Ghazi <ghazi@caip.rutgers.edu>. */ @@ -7,7 +7,7 @@ /* Check for #system assertions. */ -#if defined __gnu_linux__ +#if defined __linux__ # if !#system(linux) || !#system(unix) || !#system(posix) # error # endif diff --git a/gcc/testsuite/gcc.dg/delay-slot-2.c b/gcc/testsuite/gcc.dg/delay-slot-2.c new file mode 100644 index 00000000000..79faf81c798 --- /dev/null +++ b/gcc/testsuite/gcc.dg/delay-slot-2.c @@ -0,0 +1,116 @@ +/* PR rtl-optimization/51187 */ +/* Reported by Jurij Smakov <jurij@wooyd.org> */ + +/* { dg-do compile } */ +/* { dg-options "-g -O2" } */ + +extern int printf (__const char *__restrict __format, ...); +extern void print_c_condition (const char *); + +enum decision_type +{ + DT_num_insns, + DT_mode, DT_code, DT_veclen, + DT_elt_zero_int, DT_elt_one_int, DT_elt_zero_wide, DT_elt_zero_wide_safe, + DT_const_int, + DT_veclen_ge, DT_dup, DT_pred, DT_c_test, + DT_accept_op, DT_accept_insn +}; + +struct decision_test +{ + struct decision_test *next; + enum decision_type type; + + union + { + int num_insns; + + struct + { + const char *name; + } pred; + + const char *c_test; + int veclen; + int dup; + long intval; + int opno; + + struct { + int code_number; + int lineno; + int num_clobbers_to_add; + } insn; + } u; +}; + +enum routine_type { + RECOG, SPLIT, PEEPHOLE2 +}; + +void +write_cond (struct decision_test *p, int depth, + enum routine_type subroutine_type) +{ + switch (p->type) + { + case DT_num_insns: + printf ("peep2_current_count >= %d", p->u.num_insns); + break; + + case DT_code: + printf ("GET_CODE (x%d) == ", depth); + break; + + case DT_veclen: + printf ("XVECLEN (x%d, 0) == %d", depth, p->u.veclen); + break; + + case DT_elt_zero_int: + printf ("XINT (x%d, 0) == %d", depth, (int) p->u.intval); + break; + + case DT_elt_one_int: + printf ("XINT (x%d, 1) == %d", depth, (int) p->u.intval); + break; + + case DT_elt_zero_wide: + case DT_elt_zero_wide_safe: + printf ("XWINT (x%d, 0) == ", depth); + print_host_wide_int (p->u.intval); + break; + + case DT_const_int: + printf ("x%d == const_int_rtx[MAX_SAVED_CONST_INT + (%d)]", + depth, (int) p->u.intval); + break; + + case DT_veclen_ge: + printf ("XVECLEN (x%d, 0) >= %d", depth, p->u.veclen); + break; + + case DT_dup: + printf ("rtx_equal_p (x%d, operands[%d])", depth, p->u.dup); + break; + + case DT_pred: + printf ("%s (x%d)", p->u.pred.name, depth); + break; + + case DT_c_test: + print_c_condition (p->u.c_test); + break; + + case DT_accept_insn: + ((void)(__builtin_expect(!(subroutine_type == RECOG), 0) ? __builtin_unreachable(), 0 : 0)); + ((void)(__builtin_expect(!(p->u.insn.num_clobbers_to_add), 0) ? __builtin_unreachable(), 0 : 0)); + printf ("pnum_clobbers != NULL"); + break; + + default: + __builtin_unreachable(); + } +} + +/* { dg-final { scan-assembler "printf" } } */ diff --git a/gcc/testsuite/gcc.dg/di-longlong64-sync-1.c b/gcc/testsuite/gcc.dg/di-longlong64-sync-1.c index 82a4ea24617..f04cf62e03d 100644 --- a/gcc/testsuite/gcc.dg/di-longlong64-sync-1.c +++ b/gcc/testsuite/gcc.dg/di-longlong64-sync-1.c @@ -1,6 +1,8 @@ /* { dg-do run } */ -/* { dg-require-effective-target sync_longlong } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "-std=gnu99" } */ +/* { dg-additional-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ + /* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ /* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/di-sync-multithread.c b/gcc/testsuite/gcc.dg/di-sync-multithread.c index c99878ea129..307ebf8b314 100644 --- a/gcc/testsuite/gcc.dg/di-sync-multithread.c +++ b/gcc/testsuite/gcc.dg/di-sync-multithread.c @@ -1,8 +1,9 @@ /* { dg-do run } */ -/* { dg-require-effective-target sync_longlong } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-require-effective-target pthread_h } */ /* { dg-require-effective-target pthread } */ /* { dg-options "-pthread -std=gnu99" } */ +/* { dg-additional-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* test of long long atomic ops performed in parallel in 3 pthreads david.gilbert@linaro.org */ diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c b/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c new file mode 100644 index 00000000000..87060ccf7e7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c @@ -0,0 +1,12 @@ +/* { dg-lto-options {{-flto -fgnu-tm}} } */ +/* { dg-lto-do link } */ + +int i; + +main() +{ + __transaction_atomic + { + i = 0; + } +} diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c b/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c new file mode 100644 index 00000000000..cb80f320baa --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c @@ -0,0 +1,9 @@ +#define dummy(func) \ + __attribute__((noinline,noclone,used)) void func() { asm (""); } + +dummy(_ITM_beginTransaction) +dummy(_ITM_commitTransaction) +dummy(_ITM_WU4) +dummy(_ITM_WU8) +dummy(_ITM_registerTMCloneTable) +dummy(_ITM_deregisterTMCloneTable) diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c b/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c new file mode 100644 index 00000000000..301a711a4f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c @@ -0,0 +1,22 @@ +/* { dg-lto-options {{-flto -fgnu-tm}} } */ +/* { dg-lto-do link } */ + +extern void foobar() __attribute__((transaction_callable)); + +#define dummy(func) \ + __attribute__((noinline,noclone,used)) void func() { asm (""); } + +dummy(_ITM_beginTransaction) +dummy(_ITM_commitTransaction) +dummy(_ITM_WU4) +dummy(_ITM_WU8) +dummy(_ITM_registerTMCloneTable) +dummy(_ITM_deregisterTMCloneTable) + +main() +{ + __transaction_relaxed + { + foobar(); + } +} diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c b/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c new file mode 100644 index 00000000000..fb6918d6584 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c @@ -0,0 +1,4 @@ +__attribute__((transaction_callable,noinline)) +void foobar() +{ +} diff --git a/gcc/testsuite/gcc.dg/pr43864-2.c b/gcc/testsuite/gcc.dg/pr43864-2.c index 1a0d9491a17..f00fff9fa91 100644 --- a/gcc/testsuite/gcc.dg/pr43864-2.c +++ b/gcc/testsuite/gcc.dg/pr43864-2.c @@ -19,4 +19,5 @@ f (int c, int b, int d) /* { dg-final { scan-tree-dump-times "if " 0 "pre"} } */ /* { dg-final { scan-tree-dump-times "_.*\\\+.*_" 1 "pre"} } */ +/* { dg-final { scan-tree-dump-not "Invalid sum" "pre"} } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/pr43864-3.c b/gcc/testsuite/gcc.dg/pr43864-3.c index 622a5649541..c4954e1bd72 100644 --- a/gcc/testsuite/gcc.dg/pr43864-3.c +++ b/gcc/testsuite/gcc.dg/pr43864-3.c @@ -20,4 +20,5 @@ int f(int c, int b, int d) /* { dg-final { scan-tree-dump-times "if " 0 "pre"} } */ /* { dg-final { scan-tree-dump-times "_.*\\\+.*_" 1 "pre"} } */ +/* { dg-final { scan-tree-dump-not "Invalid sum" "pre"} } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/pr43864-4.c b/gcc/testsuite/gcc.dg/pr43864-4.c index 3e3d643947d..42adfeefe95 100644 --- a/gcc/testsuite/gcc.dg/pr43864-4.c +++ b/gcc/testsuite/gcc.dg/pr43864-4.c @@ -25,4 +25,5 @@ int f(int c, int b, int d) /* { dg-final { scan-tree-dump-times "if " 0 "pre"} } */ /* { dg-final { scan-tree-dump-times "_.*\\\+.*_" 1 "pre"} } */ /* { dg-final { scan-tree-dump-times " - " 2 "pre"} } */ +/* { dg-final { scan-tree-dump-not "Invalid sum" "pre"} } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/pr43864.c b/gcc/testsuite/gcc.dg/pr43864.c index 03c2d49c0fc..8d1e989fb18 100644 --- a/gcc/testsuite/gcc.dg/pr43864.c +++ b/gcc/testsuite/gcc.dg/pr43864.c @@ -32,4 +32,5 @@ hprofStartupp (char *outputFileName, char *ctx) } /* { dg-final { scan-tree-dump-times "myfree \\(" 1 "pre"} } */ +/* { dg-final { scan-tree-dump-not "Invalid sum" "pre"} } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/pr50290.c b/gcc/testsuite/gcc.dg/pr50290.c new file mode 100644 index 00000000000..47680fd9a72 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr50290.c @@ -0,0 +1,27 @@ +/* PR rtl-optimization/50290 */ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-tree-loop-optimize -fno-tree-vrp -funroll-loops" } */ + +static int +bar (int t[], int b) +{ + int i; + for (i = 0; i < b; i++) + t[i] = i + (i > 0 ? t[i - 1] : 0); + return t[b - 1]; +} + +static int +foo (int b) +{ + int x[b]; + return bar (x, b); +} + +int +main () +{ + if (foo (6) != 15) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr50764.c b/gcc/testsuite/gcc.dg/pr50764.c new file mode 100644 index 00000000000..e3b8da8670f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr50764.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fsched2-use-superblocks -ftree-tail-merge" } */ + +typedef int aligned __attribute__ ((aligned (64))); +extern void abort (void); + +int bar (void *p); + +void +foo (void) +{ + char *p = __builtin_alloca (13); + aligned i; + + if (bar (p) || bar (&i)) + abort (); +} diff --git a/gcc/testsuite/gcc.dg/pr50765.c b/gcc/testsuite/gcc.dg/pr50765.c new file mode 100644 index 00000000000..6e1c6974750 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr50765.c @@ -0,0 +1,10 @@ +/* PR tree-optimization/50765 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -fno-tree-dce" } */ + +void +foo (long *w, long *x, unsigned char *y, int z) +{ + for (; z < 429; z++) + w[z] = (-19 ^ y[z]) & x[z]; +} diff --git a/gcc/testsuite/gcc.dg/pr50827.c b/gcc/testsuite/gcc.dg/pr50827.c new file mode 100644 index 00000000000..5d258bfcf0a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr50827.c @@ -0,0 +1,17 @@ +/* PR debug/50827 */ +/* { dg-do compile } */ +/* { dg-options "-g -O2 -funroll-loops" } */ + +void +foo (int w, int x, int *y, int *z) +{ + float f; + while (w--) + { + f = x; + if (y) + *y = (__INTPTR_TYPE__) y + w; + if (z) + *z = w; + } +} diff --git a/gcc/testsuite/gcc.dg/pr51261.c b/gcc/testsuite/gcc.dg/pr51261.c new file mode 100644 index 00000000000..b599a6b7db8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr51261.c @@ -0,0 +1,9 @@ +/* PR target/51261 */ +/* { dg-do compile } */ +/* { dg-options "-fcompare-debug" } */ + +void +foo (void *p, int n) +{ + __builtin_memset (p, 0xff, n); +} diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c index 3ade0d6fad3..c5aa623e685 100644 --- a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c +++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c @@ -1,5 +1,5 @@ /* { dg-do link } */ -/* { dg-require-effective-target sync_int_128 } */ +/* { dg-require-effective-target sync_int_128_runtime } */ /* { dg-options "-mcx16" { target { x86_64-*-* i?86-*-* } } } */ /* { dg-final { simulate-thread } } */ diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c index 8bc2eaace65..91f9a062714 100644 --- a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c +++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c @@ -1,6 +1,7 @@ /* { dg-do link } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ +/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* { dg-final { simulate-thread } } */ diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c index 67f84a14a00..6aaaa88ef04 100644 --- a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c +++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c @@ -1,6 +1,6 @@ /* { dg-do link } */ -/* { dg-require-effective-target sync_int_128 } */ -/* { dg-options "-mcx16" { target { x86_64-*-* i?86-*-*] } } } */ +/* { dg-require-effective-target sync_int_128_runtime } */ +/* { dg-options "-mcx16" { target { x86_64-*-* i?86-*-* } } } */ /* { dg-final { simulate-thread } } */ #include <stdio.h> diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c index ac4330bd8a4..087c4660cfb 100644 --- a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c +++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c @@ -1,6 +1,7 @@ /* { dg-do link } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ +/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* { dg-final { simulate-thread } } */ diff --git a/gcc/testsuite/gcc.dg/tm/20100615.c b/gcc/testsuite/gcc.dg/tm/20100615.c index 3d9e4684e5d..26964d43367 100644 --- a/gcc/testsuite/gcc.dg/tm/20100615.c +++ b/gcc/testsuite/gcc.dg/tm/20100615.c @@ -3,7 +3,8 @@ /* Since the non TM version of new_node() gets optimized away, it shouldn't appear in the clone table either. */ -/* { dg-final { scan-assembler-not "tm_clone_table" } } */ +/* { dg-final { scan-assembler-not "tm_clone_table" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-not "__DATA,__tm_clone_table" { target *-*-darwin* } } } */ #define NULL 0 extern void *malloc (__SIZE_TYPE__); diff --git a/gcc/testsuite/gcc.dg/tm/memopt-13.c b/gcc/testsuite/gcc.dg/tm/memopt-13.c index 6e93b7feaea..381e682bca0 100644 --- a/gcc/testsuite/gcc.dg/tm/memopt-13.c +++ b/gcc/testsuite/gcc.dg/tm/memopt-13.c @@ -13,3 +13,4 @@ void f() } /* { dg-final { scan-tree-dump-times "memmoveRtWt \\\(&large_global," 1 "tmmark" } } */ +/* { dg-final { cleanup-tree-dump "tmmark" } } */ diff --git a/gcc/testsuite/gcc.dg/tm/memopt-6.c b/gcc/testsuite/gcc.dg/tm/memopt-6.c index f4343736772..496ce2dd3e8 100644 --- a/gcc/testsuite/gcc.dg/tm/memopt-6.c +++ b/gcc/testsuite/gcc.dg/tm/memopt-6.c @@ -18,3 +18,4 @@ int f() } /* { dg-final { scan-tree-dump-times "memmoveRtWt \\\(&lala, &lacopy" 1 "tmedge" } } */ +/* { dg-final { cleanup-tree-dump "tmedge" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-2.c b/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-2.c index f555dfc9d8d..bf19fcd1594 100644 --- a/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-2.c +++ b/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-2.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target vect_double } */ + #include "tree-vect.h" extern long int lrint (double); diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-vect-call-2.c b/gcc/testsuite/gcc.dg/vect/fast-math-vect-call-2.c index edb6670b028..ed7a9dceef7 100644 --- a/gcc/testsuite/gcc.dg/vect/fast-math-vect-call-2.c +++ b/gcc/testsuite/gcc.dg/vect/fast-math-vect-call-2.c @@ -1,3 +1,5 @@ +/* { dg-require-effective-target vect_double } */ + #include "tree-vect.h" extern long int lrint (double); diff --git a/gcc/testsuite/gcc.dg/vect/pr30858.c b/gcc/testsuite/gcc.dg/vect/pr30858.c index 0af2f8e9a91..0e7f7e10d4d 100644 --- a/gcc/testsuite/gcc.dg/vect/pr30858.c +++ b/gcc/testsuite/gcc.dg/vect/pr30858.c @@ -11,5 +11,5 @@ foo (int ko) } /* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Unknown def-use cycle pattern." 1 "vect" } } */ +/* { dg-final { scan-tree-dump "Unknown def-use cycle pattern." "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr51074.c b/gcc/testsuite/gcc.dg/vect/pr51074.c new file mode 100644 index 00000000000..30913999400 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr51074.c @@ -0,0 +1,24 @@ +/* PR tree-optimization/51074 */ + +#include "tree-vect.h" + +struct S { int a, b; } s[8]; + +int +main () +{ + int i; + check_vect (); + for (i = 0; i < 8; i++) + { + s[i].b = 0; + s[i].a = i; + } + asm volatile ("" : : : "memory"); + for (i = 0; i < 8; i++) + if (s[i].b != 0 || s[i].a != i) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/volatile-bitfields-1.c b/gcc/testsuite/gcc.dg/volatile-bitfields-1.c new file mode 100644 index 00000000000..6adda27fea4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/volatile-bitfields-1.c @@ -0,0 +1,23 @@ +/* { dg-options "-fstrict-volatile-bitfields" } */ +/* { dg-do run } */ + +extern int puts(const char *); +extern void abort(void) __attribute__((noreturn)); + +typedef struct { + volatile unsigned short a:8, b:8; +} BitStruct; + +BitStruct bits = {1, 2}; + +void check(int i, int j) +{ + if (i != 1 || j != 2) puts("FAIL"), abort(); +} + +int main () +{ + check(bits.a, bits.b); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vshift-1.c b/gcc/testsuite/gcc.dg/vshift-1.c index 2a237aa2bbe..2220ad5a4fd 100644 --- a/gcc/testsuite/gcc.dg/vshift-1.c +++ b/gcc/testsuite/gcc.dg/vshift-1.c @@ -94,10 +94,10 @@ main () for (i = 0; i < N; i++) { asm (""); - c[i] = (random () << 1) | (random () & 1); + c[i] = (rand () << 1) | (rand () & 1); b[i] = (i * 85) & (sizeof (TYPE1) * __CHAR_BIT__ - 1); a[i] = c[i]; - d[i] = (random () << 1) | (random () & 1); + d[i] = (rand () << 1) | (rand () & 1); d[i] |= (unsigned long long) c[i] << 32; e[i] = (i * 85) & (sizeof (TYPE2) * __CHAR_BIT__ - 1); f[i] = d[i]; diff --git a/gcc/testsuite/gcc.dg/vshift-3.c b/gcc/testsuite/gcc.dg/vshift-3.c index e62c76b469f..367e6606551 100644 --- a/gcc/testsuite/gcc.dg/vshift-3.c +++ b/gcc/testsuite/gcc.dg/vshift-3.c @@ -100,9 +100,9 @@ main () for (i = 0; i < N; i++) { asm (""); - c[i] = (random () << 1) | (random () & 1); + c[i] = (rand () << 1) | (rand () & 1); a[i] = c[i]; - d[i] = (random () << 1) | (random () & 1); + d[i] = (rand () << 1) | (rand () & 1); d[i] |= (unsigned long long) c[i] << 32; f[i] = d[i]; } |