Lines Matching +full:upper +full:- +full:cal

7 #include "disas/dis-asm.h"
9 /* **** floatformat.h from sourceware.org CVS 2005-08-14. */
73 is intentionally signed as, otherwise, -exp_bias can turn into a
75 bit long, the equation (long)(1 - exp_bias) evaluates to
76 4294950914) instead of -16382). */
116 /* IA-64 Floating Point register spilt into memory. */
135 /* Return non-zero iff the data at FROM is a valid number in format FMT. */
142 /* **** m68k-dis.h from sourceware.org CVS 2005-08-14. */
167 #define m68008 m68000 /* Synonym for -m68000. otherwise unused. */
171 #define m68ec030 m68030 /* Similar enough to -m68030 to ignore differences;
177 #define m68882 m68881 /* Synonym for -m68881. otherwise unused. */
217 /* The pseudo-size of the instruction(in bytes). Used to determine
254 Characters used: AaBbCcDdEeFfGgHIiJkLlMmnOopQqRrSsTtU VvWwXxYyZz01234|*~%;@!&$?/<>#^+-
263 O an offset (or width): immediate data 0-31 or data register.
266 - autodecrement only. Stored as 3 bits (number of the address register).
270 This matches an immediate operand only when value is in range -128..127
273 k K-factor for fmove.p instruction. Stored as a 7-bit constant or
280 B pc-relative address, converted to an offset
332 L Register list of the type d0-d7/a0-a7 etc.
333 (New! Improved! Can also hold fp0-fp7, as well!)
345 u Any register, with ``upper'' or ``lower'' specification. Used
351 * all (modes 0-6,7.0-4)
352 ~ alterable memory (modes 2-6,7.0,7.1)
353 (not 0,1,7.2-4)
354 % alterable (modes 0-6,7.0,7.1)
355 (not 7.2-4)
356 ; data (modes 0,2-6,7.0-4)
358 @ data, but not immediate (modes 0,2-6,7.0-3)
360 ! control (modes 2,5,6,7.0-3)
363 (not 0,1,3,4,7.2-4)
364 $ alterable data (modes 0,2-6,7.0,7.1)
365 (not 1,7.2-4)
367 (not 1,3,4,7.2-4)
368 / control, or data register (modes 0,2,5,6,7.0-3)
371 (not 0,1,3,7.2-4)
372 < *restore operands (modes 2,3,5,6,7.0-3)
376 m (modes 0-4)
379 p (modes 0-5)
382 q (modes 0,2-5)
383 v (modes 0,2-5,7.0,7.1)
384 b (modes 0,2-5,7.2)
385 w (modes 2-5,7.2)
395 mnemonic. -rab
405 100 CAL Current Access Level (68851)
409 3 68030-only pmmu registers (32 bit)
411 (aka Access Control reg 0 -- AC0 -- on 68ec030)
413 (aka Access Control reg 1 -- AC1 -- on 68ec030)
434 | memory (modes 2-6, 7.*)
437 Stored as 3 bits, range 0-7.
442 /* Places to put an operand, for non-general operands:
473 k Dynamic K-factor field. Bits 6-4 of word 2, used as a register number.
475 C floating point coprocessor constant - 7 bits. Also used for static
476 K-factors...
480 Indicate upper/lower in 1 bit shifted 7 bits in second word.
482 n `m' without upper/lower indication. (For M[S]ACx; 4 bits split
484 register shifted 9 bits in first word. No upper/lower
487 Indicate upper/lower in 1 bit shifted 7 bits in second word.
490 upper/lower in 1 bit shifted 6 bits in second word. Use with
493 upper/lower in 1 bit shifted 6 bits in second word. Use with
522 /* **** End of m68k-opcode.h */
523 /* **** m68k-dis.c from sourceware.org CVS 2005-08-14. */
566 /* Sign-extend an (unsigned char). */
570 #define COERCE_SIGNED_CHAR(ch) ((int) (((ch) ^ 0x80) & 0xFF) - 128)
574 #define NEXTBYTE(p) (p += 2, fetch_data(info, p), COERCE_SIGNED_CHAR(p[-1]))
577 #define COERCE16(x) ((int) (((x) ^ 0x8000) - 0x8000))
580 COERCE16 ((p[-2] << 8) + p[-1]))
583 #define COERCE32(x) ((bfd_signed_vma) ((x) ^ 0x80000000) - 0x80000000)
586 (COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1])))
591 (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]))
596 floatformat_to_double (&floatformat_ieee_single_big, (char *) p - 4, &val))
601 floatformat_to_double (&floatformat_ieee_double_big, (char *) p - 8, &val))
606 floatformat_to_double (&floatformat_m68881_ext, (char *) p - 12, &val))
627 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
634 struct private *priv = (struct private *)info->private_data; in fetch_data2()
635 bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer); in fetch_data2()
637 status = (*info->read_memory_func) (start, in fetch_data2()
638 priv->max_fetched, in fetch_data2()
639 addr - priv->max_fetched, in fetch_data2()
643 (*info->memory_error_func) (status, start, info); in fetch_data2()
644 siglongjmp(priv->bailout, 1); in fetch_data2()
647 priv->max_fetched = addr; in fetch_data2()
654 if (addr <= ((struct private *) (info->private_data))->max_fetched) { in fetch_data()
661 /* This function is used to print to the bit-bucket. */
857 if it is a EMAC-load instruction if the EA is mode 2-5, otherwise it
858 is a non-load EMAC instruction and the bits mean register Ry.
955 /* Print a base register REGNO and displacement DISP, on INFO->STREAM.
956 REGNO = -1 for pc, -2 for none (suppressed). */
961 if (regno == -1) in print_base()
963 (*info->fprintf_func) (info->stream, "%%pc@("); in print_base()
964 (*info->print_address_func) (disp, info); in print_base()
970 if (regno == -2) in print_base()
971 (*info->fprintf_func) (info->stream, "@("); in print_base()
972 else if (regno == -3) in print_base()
973 (*info->fprintf_func) (info->stream, "%%zpc@("); in print_base()
975 (*info->fprintf_func) (info->stream, "%s@(", reg_names[regno]); in print_base()
978 (*info->fprintf_func) (info->stream, "%s", buf); in print_base()
982 /* Print an indexed argument. The base register is BASEREG (-1 for pc).
1014 base_disp -= 0x100; in print_indexed()
1015 if (basereg == -1) in print_indexed()
1018 (*info->fprintf_func) (info->stream, ",%s)", buf); in print_indexed()
1026 if (basereg == -1) in print_indexed()
1027 basereg = -3; in print_indexed()
1029 basereg = -2; in print_indexed()
1042 if (basereg == -1) in print_indexed()
1045 /* Handle single-level case (not indirect). */ in print_indexed()
1050 (*info->fprintf_func) (info->stream, ",%s", buf); in print_indexed()
1051 (*info->fprintf_func) (info->stream, ")"); in print_indexed()
1069 (*info->fprintf_func) (info->stream, ",%s", buf); in print_indexed()
1073 (*info->fprintf_func) (info->stream, ")@(%s", vmabuf); in print_indexed()
1075 (*info->fprintf_func) (info->stream, ",%s", buf); in print_indexed()
1076 (*info->fprintf_func) (info->stream, ")"); in print_indexed()
1082 return -1 if an invalid operand was found, or -2 if
1110 (*info->fprintf_func) (info->stream, "%s", cacheFieldName[val]); in print_insn_arg()
1116 (*info->fprintf_func) in print_insn_arg()
1117 (info->stream, in print_insn_arg()
1123 case '_': /* 32-bit absolute address for move16. */ in print_insn_arg()
1126 (*info->print_address_func) (uval, info); in print_insn_arg()
1131 (*info->fprintf_func) (info->stream, "%%ccr"); in print_insn_arg()
1135 (*info->fprintf_func) (info->stream, "%%sr"); in print_insn_arg()
1139 (*info->fprintf_func) (info->stream, "%%usp"); in print_insn_arg()
1143 (*info->fprintf_func) (info->stream, "%%acc"); in print_insn_arg()
1147 (*info->fprintf_func) (info->stream, "%%macsr"); in print_insn_arg()
1151 (*info->fprintf_func) (info->stream, "%%mask"); in print_insn_arg()
1173 for (regno = sizeof names / sizeof names[0] - 1; regno >= 0; regno--) in print_insn_arg()
1176 (*info->fprintf_func) (info->stream, "%s", names[regno].name); in print_insn_arg()
1180 (*info->fprintf_func) (info->stream, "%d", val); in print_insn_arg()
1189 (*info->fprintf_func) (info->stream, "#%d", val); in print_insn_arg()
1194 /* 0 means -1. */ in print_insn_arg()
1196 val = -1; in print_insn_arg()
1197 (*info->fprintf_func) (info->stream, "#%d", val); in print_insn_arg()
1205 (*info->fprintf_func) (info->stream, "%s", scalefactor_name[val]); in print_insn_arg()
1211 val = val - 0x100; in print_insn_arg()
1212 (*info->fprintf_func) (info->stream, "#%d", val); in print_insn_arg()
1218 (*info->fprintf_func) (info->stream, "#%d", val); in print_insn_arg()
1222 (*info->fprintf_func) (info->stream, "%s", in print_insn_arg()
1227 (*info->fprintf_func) in print_insn_arg()
1228 (info->stream, "%s", in print_insn_arg()
1233 (*info->fprintf_func) in print_insn_arg()
1234 (info->stream, "%s", in print_insn_arg()
1241 (*info->fprintf_func) (info->stream, "%s@", reg_names[regno]); in print_insn_arg()
1243 (*info->fprintf_func) (info->stream, "@(%s)", reg_names[regno]); in print_insn_arg()
1247 (*info->fprintf_func) in print_insn_arg()
1248 (info->stream, "%%fp%d", in print_insn_arg()
1255 (*info->fprintf_func) (info->stream, "%s", reg_names[val & 7]); in print_insn_arg()
1257 (*info->fprintf_func) (info->stream, "%d", val); in print_insn_arg()
1261 (*info->fprintf_func) in print_insn_arg()
1262 (info->stream, "%s@+", in print_insn_arg()
1266 case '-': in print_insn_arg()
1267 (*info->fprintf_func) in print_insn_arg()
1268 (info->stream, "%s@-", in print_insn_arg()
1274 (*info->fprintf_func) in print_insn_arg()
1275 (info->stream, "{%s}", in print_insn_arg()
1281 val -= 128; in print_insn_arg()
1282 (*info->fprintf_func) (info->stream, "{#%d}", val); in print_insn_arg()
1285 return -2; in print_insn_arg()
1306 return -2; in print_insn_arg()
1307 (*info->fprintf_func) (info->stream, "#%d", val); in print_insn_arg()
1324 else if (disp == -1) in print_insn_arg()
1335 return -2; in print_insn_arg()
1337 (*info->print_address_func) (addr + disp, info); in print_insn_arg()
1342 (*info->fprintf_func) in print_insn_arg()
1343 (info->stream, "%s@(%d)", in print_insn_arg()
1348 (*info->fprintf_func) (info->stream, "%s", in print_insn_arg()
1354 (*info->fprintf_func) (info->stream, "%%acc%d", val); in print_insn_arg()
1359 (*info->fprintf_func) (info->stream, "%%accext%s", val==0 ? "01" : "23"); in print_insn_arg()
1365 (*info->fprintf_func) (info->stream, "<<"); in print_insn_arg()
1367 (*info->fprintf_func) (info->stream, ">>"); in print_insn_arg()
1369 return -1; in print_insn_arg()
1377 (*info->fprintf_func) (info->stream, "(cpid=%d) ", val); in print_insn_arg()
1414 return -1; in print_insn_arg()
1422 (*info->fprintf_func) (info->stream, "%s", reg_names[val]); in print_insn_arg()
1426 (*info->fprintf_func) (info->stream, "%s", regname); in print_insn_arg()
1430 (*info->fprintf_func) (info->stream, "%s@", regname); in print_insn_arg()
1434 (*info->fprintf_func) (info->stream, "%s@+", regname); in print_insn_arg()
1438 (*info->fprintf_func) (info->stream, "%s@-", regname); in print_insn_arg()
1443 (*info->fprintf_func) (info->stream, "%s@(%d)", regname, val); in print_insn_arg()
1455 (*info->print_address_func) (val, info); in print_insn_arg()
1460 (*info->print_address_func) (uval, info); in print_insn_arg()
1465 (*info->fprintf_func) (info->stream, "%%pc@("); in print_insn_arg()
1466 (*info->print_address_func) (addr + val, info); in print_insn_arg()
1467 (*info->fprintf_func) (info->stream, ")"); in print_insn_arg()
1471 p = print_indexed (-1, p, addr, info); in print_insn_arg()
1510 return -1; in print_insn_arg()
1513 (*info->fprintf_func) (info->stream, "#%g", flval); in print_insn_arg()
1515 (*info->fprintf_func) (info->stream, "#%d", val); in print_insn_arg()
1519 return -1; in print_insn_arg()
1530 info->fprintf_func (info->stream, "&"); in print_insn_arg()
1546 (*info->fprintf_func) (info->stream, "#0"); in print_insn_arg()
1566 (*info->fprintf_func) (info->stream, "/"); in print_insn_arg()
1568 (*info->fprintf_func) (info->stream, "%s", reg_names[regno]); in print_insn_arg()
1573 (*info->fprintf_func) (info->stream, "-%s", in print_insn_arg()
1584 (*info->fprintf_func) (info->stream, "#0"); in print_insn_arg()
1603 (*info->fprintf_func) (info->stream, "/"); in print_insn_arg()
1605 (*info->fprintf_func) (info->stream, "%%fp%d", regno); in print_insn_arg()
1610 (*info->fprintf_func) (info->stream, "-%%fp%d", regno); in print_insn_arg()
1616 (*info->fprintf_func) (info->stream, "%s", in print_insn_arg()
1621 return -2; in print_insn_arg()
1646 case 0x14: name = "%cal"; break; in print_insn_arg()
1657 (*info->fprintf_func) in print_insn_arg()
1658 (info->stream, reg == 0x1c ? "%%bad%d" : "%%bac%d", in print_insn_arg()
1663 (*info->fprintf_func) (info->stream, "<mmu register %d>", reg); in print_insn_arg()
1666 (*info->fprintf_func) (info->stream, "%s", name); in print_insn_arg()
1675 (*info->fprintf_func) (info->stream, "%%dfc"); in print_insn_arg()
1677 (*info->fprintf_func) (info->stream, "%%sfc"); in print_insn_arg()
1679 /* xgettext:c-format */ in print_insn_arg()
1680 (*info->fprintf_func) (info->stream, "<function code %d>", fc); in print_insn_arg()
1685 (*info->fprintf_func) (info->stream, "%%val"); in print_insn_arg()
1692 (*info->fprintf_func) (info->stream, "%d", level); in print_insn_arg()
1706 (*info->fprintf_func) (info->stream, "%s%s", in print_insn_arg()
1713 return -2; in print_insn_arg()
1716 return p - p0; in print_insn_arg()
1732 bfd_byte *buffer = priv->the_buffer; in match_insn_m68k()
1733 fprintf_function save_printer = info->fprintf_func; in match_insn_m68k()
1735 = info->print_address_func; in match_insn_m68k()
1741 /* Figure out how long the fixed-size portion of the instruction is. in match_insn_m68k()
1743 in the arguments--look for arguments which specify fields in the 2nd in match_insn_m68k()
1745 for (d = best->args; *d; d += 2) in match_insn_m68k()
1751 if (d[1] == 'l' && p - buffer < 6) in match_insn_m68k()
1753 else if (p - buffer < 4 && d[1] != 'C' && d[1] != '8') in match_insn_m68k()
1757 if ((d[0] == 'L' || d[0] == 'l') && d[1] == 'w' && p - buffer < 4) in match_insn_m68k()
1769 if (p - buffer < 4) in match_insn_m68k()
1775 if (p - buffer < 6) in match_insn_m68k()
1785 if (p - buffer < 4 && (best->match & 0xFFFF) != 0) in match_insn_m68k()
1790 if (p - buffer < 6 in match_insn_m68k()
1791 && (best->match & 0xffff) == 0xffff in match_insn_m68k()
1792 && best->args[0] == '#' in match_insn_m68k()
1793 && best->args[1] == 'w') in match_insn_m68k()
1807 d = best->args; in match_insn_m68k()
1810 info->print_address_func = dummy_print_address; in match_insn_m68k()
1811 info->fprintf_func = dummy_printer; in match_insn_m68k()
1817 int eaten = print_insn_arg (d, buffer, p, memaddr + (p - buffer), info); in match_insn_m68k()
1821 else if (eaten == -1) in match_insn_m68k()
1823 info->fprintf_func = save_printer; in match_insn_m68k()
1824 info->print_address_func = save_print_address; in match_insn_m68k()
1829 info->fprintf_func (info->stream, in match_insn_m68k()
1830 /* xgettext:c-format */ in match_insn_m68k()
1832 best->name, best->args); in match_insn_m68k()
1833 info->fprintf_func = save_printer; in match_insn_m68k()
1834 info->print_address_func = save_print_address; in match_insn_m68k()
1840 info->fprintf_func = save_printer; in match_insn_m68k()
1841 info->print_address_func = save_print_address; in match_insn_m68k()
1843 d = best->args; in match_insn_m68k()
1845 info->fprintf_func (info->stream, "%s", best->name); in match_insn_m68k()
1848 info->fprintf_func (info->stream, " "); in match_insn_m68k()
1852 p += print_insn_arg (d, buffer, p, memaddr + (p - buffer), info); in match_insn_m68k()
1855 if (*d && *(d - 2) != 'I' && *d != 'k') in match_insn_m68k()
1856 info->fprintf_func (info->stream, ","); in match_insn_m68k()
1859 return p - buffer; in match_insn_m68k()
1863 on INFO->STREAM. Returns length of the instruction, in bytes. */
1881 table on the upper four bits of the opcode. */ in print_insn_m68k()
1896 opc_pointer[i] = opc_pointer[i - 1] + numopcodes[i - 1]; in print_insn_m68k()
1904 info->private_data = (PTR) &priv; in print_insn_m68k()
1907 info->bytes_per_chunk = 2; in print_insn_m68k()
1908 info->bytes_per_line = 6; in print_insn_m68k()
1909 info->display_endian = BFD_ENDIAN_BIG; in print_insn_m68k()
1915 return -1; in print_insn_m68k()
1918 switch (info->mach) in print_insn_m68k()
1922 arch_mask = (unsigned int) -1; in print_insn_m68k()
1977 unsigned long opcode = opc->opcode; in print_insn_m68k()
1978 unsigned long match = opc->match; in print_insn_m68k()
1989 && (opc->arch & arch_mask) != 0) in print_insn_m68k()
1994 for (d = opc->args; *d; d += 2) in print_insn_m68k()
2002 for (d = opc->args; *d; d += 2) in print_insn_m68k()
2010 for (d = opc->args; *d; d += 2) in print_insn_m68k()
2015 if ((val & (val - 1)) != 0) in print_insn_m68k()
2021 /* Don't match FPU insns with non-default coprocessor ID. */ in print_insn_m68k()
2024 for (d = opc->args; *d; d += 2) in print_insn_m68k()
2042 info->fprintf_func (info->stream, "0%o", (buffer[0] << 8) + buffer[1]); in print_insn_m68k()
2045 /* **** End of m68k-dis.c */
2046 /* **** m68k-opc.h from sourceware.org CVS 2005-08-14. */
2078 {"abcd", 2, one(0140410), one(0170770), "-s-d", m68000up },
2110 {"addxb", 2, one(0150410), one(0170770), "-s-d", m68000up },
2112 {"addxw", 2, one(0150510), one(0170770), "-s-d", m68000up },
2114 {"addxl", 2, one(0150610), one(0170770), "-s-d", m68000up },
2964 {"fmovemx", 4, two(0xF020, 0xE800), two(0xF1F8, 0xFF8F), "IiDk-s", mfloat },
2971 {"fmovemx", 4, two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "IdL3-s", mfloat },
2972 {"fmovemx", 4, two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "Id#3-s", mfloat },
2988 {"fmovem", 4, two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "IdL3-s", mfloat },
2992 {"fmovem", 4, two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "Id#3-s", mfloat },
2993 {"fmovem", 4, two(0xF020, 0xE800), two(0xF1F8, 0xFF8F), "IiDk-s", mfloat },
3127 /* $ is necessary to prevent the assembler from using PC-relative.
3512 {"macw", 4, two(0xa000, 0x0200), two(0xf100, 0x0900), "uNuoMh4/RneG", mcfemac },/* Ry,Rx,+1/-1,<e…
3515 {"macw", 4, two(0xa000, 0x0200), two(0xf130, 0x0900), "uMumMheH", mcfemac },/* Ry,Rx,+1/-1,accX. …
3538 behavior --- it could be a hole in instruction decoding (Motorola
3540 --- but I suspect that it is not.
3546 jtc@cygnus.com - 97/01/24. */
3559 {"movemw", 4, one(0044240), one(0177770), "lw-s", m68000up },
3564 {"moveml", 4, one(0044340), one(0177770), "lw-s", m68000up },
3591 {"moveb", 2, one(0010040), one(0170070), "-s$d", mcfisa_a },
3596 {"moveb", 2, one(0010400), one(0170700), "ob-d", mcfisa_a },
3636 {"movel", 2, one(0xa980), one(0xfff0), "G-Rs", mcfemac }, /* macsr,Rx. */
3637 {"movel", 2, one(0xad80), one(0xfff0), "H-Rs", mcfemac }, /* mask,Rx. */
3639 {"movel", 2, one(0xa9c0), one(0xffff), "G-C-", mcfemac }, /* macsr,ccr. */
3644 {"movel", 2, one(0xa900), one(0xffc0), "RsG-", mcfemac }, /* Rx,macsr. */
3645 {"movel", 6, one(0xa93c), one(0xffff), "#lG-", mcfemac }, /* #,macsr. */
3646 {"movel", 2, one(0xad00), one(0xffc0), "RsH-", mcfemac }, /* Rx,mask. */
3647 {"movel", 6, one(0xad3c), one(0xffff), "#lH-", mcfemac }, /* #,mask. */
3695 {"msacw", 4, two(0xa000, 0x0300), two(0xf100, 0x0900), "uMumMh4/RneG", mcfemac },/* Ry,Rx,+1/-1,<…
3698 {"msacw", 4, two(0xa000, 0x0300), two(0xf130, 0x0900), "uMumMheH", mcfemac },/* Ry,Rx,+1/-1,accX.…
3774 {"pack", 4, one(0100510), one(0170770), "-s-d#w", m68020up },
4040 {"sbcd", 2, one(0100410), one(0170770), "-s-d", m68000up },
4109 {"subxb", 2, one(0110410), one(0170770), "-s-d", m68000up },
4111 {"subxw", 2, one(0110510), one(0170770), "-s-d", m68000up },
4113 {"subxl", 2, one(0110610), one(0170770), "-s-d", m68000up },
4205 {"unpk", 4, one(0100610), one(0170770), "-s-d#w", m68020up },
4431 { "tdivul", "divul", }, /* For m68k-svr4. */
4470 /* **** End of m68k-opc.c */
4471 /* **** floatformat.c from sourceware.org CVS 2005-08-14. */
4571 /* In the i387 double-extended format, if the exponent is all ones, in floatformat_i387_ext_is_valid()
4578 exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize, in floatformat_i387_ext_is_valid()
4579 fmt->exp_start, fmt->exp_len); in floatformat_i387_ext_is_valid()
4580 int_bit = get_field (ufrom, fmt->byteorder, fmt->totalsize, in floatformat_i387_ext_is_valid()
4581 fmt->man_start, 1); in floatformat_i387_ext_is_valid()
4686 cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1; in get_field()
4688 ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; in get_field()
4689 result = *(data + cur_byte) >> (-cur_bitshift); in get_field()
4694 --cur_byte; in get_field()
4699 if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT) in get_field()
4704 & ((1 << (len - cur_bitshift)) - 1)) in get_field()
4712 --cur_byte; in get_field()
4733 exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize, in floatformat_to_double()
4734 fmt->exp_start, fmt->exp_len); in floatformat_to_double()
4739 if ((unsigned long) exponent == fmt->exp_nan) in floatformat_to_double()
4743 mant_off = fmt->man_start; in floatformat_to_double()
4744 mant_bits_left = fmt->man_len; in floatformat_to_double()
4750 if (get_field (ufrom, fmt->byteorder, fmt->totalsize, in floatformat_to_double()
4759 mant_bits_left -= mant_bits; in floatformat_to_double()
4768 compiling with -pedantic. */ in floatformat_to_double()
4774 if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1)) in floatformat_to_double()
4775 dto = -dto; in floatformat_to_double()
4782 mant_bits_left = fmt->man_len; in floatformat_to_double()
4783 mant_off = fmt->man_start; in floatformat_to_double()
4786 special_exponent = exponent == 0 || (unsigned long) exponent == fmt->exp_nan; in floatformat_to_double()
4790 exponent -= fmt->exp_bias; in floatformat_to_double()
4800 if (fmt->intbit == floatformat_intbit_no) in floatformat_to_double()
4810 mant = get_field (ufrom, fmt->byteorder, fmt->totalsize, in floatformat_to_double()
4814 non-IEEE formats? */ in floatformat_to_double()
4817 (- fmt->exp_bias in floatformat_to_double()
4818 - mant_bits in floatformat_to_double()
4819 - (mant_off - fmt->man_start) in floatformat_to_double()
4822 dto += ldexp ((double)mant, exponent - mant_bits); in floatformat_to_double()
4824 exponent -= mant_bits; in floatformat_to_double()
4826 mant_bits_left -= mant_bits; in floatformat_to_double()
4830 if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1)) in floatformat_to_double()
4831 dto = -dto; in floatformat_to_double()
4854 cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1; in put_field()
4856 ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; in put_field()
4858 ~(((1 << ((start + len) % FLOATFORMAT_CHAR_BIT)) - 1) << (-cur_bitshift)); in put_field()
4860 (stuff_to_put & ((1 << FLOATFORMAT_CHAR_BIT) - 1)) << (-cur_bitshift); in put_field()
4865 --cur_byte; in put_field()
4870 if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT) in put_field()
4874 ~((1 << (len - cur_bitshift)) - 1); in put_field()
4879 & ((1 << FLOATFORMAT_CHAR_BIT) - 1)); in put_field()
4884 --cur_byte; in put_field()
4904 memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT); in floatformat_from_double()
4909 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1); in floatformat_from_double()
4910 dfrom = -dfrom; in floatformat_from_double()
4922 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, in floatformat_from_double()
4923 fmt->exp_len, fmt->exp_nan); in floatformat_from_double()
4925 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start, in floatformat_from_double()
4934 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, in floatformat_from_double()
4935 fmt->exp_len, fmt->exp_nan); in floatformat_from_double()
4940 if (exponent + fmt->exp_bias - 1 > 0) in floatformat_from_double()
4941 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, in floatformat_from_double()
4942 fmt->exp_len, exponent + fmt->exp_bias - 1); in floatformat_from_double()
4946 non-IEEE formats? */ in floatformat_from_double()
4947 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start, in floatformat_from_double()
4948 fmt->exp_len, 0); in floatformat_from_double()
4949 mant = ldexp (mant, exponent + fmt->exp_bias - 1); in floatformat_from_double()
4952 mant_bits_left = fmt->man_len; in floatformat_from_double()
4953 mant_off = fmt->man_start; in floatformat_from_double()
4961 mant -= mant_long; in floatformat_from_double()
4965 if ((unsigned int) mant_bits_left == fmt->man_len in floatformat_from_double()
4966 && fmt->intbit == floatformat_intbit_no in floatformat_from_double()
4967 && exponent + fmt->exp_bias - 1 > 0) in floatformat_from_double()
4970 mant_bits -= 1; in floatformat_from_double()
4976 mant_long >>= 32 - mant_bits; in floatformat_from_double()
4979 put_field (uto, fmt->byteorder, fmt->totalsize, in floatformat_from_double()
4982 mant_bits_left -= mant_bits; in floatformat_from_double()
4986 /* Return non-zero iff the data at FROM is a valid number in format FMT. */
4991 return fmt->is_valid (fmt, from); in floatformat_is_valid()
5009 printf ("Differ(to): %.20g -> %.20g\n", n, result); in ieee_test()
5016 printf ("Differ(from): %.20g -> %.20g\n", n, result); in ieee_test()
5025 printf ("Differ(to+from): %.20g -> %.20g\n", n, result); in ieee_test()
5047 ieee_test (-512.0); in main()
5048 ieee_test (-0.004321); in main()
5049 ieee_test (1.2E-70); in main()
5050 ieee_test (1.2E-316); in main()
5051 ieee_test (4.9406564584124654E-324); in main()
5052 ieee_test (- 4.9406564584124654E-324); in main()
5053 ieee_test (- 0.0); in main()
5054 ieee_test (- INFINITY); in main()
5055 ieee_test (- NAN); in main()