summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/cris-volatile-1.c
blob: 6b19852c27485402f2115a48629e6729036af8dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* Copyright (C) 2003  Free Software Foundation.
   Check that size-optimizations for move insns (specifically peephole
   optimizations) aren't applied to volatile objects in the CRIS port.
   Origin: Hans-Peter Nilsson.  */
/* { dg-do compile { target cris-*-* crisv32-*-* } } */
/* { dg-final { scan-assembler-not {movu\...\[} } } */
/* { dg-final { scan-assembler-not {move\.[^d].\[} } } */
/* { dg-final { scan-assembler-not {and\.[^d].\[} } } */
/* { dg-final { scan-assembler-not {or\.[^d].\[} } } */

static const unsigned long c = 0x0000FF00;
unsigned long
a1 (void)
{
  unsigned long m;
  m = *(volatile unsigned long*) 0xb00000c8;
  m &= c;
  return m;
}
extern volatile unsigned long xx;
unsigned long
a2 (void)
{
  unsigned long m;
  m = xx;
  m &= c;
  return m;
}
extern volatile unsigned long yy[];
unsigned long
a3 (void)
{
  unsigned long m;
  m = yy[3];
  m &= 0xfe00;
  return m;
}
unsigned long
ac1 (void)
{
  unsigned long m;
  m = *(volatile unsigned long*) 0xb00000c8;
  m &= 0xfe00;
  return m;
}
extern volatile unsigned long xx;
unsigned long
ac2 (void)
{
  unsigned long m;
  m = xx;
  m &= 0xfe00;
  return m;
}
extern volatile unsigned long yy[];
unsigned long
ac3 (void)
{
  unsigned long m;
  m = yy[3];
  m &= 0xfe00;
  return m;
}
extern volatile unsigned long yy[];
unsigned long
oc3 (void)
{
  unsigned long m;
  m = yy[3];
  m |= ~0xf;
  return m;
}