mirror of git://gcc.gnu.org/git/gcc.git
sync-1-v10.c, [...]: New tests.
* gcc.target/cris/sync-1-v10.c, gcc.target/cris/sync-1-v32.c, gcc.target/cris/sync-1.c, gcc.target/cris/sync-2c.c, gcc.target/cris/sync-2i.c, gcc.target/cris/sync-2s.c, gcc.target/cris/sync-3i.c, gcc.target/cris/sync-3s.c, gcc.target/cris/sync-4c.c, gcc.target/cris/sync-4i.c, gcc.target/cris/sync-4s.c, gcc.target/cris/torture/sync-mis-op-i-1.c, gcc.target/cris/torture/sync-mis-op-i-1a.c, gcc.target/cris/torture/sync-mis-op-i-2.c, gcc.target/cris/torture/sync-mis-op-i-2a.c, gcc.target/cris/torture/sync-mis-op-i-3.c, gcc.target/cris/torture/sync-mis-op-i-3a.c, gcc.target/cris/torture/sync-mis-op-s-1.c, gcc.target/cris/torture/sync-mis-op-s-1a.c, gcc.target/cris/torture/sync-mis-xchg-i-1.c, gcc.target/cris/torture/sync-mis-xchg-i-1a.c, gcc.target/cris/torture/sync-mis-xchg-i-2.c, gcc.target/cris/torture/sync-mis-xchg-i-2a.c, gcc.target/cris/torture/sync-mis-xchg-i-3.c, gcc.target/cris/torture/sync-mis-xchg-i-3a.c, gcc.target/cris/torture/sync-mis-xchg-s-1.c, gcc.target/cris/torture/sync-mis-xchg-s-1a.c: New tests. From-SVN: r188097
This commit is contained in:
parent
21ed44440f
commit
62330f08cb
|
@ -1,3 +1,28 @@
|
||||||
|
2012-06-01 Hans-Peter Nilsson <hp@axis.com>
|
||||||
|
|
||||||
|
* gcc.target/cris/sync-1-v10.c,
|
||||||
|
gcc.target/cris/sync-1-v32.c, gcc.target/cris/sync-1.c,
|
||||||
|
gcc.target/cris/sync-2c.c, gcc.target/cris/sync-2i.c,
|
||||||
|
gcc.target/cris/sync-2s.c, gcc.target/cris/sync-3i.c,
|
||||||
|
gcc.target/cris/sync-3s.c, gcc.target/cris/sync-4c.c,
|
||||||
|
gcc.target/cris/sync-4i.c, gcc.target/cris/sync-4s.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-op-i-1.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-op-i-1a.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-op-i-2.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-op-i-2a.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-op-i-3.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-op-i-3a.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-op-s-1.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-op-s-1a.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-xchg-i-1.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-xchg-i-1a.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-xchg-i-2.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-xchg-i-2a.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-xchg-i-3.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-xchg-i-3a.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-xchg-s-1.c,
|
||||||
|
gcc.target/cris/torture/sync-mis-xchg-s-1a.c: New tests.
|
||||||
|
|
||||||
2012-05-31 Richard Guenther <rguenther@suse.de>
|
2012-05-31 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
* gcc.dg/tree-ssa/ldist-pr45948-2.c: New testcase copy of
|
* gcc.dg/tree-ssa/ldist-pr45948-2.c: New testcase copy of
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* Check that we can assemble both base atomic variants. */
|
||||||
|
/* { dg-do assemble } */
|
||||||
|
/* { dg-options "-O2 -march=v10" } */
|
||||||
|
#include "sync-1.c"
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* Check that we can assemble both base atomic variants. */
|
||||||
|
/* { dg-do assemble } */
|
||||||
|
/* { dg-options "-O2 -march=v32" } */
|
||||||
|
#include "sync-1.c"
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* Check that we can assemble both base atomic variants, for v0. */
|
||||||
|
/* { dg-do assemble } */
|
||||||
|
/* { dg-options "-O2 -march=v0" } */
|
||||||
|
|
||||||
|
#ifndef type
|
||||||
|
#define type char
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(op) && !defined(xchg)
|
||||||
|
#define op 1
|
||||||
|
#define xchg 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef op
|
||||||
|
#define op 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef xchg
|
||||||
|
#define xchg 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if op
|
||||||
|
int sfa (type *p, type *q, int a)
|
||||||
|
{
|
||||||
|
return __atomic_fetch_nand (p, a, __ATOMIC_ACQ_REL)
|
||||||
|
+ __atomic_fetch_add (q, a, __ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if xchg
|
||||||
|
void acen (type *ptr, type *val, type *ret)
|
||||||
|
{
|
||||||
|
__atomic_exchange (ptr, val, ret, __ATOMIC_SEQ_CST);
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,8 @@
|
||||||
|
/* Check that we don't get alignment-checking code, char. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2" } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tbreak\[ \t\]" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tbtstq\[ \t\]\[^5\]" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tand" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\t\[jb\]sr" } } */
|
||||||
|
#include "sync-1.c"
|
|
@ -0,0 +1,9 @@
|
||||||
|
/* Check that we get the expected alignment-checking code, op variant, int. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2 -Dop -Dtype=int" } */
|
||||||
|
/* { dg-additional-options "-mtrap-using-break8 -mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
/* { dg-final { scan-assembler "\tbreak 8" } } */
|
||||||
|
/* { dg-final { scan-assembler "\tbtstq \\(2-1\\)," } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tand" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\t\[jb\]sr" } } */
|
||||||
|
#include "sync-1.c"
|
|
@ -0,0 +1,9 @@
|
||||||
|
/* Check that we get the expected alignment-checking code, op variant, short. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2 -Dop -Dtype=short" } */
|
||||||
|
/* { dg-additional-options "-mtrap-using-break8 -mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
/* { dg-final { scan-assembler "\tbreak 8" } } */
|
||||||
|
/* { dg-final { scan-assembler "\tbtstq \\(1-1\\)," } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tand" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\t\[jb\]sr" } } */
|
||||||
|
#include "sync-1.c"
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* Check that we get the expected alignment-checking code, xchg variant, int.
|
||||||
|
Unfortunately, PRE moves the "and" to a different BB, so combine doesn't
|
||||||
|
see it with the compare to make it a btstq. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2 -Dxchg -Dtype=int" } */
|
||||||
|
/* { dg-additional-options "-mtrap-using-break8 -mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
/* { dg-final { scan-assembler "\tbreak 8" } } */
|
||||||
|
/* { dg-final { scan-assembler "\tbtstq \\(2-1\\)," { xfail *-*-* } } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tand" { xfail *-*-* } } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\t\[jb\]sr" } } */
|
||||||
|
#include "sync-1.c"
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* Check that we get the expected alignment-checking code, xchg variant, short.
|
||||||
|
Unfortunately, PRE moves the "and" to a different BB, so combine doesn't
|
||||||
|
see it with the compare to make it a btstq. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2 -Dxchg -Dtype=short" } */
|
||||||
|
/* { dg-additional-options "-mtrap-using-break8 -mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
/* { dg-final { scan-assembler "\tbreak 8" } } */
|
||||||
|
/* { dg-final { scan-assembler "\tbtstq \\(1-1\\)," { xfail *-*-* } } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tand" { xfail *-*-* } } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\t\[jb\]sr" } } */
|
||||||
|
#include "sync-1.c"
|
|
@ -0,0 +1,8 @@
|
||||||
|
/* Check that we get don't alignment-checking code, xchg variant, char. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2 -mno-trap-unaligned-atomic" } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tbreak\[ \t\]" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tbtstq\[ \t\]\[^5\]" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tand" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\t\[jb\]sr" } } */
|
||||||
|
#include "sync-1.c"
|
|
@ -0,0 +1,8 @@
|
||||||
|
/* Check that we don't get alignment-checking code, int. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2 -Dtype=int -mno-trap-unaligned-atomic" } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tbreak\[ \t\]" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tbtstq\[ \t\]\[^5\]" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tand" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\t\[jb\]sr" } } */
|
||||||
|
#include "sync-1.c"
|
|
@ -0,0 +1,8 @@
|
||||||
|
/* Check that we don't get alignment-checking code, short. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2 -Dtype=short -mno-trap-unaligned-atomic" } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tbreak\[ \t\]" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tbtstq\[ \t\]\[^5\]" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\tand" } } */
|
||||||
|
/* { dg-final { scan-assembler-not "\t\[jb\]sr" } } */
|
||||||
|
#include "sync-1.c"
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do run { target *-*-linux* } } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dop -Dtype=int" } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dop -Dtype=int -DTRAP_USING_ABORT -mno-trap-using-break8" } */
|
||||||
|
/* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do run { target *-*-linux* } } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dop -Dtype=int -Dmisalignment=2" } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dop -Dtype=int -Dmisalignment=2 -DTRAP_USING_ABORT -mno-trap-using-break8" } */
|
||||||
|
/* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do run { target *-*-linux* } } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dop -Dtype=int -Dmisalignment=3" } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dop -Dtype=int -Dmisalignment=3 -DTRAP_USING_ABORT -mno-trap-using-break8" } */
|
||||||
|
/* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,111 @@
|
||||||
|
/* { dg-do run { target *-*-linux* } } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dop -Dtype=short" } */
|
||||||
|
|
||||||
|
/* Make sure we get a SIGTRAP or equivalent when passing unaligned
|
||||||
|
but otherwise valid pointers to the atomic builtins. */
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef type
|
||||||
|
#error type not defined
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef op
|
||||||
|
#define op 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef xchg
|
||||||
|
#define xchg 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if op
|
||||||
|
int sfa (type *p, type *q, int a);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if xchg
|
||||||
|
void acen (type *ptr, type *val, type *ret);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef misalignment
|
||||||
|
#define misalignment 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
volatile int trap_expected = 0;
|
||||||
|
|
||||||
|
struct { char x[misalignment]; type i; } s __attribute__ ((__aligned__ (4)))
|
||||||
|
= { {0}, (type) 0xdeadbeef };
|
||||||
|
type x = 2;
|
||||||
|
type ret = 42;
|
||||||
|
|
||||||
|
#ifdef TRAP_USING_ABORT
|
||||||
|
#define SYMSTR(x) STR1(__USER_LABEL_PREFIX__, x)
|
||||||
|
#define STR1(x,y) STR2(x, y)
|
||||||
|
#define STR2(x,y) #x #y
|
||||||
|
/* LTO requires marking seemingly-unused-but-used global functions. */
|
||||||
|
void my_abort (void) __asm__ (SYMSTR (abort)) __attribute__ ((__used__));
|
||||||
|
void my_abort (void)
|
||||||
|
#else
|
||||||
|
#ifdef __gnu_linux__
|
||||||
|
void trap_handler(int signum)
|
||||||
|
#else
|
||||||
|
#error "can't catch break 8"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (1
|
||||||
|
#ifndef TRAP_USING_ABORT
|
||||||
|
&& signum == SIGTRAP
|
||||||
|
#endif
|
||||||
|
&& trap_expected
|
||||||
|
&& s.i == (type) 0xdeadbeef
|
||||||
|
&& x == 2 && ret == 42)
|
||||||
|
exit (0);
|
||||||
|
|
||||||
|
#ifdef TRAP_USING_ABORT
|
||||||
|
/* We might be able to trust the exit-value getting through, but add
|
||||||
|
a NULL-dereference SEGV just in case. Make sure gcc doesn't
|
||||||
|
understand the NULL. */
|
||||||
|
*({ int *p; asm ("" : "=rm" (p) : "0" (0)); p; }) = 0xdead;
|
||||||
|
exit (2);
|
||||||
|
#else
|
||||||
|
abort ();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
type x = 0;
|
||||||
|
type ret;
|
||||||
|
|
||||||
|
#ifndef TRAP_USING_ABORT
|
||||||
|
#ifdef __gnu_linux__
|
||||||
|
if (signal (SIGTRAP, trap_handler) == SIG_ERR)
|
||||||
|
abort ();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
trap_expected = 1;
|
||||||
|
|
||||||
|
#if op
|
||||||
|
sfa (&s.i, &s.i, 42);
|
||||||
|
|
||||||
|
/* We should have fallen into the trap now. But don't call abort
|
||||||
|
yet: if the trap is implemented as a call to abort, we have to
|
||||||
|
tell the difference. Set a global variable *and* make sure the
|
||||||
|
setting isn't eliminated by optimizers: another call to sfa
|
||||||
|
should do it. */
|
||||||
|
trap_expected = 0;
|
||||||
|
|
||||||
|
sfa (&x, &x, 1);
|
||||||
|
#else
|
||||||
|
acen (&s.i, &x, &ret);
|
||||||
|
|
||||||
|
trap_expected = 0;
|
||||||
|
|
||||||
|
acen (&x, &x, &ret);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
abort ();
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dop -Dtype=short -DTRAP_USING_ABORT -mno-trap-using-break8" } */
|
||||||
|
/* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do run { target *-*-linux* } } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dxchg -Dtype=int" } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dxchg -Dtype=int -DTRAP_USING_ABORT -mno-trap-using-break8" } */
|
||||||
|
/* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do run { target *-*-linux* } } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dxchg -Dtype=int -Dmisalignment=2" } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dxchg -Dtype=int -Dmisalignment=2 -DTRAP_USING_ABORT -mno-trap-using-break8" } */
|
||||||
|
/* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do run { target *-*-linux* } } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dxchg -Dtype=int -Dmisalignment=3" } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dxchg -Dtype=int -Dmisalignment=3 -DTRAP_USING_ABORT -mno-trap-using-break8" } */
|
||||||
|
/* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do run { target *-*-linux* } } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dxchg -Dtype=short" } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
/* { dg-additional-sources "../sync-1.c" } */
|
||||||
|
/* { dg-options "-Dxchg -Dtype=short -DTRAP_USING_ABORT -mno-trap-using-break8" } */
|
||||||
|
/* { dg-additional-options "-mtrap-unaligned-atomic" { target cris-*-elf } } */
|
||||||
|
#include "sync-mis-op-s-1.c"
|
Loading…
Reference in New Issue