summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr39911.c
blob: fe63ff005fec46a5517d209b5ebd0536af397722 (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
/* { dg-do assemble } */
/* { dg-options "-O2" } */

void 
bar1 () 
{
  char foo;
  asm volatile ("mov%z0 %1, %0": "=m" (foo): "iq" (-23));
  asm volatile ("add%z0 %1, %0": "+m" (foo): "iq" (23));
  asm volatile ("mov%z0 %1, %0": "=q" (foo): "iq" (-23));
  asm volatile ("add%z0 %1, %0": "+q" (foo): "iq" (23));
}

void
bar2 () 
{
  short foo;
  asm volatile ("mov%z0 %1, %0": "=m" (foo): "ir" (-23));
  asm volatile ("add%z0 %1, %0": "+m" (foo): "ir" (23));
  asm volatile ("mov%z0 %1, %0": "=r" (foo): "ir" (-23));
  asm volatile ("add%z0 %1, %0": "+r" (foo): "ir" (23));

  asm volatile ("pop%z0 %0": "=m" (foo));
  asm volatile ("pop%z0 %0": "=r" (foo));
}

void
bar3 () 
{
  int foo;
  asm volatile ("mov%z0 %1, %0": "=m" (foo): "ir" (-23));
  asm volatile ("add%z0 %1, %0": "+m" (foo): "ir" (23));
  asm volatile ("mov%z0 %1, %0": "=r" (foo): "ir" (-23));
  asm volatile ("add%z0 %1, %0": "+r" (foo): "ir" (23));

  if (sizeof (void *) == sizeof (int))
    {
      asm volatile ("pop%z0 %0": "=m" (foo));
      asm volatile ("pop%z0 %0": "=r" (foo));
    }
}

void
bar4 () 
{
  if (sizeof (void *) == sizeof (long long))
    {
      long long foo;
      asm volatile ("mov%z0 %1, %0": "=m" (foo): "er" (-23));
      asm volatile ("add%z0 %1, %0": "+m" (foo): "er" (23));
      asm volatile ("mov%z0 %1, %0": "=r" (foo): "er" (-23));
      asm volatile ("add%z0 %1, %0": "+r" (foo): "er" (23));

      asm volatile ("pop%z0 %0": "=m" (foo));
      asm volatile ("pop%z0 %0": "=r" (foo));
    }
}