1/* { dg-require-effective-target untyped_assembly } */
2union {
3  short I[2];
4  long int L;
5  char C[4];
6} itolws;
7char *errflg;
8long int dot;
9short dotinc;
10long int expvf;
11
12char *
13f(fcount,ifp,itype,ptype)
14     short fcount;
15     char *ifp;
16{
17  unsigned w;
18  long int savdot, wx;
19  char *fp;
20  char c, modifier, longpr;
21  union {
22    double dval;
23    struct {
24      int i1;
25      int i2;
26    } ival;
27  } dw;
28  union {
29    float fval;
30    int ival;
31  } fw;
32  int gotdot = 0;
33  while (fcount > 0) {
34    fp = ifp;
35    c = *fp;
36    longpr = ((c >= 'A') & (c <= 'Z') | (c == 'f') | (c == '4') | (c == 'p') | (c == 'i'));
37    if ((itype == 0) || (*fp == 'a')) {
38      wx = dot;
39      w = dot;
40    } else {
41      gotdot = 1;
42      wx = get((int)dot, itype);
43      if (!longpr) {
44	w = (itolws.L=(wx), itolws.I[((dot)&3)>>1]);
45      }
46    }
47    if (c == 'F') {
48      dw.ival.i1 = wx;
49      if (itype == 0) {
50	dw.ival.i2 = expvf;
51      }
52    }
53
54    modifier = *fp++;
55    switch(modifier) {
56    case ' ' :
57    case '\t' :
58      break;
59    case 't':
60    case 'T':
61      printf("%T",fcount);
62      return(fp);
63    case 'r':
64    case 'R':
65      printf("%M",fcount);
66      return(fp);
67    case 'k':
68      printf("%k",w);
69      break;
70    case 'K':
71      printf("%K",wx);
72      break;
73    case 'a':
74      psymoff(dot,ptype,":%16t");
75      dotinc = 0;
76      break;
77    case 'p':
78      psymoff(0,ptype,"%16t");
79      break;
80    case 'u':
81      printf("%-8u",w);
82      break;
83    case 'U':
84      printf("%-16U",wx); break;
85    case 'c':
86    case 'C':
87      if (modifier == 'C') {
88	printesc((int)(itolws.L=(wx), itolws.C[(dot)&3]));
89      } else {
90	printc((char)(itolws.L=(wx), itolws.C[(dot)&3]));
91      }
92      dotinc = 1;
93      break;
94    case 'b':
95      printf("%-8x", (itolws.L=(wx), itolws.C[(dot)&3]));
96      dotinc = 1;
97      break;
98    case 'B':
99      printf("%-8o", (itolws.L=(wx), itolws.C[(dot)&3]));
100      dotinc = 1;
101      break;
102    case 's':
103    case 'S':
104      savdot = dot;
105      dotinc = 1;
106      while ((c = (itolws.L=(wx), itolws.C[(dot)&3])) && (errflg == 0)) {
107	dot = inkdot(1);
108	if (modifier == 'S') {
109	  printesc(c);
110	} else {
111	  printc(c);
112	}
113	endline();
114	if (!(dot & 3))
115	  wx = get((int)dot, itype);
116      }
117      dotinc = dot - savdot + 1;
118      dot = savdot;
119      break;
120    case 'i':
121      if (gotdot) {
122	wx = get((int)(dot & ~3), itype);
123      }
124      iDasm((int)(wx), (unsigned int)0, (unsigned int)(dot&~3));
125      printc('\n');
126      break;
127    case 'f':
128      fw.ival = wx;
129      printf("%-16.9f", fw.fval);
130      dotinc = 4;
131      break;
132    case 'F':
133      printf("%-32.18F", dw.dval);
134      dotinc = 8;
135      break;
136    }
137  }
138  return(fp);
139}
140