]>
Commit | Line | Data |
---|---|---|
f3684176 | 1 | /* Subroutines for insn-output.c for GNU compiler. Elxsi version. |
c5c76735 JL |
2 | Copyright (C) 1987, 1992, 1998, 1999 Free Software Foundation, Inc |
3 | Contributrd by Mike Stump <mrs@cygnus.com> in 1988 and is the first | |
f3684176 RS |
4 | 64 bit port of GNU CC. |
5 | Based upon the VAX port. | |
6 | ||
7 | This file is part of GNU CC. | |
8 | ||
9 | GNU CC is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 1, or (at your option) | |
12 | any later version. | |
13 | ||
14 | GNU CC is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with GNU CC; see the file COPYING. If not, write to | |
97aadbb9 RK |
21 | the Free Software Foundation, 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. */ | |
f3684176 | 23 | |
f3684176 | 24 | #include "config.h" |
c5c76735 | 25 | #include "system.h" |
f3684176 | 26 | #include "rtl.h" |
bf6bb899 | 27 | #include "function.h" |
f3684176 RS |
28 | |
29 | extern char *reg_names[]; | |
30 | rtx cmp_op0=0, cmp_op1=0; | |
31 | ||
32 | /* table of relations for compares and branches */ | |
33 | char *cmp_tab[] = { | |
34 | "gt", "gt", "eq", "eq", "ge", "ge", "lt", "lt", "ne", "ne", | |
35 | "le", "le" }; | |
36 | ||
37 | /* type is the index into the above table */ | |
38 | /* s is "" for signed, or "u" for unsigned */ | |
39 | char *cmp_jmp(s, type, where) char *s; rtx where; { | |
40 | rtx br_ops[3]; | |
41 | char template[50]; | |
42 | char *f = ""; | |
43 | char *bits = "64"; | |
44 | if (GET_MODE (cmp_op0) == SFmode) f = "f", bits = "32"; | |
45 | if (GET_MODE (cmp_op0) == DFmode) f = "f"; | |
46 | br_ops[0] = where; | |
47 | br_ops[1] = cmp_op0; | |
48 | br_ops[2] = cmp_op1; | |
49 | if (cmp_op1) | |
50 | sprintf(template, "%scmp%s.br.%s\t%%1,%%2:j%s\t%%l0", | |
51 | f, s, bits, cmp_tab[type]); | |
52 | else if (*f) | |
53 | sprintf(template, "fcmp.br.%s\t%%1,=0:j%s\t%%l0", | |
54 | bits, cmp_tab[type]); | |
55 | else if (*s) /* can turn the below in to a jmp ... */ | |
56 | sprintf(template, "cmpu.br.64\t%%1,=0:j%s\t%%l0", s, cmp_tab[type]); | |
57 | else | |
58 | sprintf(template, "jmp.%s\t%%1,%%l0", cmp_tab[type+1]); | |
59 | output_asm_insn(template, br_ops); | |
60 | return ""; | |
61 | } | |
62 | ||
63 | char *cmp_set(s, type, reg) char *s, *type; rtx reg; { | |
64 | rtx br_ops[3]; | |
65 | char template[50]; | |
66 | char *f = ""; | |
67 | char *bits = "64"; | |
68 | if (GET_MODE (cmp_op0) == SFmode) f = "f", bits = "32"; | |
69 | else if (GET_MODE (cmp_op0) == DFmode) f = "f"; | |
70 | else if (GET_MODE (cmp_op0) == SImode) bits = "32"; | |
71 | else if (GET_MODE (cmp_op0) == HImode) bits = "16"; | |
72 | else if (GET_MODE (cmp_op0) == QImode) bits = "8"; | |
73 | br_ops[0] = reg; | |
74 | br_ops[1] = cmp_op0; | |
75 | br_ops[2] = cmp_op1; | |
76 | if (cmp_op1) | |
77 | sprintf(template, "%scmp%s.%s\t%%0,%%1,%%2:%s", | |
78 | f, s, bits, type); | |
79 | else | |
80 | sprintf(template, "%scmp%s.%s\t%%0,%%1,=0:%s", | |
81 | f, s, bits, type); | |
82 | output_asm_insn(template, br_ops); | |
83 | return ""; | |
84 | } | |
85 | ||
86 | print_operand_address (file, addr) | |
87 | FILE *file; | |
88 | register rtx addr; | |
89 | { | |
90 | register rtx reg1, reg2, breg, ireg; | |
91 | rtx offset; | |
92 | ||
93 | retry: | |
94 | switch (GET_CODE (addr)) | |
95 | { | |
96 | ||
97 | case MEM: | |
98 | if (GET_CODE (XEXP (addr, 0)) == REG) | |
99 | fprintf (file, "%s", reg_names[REGNO (addr)]); | |
100 | else abort(); | |
101 | break; | |
102 | ||
103 | case REG: | |
104 | fprintf (file, "[%s]", reg_names[REGNO (addr)]); | |
105 | break; | |
106 | ||
107 | case PLUS: | |
108 | reg1 = 0; reg2 = 0; | |
109 | ireg = 0; breg = 0; | |
110 | offset = 0; | |
111 | if (GET_CODE (XEXP (addr, 0)) == REG) | |
112 | { | |
113 | offset = XEXP (addr, 1); | |
114 | addr = XEXP (addr, 0); | |
115 | } | |
116 | else if (GET_CODE (XEXP (addr, 1)) == REG) | |
117 | { | |
118 | offset = XEXP (addr, 0); | |
119 | addr = XEXP (addr, 1); | |
120 | } | |
121 | fprintf (file, "[%s]", reg_names[REGNO (addr)]); | |
122 | output_address (offset); | |
123 | break; | |
124 | ||
125 | default: | |
126 | output_addr_const (file, addr); | |
127 | } | |
128 | } |