+{
+ "v", "c/l", "z", "nh", "s/n", "t", "lt", "le",
+ "nv", "nc/nl", "nz", "h", "ns/p", "sa", "ge", "gt"
+};
+
+static const char *const v850_float_cc_names[] =
+{
+ "f/t", "un/or", "eq/neq", "ueq/ogl", "olt/uge", "ult/oge", "ole/ugt", "ule/ogt",
+ "sf/st", "ngle/gle", "seq/sne", "ngl/gl", "lt/nlt", "nge/ge", "le/nle", "ngt/gt"
+};
+
+
+static void
+print_value (int flags, bfd_vma memaddr, struct disassemble_info *info, long value)
+{
+ if (flags & V850_PCREL)
+ {
+ bfd_vma addr = value + memaddr;
+ info->print_address_func (addr, info);
+ }
+ else if (flags & V850_OPERAND_DISP)
+ {
+ if (flags & V850_OPERAND_SIGNED)
+ {
+ info->fprintf_func (info->stream, "%ld", value);
+ }
+ else
+ {
+ info->fprintf_func (info->stream, "%lu", value);
+ }
+ }
+ else if (flags & V850E_IMMEDIATE32)
+ {
+ info->fprintf_func (info->stream, "0x%lx", value);
+ }
+ else
+ {
+ if (flags & V850_OPERAND_SIGNED)
+ {
+ info->fprintf_func (info->stream, "%ld", value);
+ }
+ else
+ {
+ info->fprintf_func (info->stream, "%lu", value);
+ }
+ }
+}
+
+static long
+get_operand_value (const struct v850_operand *operand,
+ unsigned long insn,
+ int bytes_read,
+ bfd_vma memaddr,
+ struct disassemble_info * info,
+ bfd_boolean noerror,
+ int *invalid)
+{
+ long value;
+ bfd_byte buffer[4];
+
+ if ((operand->flags & V850E_IMMEDIATE16)
+ || (operand->flags & V850E_IMMEDIATE16HI))
+ {
+ int status = info->read_memory_func (memaddr + bytes_read, buffer, 2, info);
+
+ if (status == 0)
+ {
+ value = bfd_getl16 (buffer);
+
+ if (operand->flags & V850E_IMMEDIATE16HI)
+ value <<= 16;
+
+ return value;
+ }
+
+ if (!noerror)
+ info->memory_error_func (status, memaddr + bytes_read, info);
+
+ return 0;
+ }
+
+ if (operand->flags & V850E_IMMEDIATE23)
+ {
+ int status = info->read_memory_func (memaddr + 2, buffer, 4, info);
+
+ if (status == 0)
+ {
+ value = bfd_getl32 (buffer);
+
+ value = (operand->extract) (value, invalid);
+
+ return value;
+ }
+
+ if (!noerror)
+ info->memory_error_func (status, memaddr + bytes_read, info);
+
+ return 0;
+ }
+
+ if (operand->flags & V850E_IMMEDIATE32)
+ {
+ int status = info->read_memory_func (memaddr + bytes_read, buffer, 4, info);
+
+ if (status == 0)
+ {
+ bytes_read += 4;
+ value = bfd_getl32 (buffer);
+
+ return value;
+ }
+
+ if (!noerror)
+ info->memory_error_func (status, memaddr + bytes_read, info);
+
+ return 0;
+ }
+
+ if (operand->extract)
+ value = (operand->extract) (insn, invalid);
+ else
+ {
+ if (operand->bits == -1)
+ value = (insn & operand->shift);
+ else
+ value = (insn >> operand->shift) & ((1 << operand->bits) - 1);
+
+ if (operand->flags & V850_OPERAND_SIGNED)
+ value = ((long)(value << (sizeof (long)*8 - operand->bits))
+ >> (sizeof (long)*8 - operand->bits));
+ }
+
+ return value;
+}