+2014-08-14 Mike Frysinger <vapier@gentoo.org>
+
+ * bfin-dis.c (OUT): Define.
+ (decode_CC2stat_0): Declare new op_names array.
+ Replace multiple if statements with a single one.
+
2014-08-14 Mike Frysinger <vapier@gentoo.org>
* bfin-dis.c (struct private): Add iw0.
#ifndef OUTS
#define OUTS(p, txt) (p)->fprintf_func ((p)->stream, "%s", txt)
#endif
+#define OUT(p, txt, ...) (p)->fprintf_func ((p)->stream, txt, ## __VA_ARGS__)
static void
amod0 (int s0, int x0, disassemble_info *outf)
int cbit = ((iw0 >> CC2stat_cbit_bits) & CC2stat_cbit_mask);
const char *bitname = statbits (cbit);
+ const char * const op_names[] = { "", "|", "&", "^" } ;
if (priv->parallel)
return 0;
bitname = bitnames;
}
- if (op == 0 && D == 0)
- {
- OUTS (outf, "CC = ");
- OUTS (outf, bitname);
- }
- else if (op == 1 && D == 0)
- {
- OUTS (outf, "CC |= ");
- OUTS (outf, bitname);
- }
- else if (op == 2 && D == 0)
- {
- OUTS (outf, "CC &= ");
- OUTS (outf, bitname);
- }
- else if (op == 3 && D == 0)
- {
- OUTS (outf, "CC ^= ");
- OUTS (outf, bitname);
- }
- else if (op == 0 && D == 1)
- {
- OUTS (outf, bitname);
- OUTS (outf, " = CC");
- }
- else if (op == 1 && D == 1)
- {
- OUTS (outf, bitname);
- OUTS (outf, " |= CC");
- }
- else if (op == 2 && D == 1)
- {
- OUTS (outf, bitname);
- OUTS (outf, " &= CC");
- }
- else if (op == 3 && D == 1)
- {
- OUTS (outf, bitname);
- OUTS (outf, " ^= CC");
- }
+ if (D == 0)
+ OUT (outf, "CC %s= %s", op_names[op], bitname);
else
- return 0;
+ OUT (outf, "%s %s= CC", bitname, op_names[op]);
return 2;
}