1 /* Origin: PR target/6981 from Mattias Engdegaard <mattias@virtutech.se>.  */
2 
3 void exit (int);
4 void abort (void);
5 
6 unsigned long long *cp, m;
7 
foo(void)8 void foo (void)
9 {
10 }
11 
bar(unsigned rop,unsigned long long * r)12 void bar (unsigned rop, unsigned long long *r)
13 {
14   unsigned rs1, rs2, rd;
15 
16 top:
17   rs2 = (rop >> 23) & 0x1ff;
18   rs1 = (rop >> 9) & 0x1ff;
19   rd = rop & 0x1ff;
20 
21   *cp = 1;
22   m = r[rs1] + r[rs2];
23   *cp = 2;
24   foo();
25   if (!rd)
26     goto top;
27   r[rd] = 1;
28 }
29 
main(void)30 int main(void)
31 {
32   static unsigned long long r[64];
33   unsigned long long cr;
34   cp = &cr;
35 
36   r[4] = 47;
37   r[8] = 11;
38   bar((8 << 23) | (4 << 9) | 15, r);
39 
40   if (m != 47 + 11)
41     abort ();
42   exit (0);
43 }
44