aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr71866.c
blob: b9c1a77660e16c6b805bcd61607575d701947d3b (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
/* { dg-do compile } */
/* { dg-additional-options "-ftree-pre -fcode-hoisting" } */

__extension__ typedef __UINTPTR_TYPE__ uintptr_t;

typedef unsigned char u8;
extern unsigned long pci_io_base;
u8 in_8 (const volatile void *);
int eeh_enabled ();
void eeh_check_failure ();
static inline 
u8 eeh_readb(const volatile void *addr)
{
  u8 val = in_8(addr);
  if (((val) == (u8)~0 && eeh_enabled()))   eeh_check_failure();
  return val;
}
extern struct ppc_pci_io {
    void (*outb) (u8 val, unsigned long port);
}
ppc_pci_io;
static inline
u8 readb (const volatile void * addr)
{
  return eeh_readb((addr));
}
static inline
u8 inb (unsigned long port)
{
  return readb((volatile void *)(uintptr_t)pci_io_base + port);
}
static inline
void outb (u8 val, unsigned long port)
{
  if (ppc_pci_io.outb != ((void *)0)) ppc_pci_io.outb (val, port);
};
void frob_econtrol(unsigned long base_hi, unsigned char m, unsigned char v)
{
  unsigned char ectr = 0;
  if (m != 0xff)   ectr = inb((base_hi + 0x2));
  outb((ectr & ~m) ^ v, (base_hi + 0x2));
}