1 /* { dg-do compile } */
2 /* { dg-require-effective-target stdint_types } */
3 /* { dg-options "-O2" } */
4 /* { dg-options "-O2 -mstrict-align" { target { powerpc*-*-linux* powerpc*-*-elf* } } } */
5 
6 #include <stdint.h>
7 
8 typedef struct {
9   int64_t counter;
10 } atomic64_t;
11 
12 struct buffer_page {
13   void *a, *b;
14   atomic64_t entries;
15 };
16 
17 static __inline__ __attribute__((always_inline)) int64_t
atomic64_read(const atomic64_t * v)18 atomic64_read(const atomic64_t *v)
19 {
20  int64_t t;
21  __asm__ __volatile__("" : "=r"(t) : "m"(v->counter));
22  return t;
23 }
24 
rb_remove_pages(void * p)25 int rb_remove_pages(void *p)
26 {
27   struct buffer_page *blah = (void *)((intptr_t) p & -4);
28   return atomic64_read(&blah->entries);
29 }
30