annotate gcc/testsuite/gcc.dg/asm-b.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do run { target powerpc*-*-* i?86-*-* x86_64-*-* } } */
kono
parents:
diff changeset
2 /* { dg-options "-O1" } */
kono
parents:
diff changeset
3 /* Test to make sure that inline-asm causes the tree optimizers to get the
kono
parents:
diff changeset
4 V_MAY_DEFs and clobber memory. */
kono
parents:
diff changeset
5 /* Test from Jakub Jelinek, modified by Andrew Pinski to work on all powerpc targets. */
kono
parents:
diff changeset
6 extern void abort (void);
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 unsigned short v = 0x0300;
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 void
kono
parents:
diff changeset
11 foo (unsigned short *p)
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 *p = v;
kono
parents:
diff changeset
14 }
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 int
kono
parents:
diff changeset
17 bar (void)
kono
parents:
diff changeset
18 {
kono
parents:
diff changeset
19 unsigned short x;
kono
parents:
diff changeset
20 volatile unsigned short *z;
kono
parents:
diff changeset
21 foo (&x);
kono
parents:
diff changeset
22 const unsigned int y = x;
kono
parents:
diff changeset
23 z = &x;
kono
parents:
diff changeset
24 #if defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (_POWER) || defined (__ppc64__) || defined (__ppc)
kono
parents:
diff changeset
25 __asm __volatile ("sthbrx %1,0,%2" : "=m" (*z) : "r" (y), "r" (z));
kono
parents:
diff changeset
26 #elif defined __i386__ || defined __x86_64__
kono
parents:
diff changeset
27 __asm __volatile ("movb %b1,1(%2)\n\tmovb %h1,(%2)"
kono
parents:
diff changeset
28 : "=m" (*z) : "Q" (y), "R" (z));
kono
parents:
diff changeset
29 #endif
kono
parents:
diff changeset
30 return (x & 1) == 0;
kono
parents:
diff changeset
31 }
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 int
kono
parents:
diff changeset
34 main (void)
kono
parents:
diff changeset
35 {
kono
parents:
diff changeset
36 if (bar ())
kono
parents:
diff changeset
37 abort ();
kono
parents:
diff changeset
38 return 0;
kono
parents:
diff changeset
39 }