update copyrights in config dir.
[official-gcc.git] / gcc / config / elxsi / elxsi.c
blob4242b3855bed9ba7117dd15d8965fc714d8a864d
1 /* Subroutines for insn-output.c for GNU compiler. Elxsi version.
2 Copyright (C) 1987, 1992, 1998, 1999, 2000 Free Software Foundation, Inc
3 Contributrd by Mike Stump <mrs@cygnus.com> in 1988 and is the first
4 64 bit port of GNU CC.
5 Based upon the VAX port.
7 This file is part of GNU CC.
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.
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.
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
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
24 #include "config.h"
25 #include "system.h"
26 #include "rtl.h"
27 #include "function.h"
28 #include "output.h"
29 #include "tm_p.h"
31 extern const char *reg_names[];
32 rtx cmp_op0=0, cmp_op1=0;
34 /* table of relations for compares and branches */
35 static const char *const cmp_tab[] = {
36 "gt", "gt", "eq", "eq", "ge", "ge", "lt", "lt", "ne", "ne",
37 "le", "le" };
39 /* type is the index into the above table */
40 /* s is "" for signed, or "u" for unsigned */
41 const char *
42 cmp_jmp (s, type, where)
43 const char *s;
44 int type;
45 rtx where;
47 rtx br_ops[3];
48 char template[50];
49 const char *f = "";
50 const char *bits = "64";
51 if (GET_MODE (cmp_op0) == SFmode) f = "f", bits = "32";
52 if (GET_MODE (cmp_op0) == DFmode) f = "f";
53 br_ops[0] = where;
54 br_ops[1] = cmp_op0;
55 br_ops[2] = cmp_op1;
56 if (cmp_op1)
57 sprintf(template, "%scmp%s.br.%s\t%%1,%%2:j%s\t%%l0",
58 f, s, bits, cmp_tab[type]);
59 else if (*f)
60 sprintf(template, "fcmp.br.%s\t%%1,=0:j%s\t%%l0",
61 bits, cmp_tab[type]);
62 else if (*s) /* can turn the below in to a jmp ... */
63 sprintf(template, "cmpu.br.64\t%%1,=0:j%s\t%%l0", s);
64 else
65 sprintf(template, "jmp.%s\t%%1,%%l0", cmp_tab[type+1]);
66 output_asm_insn(template, br_ops);
67 return "";
70 const char *
71 cmp_set (s, type, reg)
72 const char *s, *type;
73 rtx reg;
75 rtx br_ops[3];
76 char template[50];
77 const char *f = "";
78 const char *bits = "64";
79 if (GET_MODE (cmp_op0) == SFmode) f = "f", bits = "32";
80 else if (GET_MODE (cmp_op0) == DFmode) f = "f";
81 else if (GET_MODE (cmp_op0) == SImode) bits = "32";
82 else if (GET_MODE (cmp_op0) == HImode) bits = "16";
83 else if (GET_MODE (cmp_op0) == QImode) bits = "8";
84 br_ops[0] = reg;
85 br_ops[1] = cmp_op0;
86 br_ops[2] = cmp_op1;
87 if (cmp_op1)
88 sprintf(template, "%scmp%s.%s\t%%0,%%1,%%2:%s",
89 f, s, bits, type);
90 else
91 sprintf(template, "%scmp%s.%s\t%%0,%%1,=0:%s",
92 f, s, bits, type);
93 output_asm_insn(template, br_ops);
94 return "";
97 void
98 print_operand_address (file, addr)
99 FILE *file;
100 register rtx addr;
102 register rtx reg1, reg2, breg, ireg;
103 rtx offset;
105 switch (GET_CODE (addr))
108 case MEM:
109 if (GET_CODE (XEXP (addr, 0)) == REG)
110 fprintf (file, "%s", reg_names[REGNO (addr)]);
111 else abort();
112 break;
114 case REG:
115 fprintf (file, "[%s]", reg_names[REGNO (addr)]);
116 break;
118 case PLUS:
119 reg1 = 0; reg2 = 0;
120 ireg = 0; breg = 0;
121 offset = 0;
122 if (GET_CODE (XEXP (addr, 0)) == REG)
124 offset = XEXP (addr, 1);
125 addr = XEXP (addr, 0);
127 else if (GET_CODE (XEXP (addr, 1)) == REG)
129 offset = XEXP (addr, 0);
130 addr = XEXP (addr, 1);
132 fprintf (file, "[%s]", reg_names[REGNO (addr)]);
133 output_address (offset);
134 break;
136 default:
137 output_addr_const (file, addr);