00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #define __datalbl
00024 #include "config.h"
00025 #include "system.h"
00026 #include "rtl.h"
00027 #include "tree.h"
00028 #include "function.h"
00029 #include "expr.h"
00030 #define HAVE_cc0
00031 #include "conditions.h"
00032 #include "real.h"
00033 #include "regs.h"
00034 #include "output.h"
00035 #include "flags.h"
00036 #include "tm_p.h"
00037 #include "target.h"
00038 #include "target-def.h"
00039
00040 struct datalabel_array datalbl[DATALBL_ARRSIZ];
00041 int datalbl_ndx = -1;
00042 struct jumplabel_array jmplbl[JMPLBL_ARRSIZ];
00043 int jmplbl_ndx = -1;
00044 int label_pending = 0, program_counter = 0;
00045 enum section current_section = Normal;
00046 const char *const sectname[4] =
00047 {"Init", "Normal", "Konst", "Static"};
00048
00049 static int which_bit PARAMS ((int));
00050 static bool assemble_integer_1750a PARAMS ((rtx, unsigned int, int));
00051 static void output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
00052 static void output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
00053
00054
00055 #undef TARGET_ASM_BYTE_OP
00056 #define TARGET_ASM_BYTE_OP "\tdata\t"
00057 #undef TARGET_ASM_ALIGNED_HI_OP
00058 #define TARGET_ASM_ALIGNED_HI_OP "\tdatal\t"
00059 #undef TARGET_ASM_ALIGNED_SI_OP
00060 #define TARGET_ASM_ALIGNED_SI_OP NULL
00061 #undef TARGET_ASM_INTEGER
00062 #define TARGET_ASM_INTEGER assemble_integer_1750a
00063
00064 #undef TARGET_ASM_FUNCTION_PROLOGUE
00065 #define TARGET_ASM_FUNCTION_PROLOGUE output_function_prologue
00066 #undef TARGET_ASM_FUNCTION_EPILOGUE
00067 #define TARGET_ASM_FUNCTION_EPILOGUE output_function_epilogue
00068
00069 struct gcc_target targetm = TARGET_INITIALIZER;
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 static void
00081 output_function_prologue (file, size)
00082 FILE *file;
00083 HOST_WIDE_INT size;
00084 {
00085 if (flag_verbose_asm)
00086 {
00087 int regno, regs_used = 0;
00088
00089 fprintf (file, "\t; registers used: ");
00090 for (regno = 0; regno < 14; regno++)
00091 if (regs_ever_live[regno])
00092 {
00093 fprintf (file, " %s", reg_names[regno]);
00094 regs_used++;
00095 }
00096
00097 if (regs_used == 0)
00098 fprintf (file, "(none)");
00099 }
00100
00101 if (size > 0)
00102 {
00103 fprintf (file, "\n\t%s\tr15,%d",
00104 (size <= 16 ? "sisp" : "sim"), size);
00105 if (flag_verbose_asm)
00106 fprintf (file, " ; reserve local-variable space");
00107 }
00108
00109 if (frame_pointer_needed)
00110 {
00111 fprintf(file, "\n\tpshm\tr14,r14");
00112 if (flag_verbose_asm)
00113 fprintf (file, " ; push old frame");
00114 fprintf (file, "\n\tlr\tr14,r15");
00115 if (flag_verbose_asm)
00116 fprintf (file, " ; set new frame");
00117 }
00118
00119 fprintf (file, "\n");
00120 program_counter = 0;
00121 jmplbl_ndx = -1;
00122 }
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 static void
00133 output_function_epilogue (file, size)
00134 FILE *file;
00135 HOST_WIDE_INT size;
00136 {
00137 if (frame_pointer_needed)
00138 {
00139 fprintf (file, "\tlr\tr15,r14");
00140 if (flag_verbose_asm)
00141 fprintf (file, " ; set stack ptr to frame ptr");
00142 fprintf (file, "\n\tpopm\tr14,r14");
00143 if (flag_verbose_asm)
00144 fprintf (file, " ; restore previous frame ptr");
00145 fprintf (file, "\n");
00146 }
00147
00148 if (size > 0)
00149 {
00150 fprintf (file, "\t%s\tr15,%d",
00151 (size <= 16 ? "aisp" : "aim"), size);
00152 if (flag_verbose_asm)
00153 fprintf (file, " ; free up local-var space");
00154 fprintf (file, "\n");
00155 }
00156
00157 fprintf (file, "\turs\tr15\n\n");
00158 }
00159
00160 void
00161 notice_update_cc (exp)
00162 rtx exp;
00163 {
00164 if (GET_CODE (exp) == SET)
00165 {
00166 enum rtx_code src_code = GET_CODE (SET_SRC (exp));
00167
00168 if (SET_DEST (exp) == pc_rtx)
00169 return;
00170
00171 if (GET_CODE (SET_DEST (exp)) == MEM
00172 && (src_code == REG || src_code == CONST_INT))
00173 return;
00174
00175 if (src_code == CALL)
00176 {
00177 CC_STATUS_INIT;
00178 return;
00179 }
00180
00181 if (GET_MODE (SET_DEST (exp)) == HImode ?
00182 src_code == AND || src_code == IOR ||
00183 src_code == XOR || src_code == NOT : 0)
00184 {
00185 CC_STATUS_INIT;
00186 return;
00187 }
00188
00189 if (SET_DEST (exp) == cc0_rtx)
00190 {
00191 CC_STATUS_INIT;
00192 cc_status.value1 = SET_SRC (exp);
00193 return;
00194 }
00195
00196 cc_status.flags = CC_NO_OVERFLOW;
00197 cc_status.value1 = SET_SRC (exp);
00198 cc_status.value2 = SET_DEST (exp);
00199 return;
00200 }
00201 else if (GET_CODE (exp) == PARALLEL
00202 && GET_CODE (XVECEXP (exp, 0, 0)) == SET)
00203 {
00204 if (SET_DEST (XVECEXP (exp, 0, 0)) == pc_rtx)
00205 return;
00206 if (SET_DEST (XVECEXP (exp, 0, 0)) == cc0_rtx)
00207 {
00208 CC_STATUS_INIT;
00209 cc_status.value1 = SET_SRC (XVECEXP (exp, 0, 0));
00210 return;
00211 }
00212 CC_STATUS_INIT;
00213 }
00214 else
00215 {
00216 CC_STATUS_INIT;
00217 }
00218 }
00219
00220
00221 rtx
00222 function_arg (cum, mode, type, named)
00223 int cum;
00224 enum machine_mode mode;
00225 tree type;
00226 int named ATTRIBUTE_UNUSED;
00227 {
00228 int size;
00229
00230 if (MUST_PASS_IN_STACK (mode, type))
00231 return (rtx) 0;
00232 if (mode == BLKmode)
00233 size = int_size_in_bytes (type);
00234 else
00235 size = GET_MODE_SIZE (mode);
00236 if (cum + size < 12)
00237 return gen_rtx_REG (mode, cum);
00238 else
00239 return (rtx) 0;
00240 }
00241
00242
00243 double
00244 get_double (x)
00245 rtx x;
00246 {
00247 union
00248 {
00249 double d;
00250 long i[2];
00251 }
00252 du;
00253
00254 du.i[0] = CONST_DOUBLE_LOW (x);
00255 du.i[1] = CONST_DOUBLE_HIGH (x);
00256 return du.d;
00257 }
00258
00259 char *
00260 float_label (code, value)
00261 int code;
00262 double value;
00263 {
00264 static char label[32];
00265 char *p;
00266
00267 label[0] = code;
00268 p = label + 1;
00269 sprintf (p, "%f", value);
00270 while (*p)
00271 {
00272 *p = (*p == '+') ? 'p' :
00273 (*p == '-') ? 'm' : *p;
00274 p++;
00275 }
00276 return xstrdup (label);
00277 }
00278
00279
00280 const char *
00281 movcnt_regno_adjust (op)
00282 rtx *op;
00283 {
00284 static char outstr[80];
00285 int op0r = REGNO (op[0]), op1r = REGNO (op[1]), op2r = REGNO (op[2]);
00286 #define dstreg op0r
00287 #define srcreg op1r
00288 #define cntreg op2r
00289 #define cntreg_1750 (op0r + 1)
00290
00291 if (cntreg == cntreg_1750)
00292 sprintf (outstr, "mov r%d,r%d", op0r, op1r);
00293 else if (dstreg + 1 == srcreg && cntreg > srcreg)
00294 sprintf (outstr, "xwr r%d,r%d\n\tmov r%d,r%d", op2r, op1r, op0r, op2r);
00295 else if (dstreg == cntreg + 1)
00296 sprintf (outstr, "xwr r%d,r%d\n\tmov r%d,r%d", op0r, op2r, op2r, op1r);
00297 else if (dstreg == srcreg + 1)
00298 sprintf (outstr, "xwr r%d,r%d\n\txwr r%d,r%d\n\tmov r%d,r%d",
00299 op0r, op1r, op0r, op2r, op1r, op2r);
00300 else if (cntreg + 1 == srcreg)
00301 sprintf (outstr, "xwr r%d,r%d\n\txwr r%d,r%d\n\tmov r%d,r%d",
00302 op2r, op1r, op0r, op2r, op2r, op0r);
00303 else if (cntreg == srcreg + 1)
00304 sprintf (outstr, "xwr r%d,r%d\n\tmov r%d,r%d", op0r, op1r, op1r, op0r);
00305 else
00306 sprintf (outstr, "xwr r%d,r%d\n\tmov r%d,r%d\n\txwr r%d,r%d",
00307 op2r, cntreg_1750, op0r, op1r, op2r, cntreg_1750);
00308 return outstr;
00309 }
00310
00311 const char *
00312 mod_regno_adjust (instr, op)
00313 const char *instr;
00314 rtx *op;
00315 {
00316 static char outstr[40];
00317 const char *const r = (!strncmp (instr, "dvr", 3) ? "r" : "");
00318 int modregno_gcc = REGNO (op[3]), modregno_1750 = REGNO (op[0]) + 1;
00319
00320 if (modregno_gcc == modregno_1750
00321 || (reg_renumber != NULL
00322 && reg_renumber[modregno_gcc] >= 0
00323 && reg_renumber[modregno_gcc] == reg_renumber[modregno_1750]))
00324 sprintf (outstr, "%s r%%0,%s%%2", instr, r);
00325 else
00326 sprintf (outstr, "lr r%d,r%d\n\t%s r%%0,%s%%2\n\txwr r%d,r%d",
00327 modregno_gcc, modregno_1750, instr, r, modregno_1750,
00328 modregno_gcc);
00329 return outstr;
00330 }
00331
00332
00333
00334
00335
00336 int
00337 memop_valid (op)
00338 rtx op;
00339 {
00340 static int recurred = 0;
00341 int valid_operand;
00342
00343 if (GET_MODE (op) != Pmode && GET_MODE (op) != VOIDmode
00344 && GET_MODE (op) != QImode)
00345 return 0;
00346 switch (GET_CODE (op))
00347 {
00348 case MEM:
00349 if (!recurred && GET_CODE (XEXP (op, 0)) == REG)
00350 return 1;
00351 case MINUS:
00352 case MULT:
00353 case DIV:
00354 return 0;
00355 case PLUS:
00356 recurred = 1;
00357 valid_operand = memop_valid (XEXP (op, 0));
00358 if (valid_operand)
00359 valid_operand = memop_valid (XEXP (op, 1));
00360 recurred = 0;
00361 return valid_operand;
00362 case REG:
00363 if (REGNO (op) > 0)
00364 return 1;
00365 return 0;
00366 case CONST:
00367 case CONST_INT:
00368 case SYMBOL_REF:
00369 case SUBREG:
00370 return 1;
00371 default:
00372 printf ("memop_valid: code=%d\n", (int) GET_CODE (op));
00373 return 1;
00374 }
00375 }
00376
00377
00378
00379 int
00380 mov_memory_operand (op, mode)
00381 rtx op;
00382 enum machine_mode mode ATTRIBUTE_UNUSED;
00383 {
00384 return (GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) == REG);
00385 }
00386
00387
00388 int
00389 small_nonneg_const (op, mode)
00390 rtx op;
00391 enum machine_mode mode ATTRIBUTE_UNUSED;
00392 {
00393 if (GET_CODE (op) == CONST_INT && INTVAL (op) >= 0 && INTVAL (op) <= 15)
00394 return 1;
00395 return 0;
00396 }
00397
00398
00399 int
00400 zero_operand (op, mode)
00401 rtx op;
00402 enum machine_mode mode;
00403 {
00404 return op == CONST0_RTX (mode);
00405 }
00406
00407
00408
00409
00410 int
00411 b_mode_operand (op)
00412 rtx op;
00413 {
00414 if (GET_CODE (op) == MEM)
00415 {
00416 rtx inner = XEXP (op, 0);
00417 if (GET_CODE (inner) == REG && REG_OK_FOR_INDEX_P (inner))
00418 return 1;
00419 if (GET_CODE (inner) == PLUS)
00420 {
00421 rtx plus_op0 = XEXP (inner, 0);
00422 if (GET_CODE (plus_op0) == REG && REG_OK_FOR_INDEX_P (plus_op0))
00423 {
00424 rtx plus_op1 = XEXP (inner, 1);
00425 if (GET_CODE (plus_op1) == CONST_INT
00426 && INTVAL (plus_op1) >= 0
00427 && INTVAL (plus_op1) <= 255)
00428 return 1;
00429 }
00430 }
00431 }
00432 return 0;
00433 }
00434
00435
00436
00437
00438
00439 int
00440 find_jmplbl (labelnum)
00441 int labelnum;
00442 {
00443 int i, found = 0;
00444
00445 for (i = 0; i <= jmplbl_ndx; i++)
00446 if (labelnum == jmplbl[i].num)
00447 {
00448 found = 1;
00449 break;
00450 }
00451 if (found)
00452 return i;
00453 return -1;
00454 }
00455
00456 const char *
00457 branch_or_jump (condition, targetlabel_number)
00458 const char *condition;
00459 int targetlabel_number;
00460 {
00461 static char buf[30];
00462 int index;
00463
00464 if ((index = find_jmplbl (targetlabel_number)) >= 0)
00465 if (program_counter - jmplbl[index].pc < 128)
00466 {
00467 sprintf (buf, "b%s %%l0", condition);
00468 return buf;
00469 }
00470 sprintf (buf, "jc %s,%%l0", condition);
00471 return buf;
00472 }
00473
00474
00475 int
00476 unsigned_comparison_operator (insn)
00477 rtx insn;
00478 {
00479 switch (GET_CODE (insn))
00480 {
00481 case GEU:
00482 case GTU:
00483 case LEU:
00484 case LTU:
00485 return 1;
00486 default:
00487 return 0;
00488 }
00489 }
00490
00491 int
00492 next_cc_user_is_unsigned (insn)
00493 rtx insn;
00494 {
00495 if ( !(insn = next_cc0_user (insn)))
00496 abort ();
00497 else if (GET_CODE (insn) == JUMP_INSN
00498 && GET_CODE (PATTERN (insn)) == SET
00499 && GET_CODE (SET_SRC (PATTERN (insn))) == IF_THEN_ELSE)
00500 return unsigned_comparison_operator (XEXP (SET_SRC (PATTERN (insn)), 0));
00501 else if (GET_CODE (insn) == INSN
00502 && GET_CODE (PATTERN (insn)) == SET)
00503 return unsigned_comparison_operator (SET_SRC (PATTERN (insn)));
00504 else
00505 abort ();
00506 }
00507
00508
00509 static int addr_inc;
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541 void
00542 print_operand (file, x, letter)
00543 FILE *file;
00544 rtx x;
00545 int letter;
00546 {
00547 switch (GET_CODE (x))
00548 {
00549 case REG:
00550 if (letter == 'd')
00551 fprintf (file, "%d", REGNO (x) + 1);
00552 else if (letter == 't')
00553 fprintf (file, "%d", REGNO (x) + 2);
00554 else
00555 fprintf (file, "%d", REGNO (x));
00556 break;
00557
00558 case SYMBOL_REF:
00559 fprintf (file, "%s", XSTR (x, 0));
00560 if (letter == 'A')
00561 fprintf (file, "+1");
00562 break;
00563
00564 case LABEL_REF:
00565 case CONST:
00566 case MEM:
00567 if (letter == 'Q')
00568 {
00569 rtx inner = XEXP (x, 0);
00570 switch (GET_CODE (inner))
00571 {
00572 case REG:
00573 fprintf (file, "r%d,0", REGNO (inner));
00574 break;
00575 case PLUS:
00576 fprintf (file, "r%d,%d", REGNO (XEXP (inner, 0)),
00577 INTVAL (XEXP (inner, 1)));
00578 break;
00579 default:
00580 fprintf (file, "[ill Q code=%d]", GET_CODE (inner));
00581 }
00582 }
00583 else
00584 {
00585 addr_inc = (letter == 'A' ? 1 : 0);
00586 output_address (XEXP (x, 0));
00587 }
00588 break;
00589
00590 case CONST_DOUBLE:
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643 fprintf (file, "%f", get_double (x));
00644 break;
00645
00646 case CONST_INT:
00647 if (letter == 'J')
00648 fprintf (file, HOST_WIDE_INT_PRINT_DEC, -INTVAL (x));
00649 else if (letter == 'b')
00650 fprintf (file, "%d", which_bit (INTVAL (x)));
00651 else if (letter == 'B')
00652 fprintf (file, "%d", which_bit (~INTVAL (x)));
00653 else if (letter == 'w')
00654 fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x) - 16);
00655 else
00656 fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
00657 break;
00658
00659 case CODE_LABEL:
00660 fprintf (file, "L%d", XINT (x, 3));
00661 break;
00662
00663 case CALL:
00664 fprintf (file, "CALL nargs=");
00665 fprintf (file, HOST_PTR_PRINTF, (PTR) XEXP (x, 1));
00666 fprintf (file, ", func is either '%s' or '%s'",
00667 XSTR (XEXP (XEXP (x, 0), 1), 0), XSTR (XEXP (x, 0), 1));
00668 break;
00669
00670 case PLUS:
00671 {
00672 rtx op0 = XEXP (x, 0), op1 = XEXP (x, 1);
00673 int op0code = GET_CODE (op0), op1code = GET_CODE (op1);
00674 if (op1code == CONST_INT)
00675 switch (op0code)
00676 {
00677 case REG:
00678 fprintf (file, "%d,r%d ; p_o_PLUS for REG and CONST_INT",
00679 INTVAL (op1), REGNO (op0));
00680 break;
00681 case SYMBOL_REF:
00682 fprintf (file, "%d+%s", INTVAL (op1), XSTR (op0, 0));
00683 break;
00684 case MEM:
00685 fprintf (file, "%d,[mem:", INTVAL (op1));
00686 output_address (XEXP (op0, 0));
00687 fprintf (file, "] ;P_O plus");
00688 break;
00689 default:
00690 fprintf (file, "p_o_PLUS UFO, code=%d, with CONST=%d",
00691 (int) op0code, INTVAL (op1));
00692 }
00693 else if (op1code == SYMBOL_REF && op0code == REG)
00694 fprintf (file, "%s,r%d ; P_O: (plus reg sym)",
00695 XSTR (op1, 0), REGNO (op0));
00696 else
00697 fprintf (file, "p_o_+: op0code=%d, op1code=%d", op0code, op1code);
00698 }
00699 break;
00700
00701 default:
00702 fprintf (file, "p_o_UFO code=%d", GET_CODE (x));
00703 }
00704
00705 addr_inc = 0;
00706 }
00707
00708 void
00709 print_operand_address (file, addr)
00710 FILE *file;
00711 rtx addr;
00712 {
00713 switch (GET_CODE (addr))
00714 {
00715 case REG:
00716 fprintf (file, "%d,r%d ; P_O_A", addr_inc, REGNO (addr));
00717 break;
00718 case PLUS:
00719 {
00720 register rtx x = XEXP (addr, 0), y = XEXP (addr, 1);
00721 switch (GET_CODE (x))
00722 {
00723 case REG:
00724 switch (GET_CODE (y))
00725 {
00726 case CONST:
00727 output_address (XEXP (y, 0));
00728 fprintf (file, ",r%d ;P_O_A reg + const expr", REGNO (x));
00729 break;
00730 case CONST_INT:
00731 fprintf (file, "%d,r%d", INTVAL (y) + addr_inc, REGNO (x));
00732 break;
00733 case SYMBOL_REF:
00734 fprintf (file, "%s", XSTR (y, 0));
00735 if (addr_inc)
00736 fprintf (file, "+%d", addr_inc);
00737 fprintf (file, ",r%d ; P_O_A reg + sym", REGNO (x));
00738 break;
00739 case LABEL_REF:
00740 output_address (XEXP (y, 0));
00741 fprintf (file, ",r%d ; P_O_A reg + label", REGNO (x));
00742 break;
00743 default:
00744 fprintf (file, "[P_O_A reg%d+UFO code=%d]",
00745 REGNO (x), GET_CODE (y));
00746 }
00747 break;
00748 case LABEL_REF:
00749 output_address (XEXP (x, 0));
00750 break;
00751 case SYMBOL_REF:
00752 switch (GET_CODE (y))
00753 {
00754 case CONST_INT:
00755 fprintf (file, "%d+%s", INTVAL (y) + addr_inc, XSTR (x, 0));
00756 break;
00757 case REG:
00758 fprintf (file, "%s,r%d ;P_O_A sym + reg",
00759 XSTR (x, 0), REGNO (y));
00760 break;
00761 default:
00762 fprintf (file, "P_O_A sym/lab+UFO[sym=%s,code(y)=%d]",
00763 XSTR (x, 0), GET_CODE (y));
00764 }
00765 break;
00766 case CONST:
00767 output_address (XEXP (x, 0));
00768 if (GET_CODE (y) == REG)
00769 fprintf (file, ",r%d ;P_O_A const + reg", REGNO (x));
00770 else
00771 fprintf (file, "P_O_A const+UFO code(y)=%d]", GET_CODE (y));
00772 break;
00773 case MEM:
00774 output_address (y);
00775 fprintf (file, ",[mem:");
00776 output_address (XEXP (x, 0));
00777 fprintf (file, "] ;P_O_A plus");
00778 break;
00779 default:
00780 fprintf (file, "P_O_A plus op1_UFO[code1=%d,code2=%d]",
00781 GET_CODE (x), GET_CODE (y));
00782 }
00783 }
00784 break;
00785 case CONST_INT:
00786 if (INTVAL (addr) < 0x10000 && INTVAL (addr) >= -0x10000)
00787 fprintf (file, "%d ; p_o_a const addr?!", INTVAL (addr));
00788 else
00789 {
00790 fprintf (file, "[p_o_a=ILLEGAL_CONST]");
00791 output_addr_const (file, addr);
00792 }
00793 break;
00794 case LABEL_REF:
00795 case SYMBOL_REF:
00796 fprintf (file, "%s", XSTR (addr, 0));
00797 if (addr_inc)
00798 fprintf (file, "+%d", addr_inc);
00799 break;
00800 case MEM:
00801 fprintf (file, "[memUFO:");
00802 output_address (XEXP (addr, 0));
00803 fprintf (file, "]");
00804 break;
00805 case CONST:
00806 output_address (XEXP (addr, 0));
00807 fprintf (file, " ;P_O_A const");
00808 break;
00809 case CODE_LABEL:
00810 fprintf (file, "L%d", XINT (addr, 3));
00811 break;
00812 default:
00813 fprintf (file, " p_o_a UFO, code=%d val=0x%x",
00814 (int) GET_CODE (addr), INTVAL (addr));
00815 break;
00816 }
00817 addr_inc = 0;
00818 }
00819
00820
00821
00822
00823 static bool
00824 assemble_integer_1750a (x, size, aligned_p)
00825 rtx x;
00826 unsigned int size;
00827 int aligned_p;
00828 {
00829 if (default_assemble_integer (x, size, aligned_p))
00830 {
00831 if (label_pending)
00832 label_pending = 0;
00833 datalbl[datalbl_ndx].size += size;
00834 return true;
00835 }
00836 return false;
00837 }
00838
00839
00840
00841
00842
00843
00844
00845 int
00846 one_bit_set_p (x)
00847 int x;
00848 {
00849 x &= 0xffff;
00850 return x && (x & (x - 1)) == 0;
00851 }
00852
00853
00854
00855
00856
00857
00858 static int
00859 which_bit (x)
00860 int x;
00861 {
00862 int b = 15;
00863
00864 while (b > 0 && (x & 1) == 0)
00865 {
00866 b--;
00867 x >>= 1;
00868 }
00869
00870 return b;
00871 }
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884 long
00885 real_value_to_target_single(in)
00886 REAL_VALUE_TYPE in;
00887 {
00888 union {
00889 double d;
00890 struct {
00891 #if HOST_WORDS_BIG_ENDIAN
00892 unsigned int negative:1;
00893 unsigned int exponent:11;
00894 unsigned int mantissa0:20;
00895 unsigned int mantissa1:32;
00896 #else
00897 unsigned int mantissa1:32;
00898 unsigned int mantissa0:20;
00899 unsigned int exponent:11;
00900 unsigned int negative:1;
00901 #endif
00902 } s;
00903 } ieee;
00904
00905 unsigned int mant;
00906 int exp;
00907
00908 if (HOST_FLOAT_FORMAT != IEEE_FLOAT_FORMAT)
00909 abort ();
00910
00911 ieee.d = in;
00912
00913
00914
00915 exp = ieee.s.exponent - 0x3ff;
00916 mant = 1 << 23 | ieee.s.mantissa0 << 3 | ieee.s.mantissa1 >> 29;
00917
00918
00919
00920 if (! ieee.s.negative)
00921 {
00922 mant >>= 1;
00923 exp += 1;
00924 }
00925
00926
00927 if (exp > 127)
00928 {
00929 exp = 127;
00930 mant = (ieee.s.negative ? 0xffffff : 0x7fffff);
00931 }
00932
00933 else if (exp < -128)
00934 {
00935 exp = 0;
00936 mant = 0;
00937 }
00938
00939 return mant << 8 | (exp & 0xff);
00940 }
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952 void
00953 real_value_to_target_double(in, out)
00954 REAL_VALUE_TYPE in;
00955 long out[];
00956 {
00957 union {
00958 double d;
00959 struct {
00960 #if HOST_WORDS_BIG_ENDIAN
00961 unsigned int negative:1;
00962 unsigned int exponent:11;
00963 unsigned int mantissa0:20;
00964 unsigned int mantissa1:32;
00965 #else
00966 unsigned int mantissa1:32;
00967 unsigned int mantissa0:20;
00968 unsigned int exponent:11;
00969 unsigned int negative:1;
00970 #endif
00971 } s;
00972 } ieee;
00973
00974 unsigned int mant_h24, mant_l16;
00975 int exp;
00976
00977 if (HOST_FLOAT_FORMAT != IEEE_FLOAT_FORMAT)
00978 abort ();
00979
00980 ieee.d = in;
00981
00982
00983
00984 exp = ieee.s.exponent - 0x3ff;
00985 mant_h24 = 1 << 23 | ieee.s.mantissa0 << 3 | ieee.s.mantissa1 >> 29;
00986 mant_l16 = (ieee.s.mantissa1 >> 13) & 0xffff;
00987
00988
00989
00990 if (! ieee.s.negative)
00991 {
00992 mant_l16 = mant_l16 >> 1 | (mant_h24 & 1) << 15;
00993 mant_h24 >>= 1;
00994 exp += 1;
00995 }
00996
00997
00998 if (exp > 127)
00999 {
01000 exp = 127;
01001 mant_h24 = (ieee.s.negative ? 0xffffff : 0x7fffff);
01002 mant_l16 = 0xffff;
01003 }
01004
01005 else if (exp < -128)
01006 {
01007 exp = 0;
01008 mant_h24 = 0;
01009 mant_l16 = 0;
01010 }
01011
01012 out[0] = mant_h24 << 8 | (exp & 0xff);
01013 out[1] = mant_l16;
01014 }