sparc_spec.pl 22 KB
Newer Older
Hannes Rapp's avatar
Hannes Rapp committed
1
# Creation: 2006/02/13
Michael Beck's avatar
Michael Beck committed
2
# $Id$
Hannes Rapp's avatar
Hannes Rapp committed
3
4
5
6
7

$arch = "sparc";

$mode_gp      = "mode_Iu";
$mode_flags   = "mode_Bu";
8
$mode_fpflags = "mode_Bu";
9
10
11
$mode_fp      = "mode_F";
$mode_fp2     = "mode_D";
$mode_fp4     = "mode_E"; # not correct, we need to register a new mode
Hannes Rapp's avatar
Hannes Rapp committed
12

Matthias Braun's avatar
Matthias Braun committed
13
14
15
16
17
18
19
$normal      =  0; # no special type
$caller_save =  1; # caller save (register must be saved by the caller of a function)
$callee_save =  2; # callee save (register must be saved by the called function)
$ignore      =  4; # ignore (do not assign this register)
$arbitrary   =  8; # emitter can choose an arbitrary register of this class
$virtual     = 16; # the register is a virtual one
$state       = 32; # register represents a state
Hannes Rapp's avatar
Hannes Rapp committed
20
21
22
23

# available SPARC registers: 8 globals, 24 window regs (8 ins, 8 outs, 8 locals)
%reg_classes = (
	gp => [
24
25
26
27
28
29
30
31
		{ name => "g0", type => $ignore }, # hardwired 0, behaves like /dev/null
		{ name => "g1", type => $caller_save }, # temp. value
		{ name => "g2", type => $caller_save },
		{ name => "g3", type => $caller_save },
		{ name => "g4", type => $caller_save },
		{ name => "g5", type => $ignore }, # reserved by SPARC ABI
		{ name => "g6", type => $ignore }, # reserved by SPARC ABI
		{ name => "g7", type => $ignore }, # reserved by SPARC ABI
Hannes Rapp's avatar
Hannes Rapp committed
32
33

		# window's out registers
34
35
36
37
38
39
40
41
		{ name => "o0", type => $caller_save }, # param 1 / return value from callee
		{ name => "o1", type => $caller_save }, # param 2
		{ name => "o2", type => $caller_save }, # param 3
		{ name => "o3", type => $caller_save }, # param 4
		{ name => "o4", type => $caller_save }, # param 5
		{ name => "o5", type => $caller_save }, # param 6
		{ name => "sp", type => $ignore }, # our stackpointer
		{ name => "o7", type => $ignore }, # temp. value / address of CALL instr.
Hannes Rapp's avatar
Hannes Rapp committed
42
43

		# window's local registers
44
45
46
47
48
49
50
51
		{ name => "l0", type => 0 },
		{ name => "l1", type => 0 },
		{ name => "l2", type => 0 },
		{ name => "l3", type => 0 },
		{ name => "l4", type => 0 },
		{ name => "l5", type => 0 },
		{ name => "l6", type => 0 },
		{ name => "l7", type => 0 },
Hannes Rapp's avatar
Hannes Rapp committed
52
53

		# window's in registers
54
55
56
57
58
59
		{ name => "i0", type => 0 }, # incoming param1 / return value to caller
		{ name => "i1", type => 0 }, # param 2
		{ name => "i2", type => 0 }, # param 3
		{ name => "i3", type => 0 }, # param 4
		{ name => "i4", type => 0 }, # param 5
		{ name => "i5", type => 0 }, # param 6
60
		{ name => "frame_pointer", realname => "fp", type => $ignore }, # our framepointer
61
		{ name => "i7", type => $ignore }, # return address - 8
Hannes Rapp's avatar
Hannes Rapp committed
62
63
		{ mode => $mode_gp }
	],
64
	fpflags_class => [
65
66
67
68
69
		{ name => "fpflags", type => $ignore },
		{ mode => $mode_fpflags, flags => "manual_ra" }
	],
	flags_class => [
		{ name => "flags", type => $ignore },
Hannes Rapp's avatar
Hannes Rapp committed
70
71
		{ mode => $mode_flags, flags => "manual_ra" }
	],
72
73
74
75
	mul_div_high_res => [
		{ name => "y", type => $ignore },
		{ mode => $mode_gp, flags => "manual_ra" }
	],
Hannes Rapp's avatar
Hannes Rapp committed
76
	# fp registers can be accessed any time
77
	fp => [
Matthias Braun's avatar
Matthias Braun committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
		{ name => "f0",  type => $caller_save },
		{ name => "f1",  type => $caller_save },
		{ name => "f2",  type => $caller_save },
		{ name => "f3",  type => $caller_save },
		{ name => "f4",  type => $caller_save },
		{ name => "f5",  type => $caller_save },
		{ name => "f6",  type => $caller_save },
		{ name => "f7",  type => $caller_save },
		{ name => "f8",  type => $caller_save },
		{ name => "f9",  type => $caller_save },
		{ name => "f10", type => $caller_save },
		{ name => "f11", type => $caller_save },
		{ name => "f12", type => $caller_save },
		{ name => "f13", type => $caller_save },
		{ name => "f14", type => $caller_save },
		{ name => "f15", type => $caller_save },
		{ name => "f16", type => $caller_save },
		{ name => "f17", type => $caller_save },
		{ name => "f18", type => $caller_save },
		{ name => "f19", type => $caller_save },
		{ name => "f20", type => $caller_save },
		{ name => "f21", type => $caller_save },
		{ name => "f22", type => $caller_save },
		{ name => "f23", type => $caller_save },
		{ name => "f24", type => $caller_save },
		{ name => "f25", type => $caller_save },
		{ name => "f26", type => $caller_save },
		{ name => "f27", type => $caller_save },
		{ name => "f28", type => $caller_save },
		{ name => "f29", type => $caller_save },
		{ name => "f30", type => $caller_save },
		{ name => "f31", type => $caller_save },
Hannes Rapp's avatar
Hannes Rapp committed
110
111
112
113
114
115
		{ mode => $mode_fp }
	]
); # %reg_classes

%emit_templates = (
# emit source reg or imm dep. on node's arity
116
	RI  => "${arch}_emit_reg_or_imm(node, -1);",
117
118
119
	R1I => "${arch}_emit_reg_or_imm(node, 0);",
	R2I => "${arch}_emit_reg_or_imm(node, 1);",
	R3I => "${arch}_emit_reg_or_imm(node, 2);",
120
121
122
123
124
125
126
127
128
129
130
131
132
	S1  => "${arch}_emit_source_register(node, 0);",
	S2  => "${arch}_emit_source_register(node, 1);",
	S3  => "${arch}_emit_source_register(node, 2);",
	S4  => "${arch}_emit_source_register(node, 3);",
	S5  => "${arch}_emit_source_register(node, 4);",
	S6  => "${arch}_emit_source_register(node, 5);",
	D1  => "${arch}_emit_dest_register(node, 0);",
	D2  => "${arch}_emit_dest_register(node, 1);",
	D3  => "${arch}_emit_dest_register(node, 2);",
	D4  => "${arch}_emit_dest_register(node, 3);",
	D5  => "${arch}_emit_dest_register(node, 4);",
	D6  => "${arch}_emit_dest_register(node, 5);",
	IM  => "${arch}_emit_immediate(node);",
133
	HIM => "${arch}_emit_high_immediate(node);",
Hannes Rapp's avatar
Hannes Rapp committed
134
135
	LM  => "${arch}_emit_load_mode(node);",
	SM  => "${arch}_emit_store_mode(node);",
136
	FLSM => "${arch}_emit_float_load_store_mode(node);",
Hannes Rapp's avatar
Hannes Rapp committed
137
	FPM  => "${arch}_emit_fp_mode_suffix(node);",
138
139
	FCONVS => "${arch}_emit_fp_conv_source(node);",
	FCONVD => "${arch}_emit_fp_conv_destination(node);",
140
141
	O2     => "${arch}_emit_offset(node, 1);",
	O3     => "${arch}_emit_offset(node, 2);",
Hannes Rapp's avatar
Hannes Rapp committed
142
143
144
145
146
147
148
);

$default_attr_type = "sparc_attr_t";
$default_copy_attr = "sparc_copy_attr";


%init_attr = (
Matthias Braun's avatar
Matthias Braun committed
149
	sparc_attr_t             => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
150
	sparc_load_store_attr_t  => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
Matthias Braun's avatar
Matthias Braun committed
151
152
153
	sparc_jmp_cond_attr_t    => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
	sparc_jmp_switch_attr_t  => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
	sparc_save_attr_t        => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
154
155
156
157
	sparc_fp_attr_t          => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
	                            "\tinit_sparc_fp_attributes(res, fp_mode);\n",
	sparc_fp_conv_attr_t     => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);".
	                            "\tinit_sparc_fp_conv_attributes(res, src_mode, dest_mode);\n",
Hannes Rapp's avatar
Hannes Rapp committed
158
159
160
);

%compare_attr = (
Matthias Braun's avatar
Matthias Braun committed
161
162
163
164
165
	sparc_attr_t            => "cmp_attr_sparc",
	sparc_load_store_attr_t => "cmp_attr_sparc_load_store",
	sparc_jmp_cond_attr_t   => "cmp_attr_sparc_jmp_cond",
	sparc_jmp_switch_attr_t	=> "cmp_attr_sparc_jmp_switch",
	sparc_save_attr_t       => "cmp_attr_sparc_save",
166
167
	sparc_fp_attr_t         => "cmp_attr_sparc_fp",
	sparc_fp_conv_attr_t    => "cmp_attr_sparc_fp_conv",
Hannes Rapp's avatar
Hannes Rapp committed
168
169
);

170
171
172
173
174
%custom_irn_flags = (
	modifies_flags    => "sparc_arch_irn_flag_modifies_flags",
	modifies_fp_flags => "sparc_arch_irn_flag_modifies_fp_flags",
);

Hannes Rapp's avatar
Hannes Rapp committed
175
176
177
178
# addressing modes: imm, reg, reg +/- imm, reg + reg
# max. imm = 13 bits signed (-4096 ... 4096)

my %cmp_operand_constructors = (
179
	imm => {
180
181
		attr       => "ir_entity *immediate_entity, int32_t immediate_value",
		custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
182
		reg_req    => { in => [ "gp" ], out => [ "flags" ] },
183
		ins        => [ "left" ],
184
185
186
187
188
	},
	reg => {
		reg_req    => { in => [ "gp", "gp" ], out => [ "flags" ] },
		ins        => [ "left", "right" ],
	},
Hannes Rapp's avatar
Hannes Rapp committed
189
190
191
);

my %unop_operand_constructors = (
192
	imm => {
193
194
		attr       => "ir_entity *immediate_entity, int32_t immediate_value",
		custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
195
196
197
198
199
		reg_req    => { in => [], out => [ "gp" ] },
	},
	reg => {
		reg_req    => { in => [ "gp" ], out => [ "gp" ] },
	},
Hannes Rapp's avatar
Hannes Rapp committed
200
201
202
);

my %binop_operand_constructors = (
203
	imm => {
204
205
		attr       => "ir_entity *immediate_entity, int32_t immediate_value",
		custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
206
207
208
209
210
211
212
		reg_req    => { in => [ "gp" ], out => [ "gp" ] },
		ins        => [ "left" ],
	},
	reg => {
		reg_req    => { in => [ "gp", "gp" ], out => [ "gp" ] },
		ins        => [ "left", "right" ],
	},
Hannes Rapp's avatar
Hannes Rapp committed
213
214
);

215
216
217
218
219
220
221
222
223
224
225
my %div_operand_constructors = (
	imm => {
		attr       => "ir_entity *immediate_entity, int32_t immediate_value",
		custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
		reg_req    => { in => [ "gp", "gp" ], out => [ "gp" ] },
	},
	reg => {
		reg_req    => { in => [ "gp", "gp", "gp" ], out => [ "gp" ] },
	},
);

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
my %float_binop_constructors = (
	s => {
		reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
		mode    => $mode_fp,
	},
	d => {
		reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fp:a|2" ] },
		mode    => $mode_fp2,
	},
	q => {
		reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fp:a|4" ] },
		mode    => $mode_fp4,
	}
);

241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
my %float_unop_constructors = (
	s => {
		reg_req => { in => [ "fp" ], out => [ "fp" ] },
		mode    => $mode_fp,
	},
	d => {
		reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|2" ] },
		mode    => $mode_fp2,
	},
	q => {
		reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|4" ] },
		mode    => $mode_fp4,
	}
);

Hannes Rapp's avatar
Hannes Rapp committed
256
257
258
%nodes = (

Add => {
259
260
261
	irn_flags    => [ "rematerializable" ],
	mode         => $mode_gp,
	emit         => '. add %S1, %R2I, %D1',
Matthias Braun's avatar
Matthias Braun committed
262
	constructors => \%binop_operand_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
263
264
265
},

Sub => {
266
267
268
	irn_flags    => [ "rematerializable" ],
	mode         => $mode_gp,
	emit         => '. sub %S1, %R2I, %D1',
Matthias Braun's avatar
Matthias Braun committed
269
	constructors => \%binop_operand_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
270
271
272
273
},


# Load / Store
274
Ld => {
Matthias Braun's avatar
Matthias Braun committed
275
276
	op_flags  => [ "labeled", "fragile" ],
	state     => "exc_pinned",
277
	constructors => {
278
279
280
281
282
		imm => {
			reg_req    => { in => [ "gp", "none" ], out => [ "gp", "none" ] },
			ins        => [ "ptr", "mem" ],
			attr       => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
			custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
283
		},
284
285
286
287
288
		reg => {
			reg_req    => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
			ins        => [ "ptr", "ptr2", "mem" ],
			attr       => "ir_mode *ls_mode",
			custominit => "init_sparc_load_store_attributes(res, ls_mode, NULL, 0, false, true);",
289
290
291
		},
	},
	ins       => [ "ptr", "mem" ],
292
	outs      => [ "res", "M" ],
Matthias Braun's avatar
Matthias Braun committed
293
	attr_type => "sparc_load_store_attr_t",
294
	emit      => '. ld%LM [%S1%O2], %D1'
Hannes Rapp's avatar
Hannes Rapp committed
295
296
},

297
298
299
300
301
SetHi => {
	irn_flags  => [ "rematerializable" ],
	outs       => [ "res" ],
	mode       => $mode_gp,
	reg_req    => { in => [], out => [ "gp" ] },
302
303
	attr       => "ir_entity *entity, int32_t immediate_value",
	custominit => "sparc_set_attr_imm(res, entity, immediate_value);",
304
	emit       => '. sethi %HIM, %D1'
Hannes Rapp's avatar
Hannes Rapp committed
305
306
},

307
St => {
Matthias Braun's avatar
Matthias Braun committed
308
	op_flags  => [ "labeled", "fragile" ],
309
	mode      => "mode_M",
Matthias Braun's avatar
Matthias Braun committed
310
	state     => "exc_pinned",
311
	constructors => {
312
313
314
315
316
		imm => {
			reg_req    => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
			ins        => [ "val", "ptr", "mem" ],
			attr       => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
			custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
317
		},
318
319
320
321
322
		reg => {
			reg_req    => { in => [ "gp", "gp", "gp", "none" ], out => [ "none" ] },
			ins        => [ "val", "ptr", "ptr2", "mem" ],
			attr       => "ir_mode *ls_mode",
			custominit => "init_sparc_load_store_attributes(res, ls_mode, NULL, 0, false, true);",
323
324
		},
	},
325
	ins       => [ "val", "ptr", "mem" ],
326
	outs      => [ "M" ],
Matthias Braun's avatar
Matthias Braun committed
327
	attr_type => "sparc_load_store_attr_t",
328
	emit      => '. st%SM %S1, [%S2%O3]'
Hannes Rapp's avatar
Hannes Rapp committed
329
330
},

331
332
Save => {
	reg_req   => {
Matthias Braun's avatar
Matthias Braun committed
333
		in => [ "sp", "none"],
334
		out => [ "sp:I|S", "frame_pointer:I", "none" ]
335
336
	},
	ins       => [ "stack", "mem" ],
337
	outs      => [ "stack", "frame", "mem" ],
338
339
	attr      => "int initial_stacksize",
	attr_type => "sparc_save_attr_t",
340
	init_attr => "\tinit_sparc_save_attributes(res, initial_stacksize);",
341
342
},

343
SubSP => {
Hannes Rapp's avatar
Hannes Rapp committed
344
345
346
347
348
349
	reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "gp", "none" ] },
	ins       => [ "stack", "size", "mem" ],
	outs      => [ "stack", "addr", "M" ],
	emit      => ". sub %S1, %S2, %D1\n",
},

350
AddSP => {
Hannes Rapp's avatar
Hannes Rapp committed
351
352
353
354
355
356
357
	reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "none" ] },
	ins       => [ "stack", "size", "mem" ],
	outs      => [ "stack", "M" ],
	emit      => ". add %S1, %S2, %D1\n",
},

FrameAddr => {
358
359
360
361
362
363
364
365
	op_flags   => [ "constlike" ],
	irn_flags  => [ "rematerializable" ],
	attr       => "ir_entity *entity, int32_t offset",
	reg_req    => { in => [ "gp" ], out => [ "gp" ] },
	ins        => [ "base" ],
	attr_type  => "sparc_attr_t",
	custominit => "sparc_set_attr_imm(res, entity, offset);",
	mode       => $mode_gp,
Hannes Rapp's avatar
Hannes Rapp committed
366
367
},

368
Bicc => {
369
	op_flags  => [ "labeled", "cfopcode", "forking" ],
Hannes Rapp's avatar
Hannes Rapp committed
370
371
	state     => "pinned",
	mode      => "mode_T",
372
373
374
	attr_type => "sparc_jmp_cond_attr_t",
	attr      => "pn_Cmp pnc, bool is_unsigned",
	init_attr => "\tinit_sparc_jmp_cond_attr(res, pnc, is_unsigned);",
Hannes Rapp's avatar
Hannes Rapp committed
375
	reg_req   => { in => [ "flags" ], out => [ "none", "none" ] },
376
377
378
379
380
381
},

fbfcc => {
	op_flags  => [ "labeled", "cfopcode", "forking" ],
	state     => "pinned",
	mode      => "mode_T",
Hannes Rapp's avatar
Hannes Rapp committed
382
	attr_type => "sparc_jmp_cond_attr_t",
383
384
385
	attr      => "pn_Cmp pnc",
	init_attr => "\tinit_sparc_jmp_cond_attr(res, pnc, false);",
	reg_req   => { in => [ "fpflags" ], out => [ "none", "none" ] },
Hannes Rapp's avatar
Hannes Rapp committed
386
387
},

388
Ba => {
Hannes Rapp's avatar
Hannes Rapp committed
389
	state     => "pinned",
390
391
	op_flags  => [ "cfopcode" ],
	irn_flags => [ "simple_jump" ],
Hannes Rapp's avatar
Hannes Rapp committed
392
393
394
395
	reg_req   => { out => [ "none" ] },
	mode      => "mode_X",
},

396
Call => {
397
	irn_flags => [ "modifies_flags", "modifies_fp_flags" ],
398
399
400
401
402
	state     => "exc_pinned",
	arity     => "variable",
	out_arity => "variable",
	constructors => {
		imm => {
403
404
			attr       => "ir_entity *entity, int32_t offset",
			custominit => "\tsparc_set_attr_imm(res, entity, offset);",
405
406
407
408
409
410
411
412
413
414
			arity     => "variable",
			out_arity => "variable",
		},
		reg => {
			arity     => "variable",
			out_arity => "variable",
		}
	},
},

Hannes Rapp's avatar
Hannes Rapp committed
415
Cmp => {
416
	irn_flags    => [ "rematerializable", "modifies_flags" ],
Hannes Rapp's avatar
Hannes Rapp committed
417
	emit         => '. cmp %S1, %R2I',
418
	ins          => [ "left", "right" ],
Hannes Rapp's avatar
Hannes Rapp committed
419
420
421
422
423
	mode         => $mode_flags,
	constructors => \%cmp_operand_constructors,
},

Tst => {
424
	irn_flags    => [ "rematerializable", "modifies_flags" ],
Hannes Rapp's avatar
Hannes Rapp committed
425
426
427
	emit         => '. tst %S1',
	mode         => $mode_flags,
	reg_req      => { in => [ "gp" ], out => [ "flags" ] },
428
	ins          => [ "val" ],
Hannes Rapp's avatar
Hannes Rapp committed
429
430
431
},

SwitchJmp => {
432
	op_flags  => [ "labeled", "cfopcode", "forking" ],
433
	irn_flags => [ "modifies_flags" ],
Hannes Rapp's avatar
Hannes Rapp committed
434
435
436
437
438
439
440
441
	state     => "pinned",
	mode      => "mode_T",
	attr      => "int n_projs, long def_proj_num",
	init_attr => "\tset_sparc_jmp_switch_n_projs(res, n_projs);\n".
					"\tset_sparc_jmp_switch_default_proj_num(res, def_proj_num);",
	reg_req   => { in => [ "gp" ], out => [ "none" ] },
	attr_type => "sparc_jmp_switch_attr_t",
},
Hannes Rapp's avatar
Hannes Rapp committed
442

443
Sll => {
444
445
446
	irn_flags    => [ "rematerializable" ],
	mode         => $mode_gp,
	emit         => '. sll %S1, %R2I, %D1',
Matthias Braun's avatar
Matthias Braun committed
447
	constructors => \%binop_operand_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
448
449
},

450
Slr => {
451
452
453
	irn_flags    => [ "rematerializable" ],
	mode         => $mode_gp,
	emit         => '. srl %S1, %R2I, %D1',
Matthias Braun's avatar
Matthias Braun committed
454
	constructors => \%binop_operand_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
455
456
},

457
Sra => {
458
459
460
	irn_flags    => [ "rematerializable" ],
	mode         => $mode_gp,
	emit         => '. sra %S1, %R2I, %D1',
Matthias Braun's avatar
Matthias Braun committed
461
	constructors => \%binop_operand_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
462
463
464
},

And => {
465
466
467
	irn_flags    => [ "rematerializable" ],
	mode         => $mode_gp,
	emit         => '. and %S1, %R2I, %D1',
Matthias Braun's avatar
Matthias Braun committed
468
	constructors => \%binop_operand_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
469
470
},

471
472
473
474
475
476
477
AndN => {
	irn_flags => [ "rematerializable" ],
	mode      => $mode_gp,
	emit      => '. andn %S1, %R2I, %D1',
	constructors => \%binop_operand_constructors,
},

Hannes Rapp's avatar
Hannes Rapp committed
478
Or => {
479
480
481
	irn_flags    => [ "rematerializable" ],
	mode         => $mode_gp,
	emit         => '. or %S1, %R2I, %D1',
Matthias Braun's avatar
Matthias Braun committed
482
	constructors => \%binop_operand_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
483
484
},

485
486
487
488
489
490
491
OrN => {
	irn_flags => [ "rematerializable" ],
	mode      => $mode_gp,
	emit      => '. orn %S1, %R2I, %D1',
	constructors => \%binop_operand_constructors,
},

492
Xor => {
493
494
495
	irn_flags    => [ "rematerializable" ],
	mode         => $mode_gp,
	emit         => '. xor %S1, %R2I, %D1',
Matthias Braun's avatar
Matthias Braun committed
496
	constructors => \%binop_operand_constructors,
497
498
},

499
500
501
502
503
504
505
XNor => {
	irn_flags => [ "rematerializable" ],
	mode      => $mode_gp,
	emit      => '. xnor %S1, %R2I, %D1',
	constructors => \%binop_operand_constructors,
},

Hannes Rapp's avatar
Hannes Rapp committed
506
Mul => {
507
	irn_flags    => [ "rematerializable" ],
508
509
	mode         => $mode_gp,
	emit         => '. smul %S1, %R2I, %D1',
Matthias Braun's avatar
Matthias Braun committed
510
	constructors => \%binop_operand_constructors,
511
512
},

Hannes Rapp's avatar
Hannes Rapp committed
513
Mulh => {
514
	irn_flags    => [ "rematerializable" ],
515
	outs         => [ "low", "high" ],
Matthias Braun's avatar
Matthias Braun committed
516
	constructors => \%binop_operand_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
517
518
},

519
SDiv => {
520
521
	irn_flags    => [ "rematerializable" ],
	state        => "exc_pinned",
522
	ins          => [ "dividend_high", "dividend_low", "divisor" ],
523
	outs         => [ "res", "M" ],
524
	constructors => \%div_operand_constructors,
525
526
527
},

UDiv => {
528
529
	irn_flags    => [ "rematerializable" ],
	state        => "exc_pinned",
530
	ins          => [ "dividend_high", "dividend_low", "divisor" ],
531
	outs         => [ "res", "M" ],
532
	constructors => \%div_operand_constructors,
533
534
},

535
536
537
538
539
540
fcmp => {
	irn_flags => [ "rematerializable", "modifies_fp_flags" ],
	emit      => '. fcmp%FPM %S1, %S2',
	attr_type => "sparc_fp_attr_t",
	attr      => "ir_mode *fp_mode",
	mode      => $mode_fpflags,
541
542
543
544
545
546
547
548
549
550
551
	constructors => {
		s => {
			reg_req => { in => [ "fp", "fp" ], out => [ "fpflags" ] },
		},
		d => {
			reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fpflags" ] },
		},
		q => {
			reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fpflags" ] },
		},
	},
552
},
Hannes Rapp's avatar
Hannes Rapp committed
553

554
fadd => {
555
556
557
558
559
	op_flags     => [ "commutative" ],
	irn_flags    => [ "rematerializable" ],
	emit         => '. fadd%FPM %S1, %S2, %D1',
	attr_type    => "sparc_fp_attr_t",
	attr         => "ir_mode *fp_mode",
560
	ins          => [ "left", "right" ],
561
	constructors => \%float_binop_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
562
563
},

564
fsub => {
565
566
567
568
	irn_flags    => [ "rematerializable" ],
	emit         => '. fsub%FPM %S1, %S2, %D1',
	attr_type    => "sparc_fp_attr_t",
	attr         => "ir_mode *fp_mode",
569
	ins          => [ "left", "right" ],
570
	constructors => \%float_binop_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
571
572
},

573
fmul => {
574
575
576
577
578
	irn_flags    => [ "rematerializable" ],
	op_flags     => [ "commutative" ],
	emit         =>'. fmul%FPM %S1, %S2, %D1',
	attr_type    => "sparc_fp_attr_t",
	attr         => "ir_mode *fp_mode",
579
	ins          => [ "left", "right" ],
580
	constructors => \%float_binop_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
581
582
},

583
fdiv => {
584
585
586
587
	irn_flags    => [ "rematerializable" ],
	emit         => '. fdiv%FPM %S1, %S2, %D1',
	attr_type    => "sparc_fp_attr_t",
	attr         => "ir_mode *fp_mode",
588
	ins          => [ "left", "right" ],
589
	outs         => [ "res", "M" ],
590
	constructors => \%float_binop_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
591
592
},

593
fneg => {
Matthias Braun's avatar
Matthias Braun committed
594
595
	irn_flags => [ "rematerializable" ],
	reg_req   => { in => [ "fp" ], out => [ "fp" ] },
596
597
	# note that we only need the first register even for wide-values
	emit      => '. fneg %S1, %D1',
598
599
	attr_type => "sparc_fp_attr_t",
	attr      => "ir_mode *fp_mode",
600
	ins          => [ "val" ],
601
	constructors => \%float_unop_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
602
603
},

604
"fabs" => {
605
	irn_flags    => [ "rematerializable" ],
606
607
	# note that we only need the first register even for wide-values
	emit         => '. fabs %S1, %D1',
608
609
	attr_type    => "sparc_fp_attr_t",
	attr         => "ir_mode *fp_mode",
610
	ins          => [ "val" ],
611
	constructors => \%float_unop_constructors,
Hannes Rapp's avatar
Hannes Rapp committed
612
613
},

614
fftof => {
Matthias Braun's avatar
Matthias Braun committed
615
	irn_flags => [ "rematerializable" ],
616
	emit      => '. f%FCONVS%.to%FCONVD %S1, %D1',
617
618
	attr_type => "sparc_fp_conv_attr_t",
	attr      => "ir_mode *src_mode, ir_mode *dest_mode",
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
	constructors => {
		s_d => {
			reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
			mode    => $mode_fp2,
		},
		s_q => {
			reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
			mode    => $mode_fp4,
		},
		d_s => {
			reg_req => { in => [ "fp:a|2" ], out => [ "fp" ] },
			mode    => $mode_fp,
		},
		d_q => {
			reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|4" ] },
			mode    => $mode_fp4,
		},
		q_s => {
			reg_req => { in => [ "fp:a|4" ], out => [ "fp" ] },
			mode    => $mode_fp,
		},
		q_d => {
			reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|2" ] },
			mode    => $mode_fp2,
		},
	},
Hannes Rapp's avatar
Hannes Rapp committed
645
646
},

647
fitof => {
Matthias Braun's avatar
Matthias Braun committed
648
	irn_flags => [ "rematerializable" ],
649
650
651
652
	reg_req   => { in => [ "gp" ], out => [ "fp" ] },
	emit      => '. fito%FPM %S1, %D1',
	attr_type => "sparc_fp_attr_t",
	attr      => "ir_mode *fp_mode",
653
654
655
656
657
658
659
660
661
662
663
664
665
666
	constructors => {
		s => {
			reg_req => { in => [ "gp" ], out => [ "fp" ] },
			mode    => $mode_fp,
		},
		d => {
			reg_req => { in => [ "gp" ], out => [ "fp:a|2" ] },
			mode    => $mode_fp2,
		},
		q => {
			reg_req => { in => [ "gp" ], out => [ "fp:a|4" ] },
			mode    => $mode_fp4,
		},
	},
Hannes Rapp's avatar
Hannes Rapp committed
667
668
},

669
fftoi => {
Matthias Braun's avatar
Matthias Braun committed
670
	irn_flags => [ "rematerializable" ],
671
	reg_req   => { in => [ "fp" ], out => [ "gp" ] },
672
673
674
675
	emit      => '. f%FPM.toi %S1, %D1',
	attr_type => "sparc_fp_attr_t",
	attr      => "ir_mode *fp_mode",
	mode      => $mode_gp,
676
677
678
679
680
681
682
683
684
685
686
	constructors => {
		s => {
			reg_req => { in => [ "gp" ], out => [ "gp" ] },
		},
		d => {
			reg_req => { in => [ "fp:a|2" ], out => [ "gp" ] },
		},
		q => {
			reg_req => { in => [ "fp:a|4" ], out => [ "gp" ] },
		},
	},
Matthias Braun's avatar
Matthias Braun committed
687
},
Hannes Rapp's avatar
Hannes Rapp committed
688

689
690
691
Ldf => {
	op_flags  => [ "labeled", "fragile" ],
	state     => "exc_pinned",
692
693
694
695
696
697
698
699
700
701
702
	constructors => {
		s => {
			reg_req => { in => [ "gp", "none" ], out => [ "fp", "none" ] },
		},
		d => {
			reg_req => { in => [ "gp", "none" ], out => [ "fp:a|2", "none" ] },
		},
		q => {
			reg_req => { in => [ "gp", "none" ], out => [ "fp:a|4", "none" ] },
		},
	},
703
704
705
	ins       => [ "ptr", "mem" ],
	outs      => [ "res", "M" ],
	attr_type => "sparc_load_store_attr_t",
706
	attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
707
708
	custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
	emit      => '. ld%FLSM [%S1%O2], %D1'
709
710
},

711
712
713
Stf => {
	op_flags  => [ "labeled", "fragile" ],
	state     => "exc_pinned",
714
715
	constructors => {
		s => {
716
			reg_req => { in => [ "fp",     "gp", "none" ], out => [ "none" ] },
717
718
		},
		d => {
719
			reg_req => { in => [ "fp:a|2", "gp", "none" ], out => [ "none" ] },
720
721
		},
		q => {
722
			reg_req => { in => [ "fp:a|4", "gp", "none" ], out => [ "none" ] },
723
724
		},
	},
725
	ins       => [ "val", "ptr", "mem" ],
726
727
	outs      => [ "M" ],
	attr_type => "sparc_load_store_attr_t",
728
	attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
729
730
	custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
	emit      => '. st%FLSM %S2, [%S1%O2]',
731
732
733
	mode      => 'mode_M',
},

Hannes Rapp's avatar
Hannes Rapp committed
734
); # end of %nodes