amd64_spec.pl 18.8 KB
Newer Older
1
2
$arch = "amd64";

3
4
5
6
7
8
$mode_gp      = "mode_Lu";
$mode_flags   = "mode_Iu";
$mode_xmm      = "mode_D"; #TODO 128bit fp-mode
$status_flags = "all"; # TODO
$all_flags    = "all";

9
10
%reg_classes = (
	gp => [
11
12
13
14
15
16
17
		{ name => "rax", dwarf => 0 },
		{ name => "rcx", dwarf => 2 },
		{ name => "rdx", dwarf => 1 },
		{ name => "rsi", dwarf => 4 },
		{ name => "rdi", dwarf => 5 },
		{ name => "rbx", dwarf => 3 },
		{ name => "rbp", dwarf => 6 },
18
		{ name => "rsp", dwarf => 7 },
19
20
21
22
23
24
25
26
		{ name => "r8",  dwarf => 8 },
		{ name => "r9",  dwarf => 9 },
		{ name => "r10", dwarf => 10 },
		{ name => "r11", dwarf => 11 },
		{ name => "r12", dwarf => 12 },
		{ name => "r13", dwarf => 13 },
		{ name => "r14", dwarf => 14 },
		{ name => "r15", dwarf => 15 },
27
		{ mode => $mode_gp }
28
	],
29
	flags => [
30
		{ name => "eflags", dwarf => 49 },
31
		{ mode => $mode_flags, flags => "manual_ra" }
32
	],
33
34
35
36
37
38
39
40
41
42
43
	xmm => [
		{ name => "xmm0", dwarf => 17 },
		{ name => "xmm1", dwarf => 18 },
		{ name => "xmm2", dwarf => 19 },
		{ name => "xmm3", dwarf => 20 },
		{ name => "xmm4", dwarf => 21 },
		{ name => "xmm5", dwarf => 22 },
		{ name => "xmm6", dwarf => 23 },
		{ name => "xmm7", dwarf => 24 },
		{ mode => $mode_xmm }
	]
44
45
);

46
47
48
49
50
51
52
sub amd64_custom_init_attr {
	my $constr = shift;
	my $node   = shift;
	my $name   = shift;
	my $res    = "";

	if(defined($node->{modified_flags})) {
53
		$res .= "\tarch_add_irn_flags(res, arch_irn_flag_modify_flags);\n";
54
55
56
57
58
	}
	return $res;
}
$custom_init_attr_func = \&amd64_custom_init_attr;

59
60
$default_copy_attr = "amd64_copy_attr";

61
%init_attr = (
Matthias Braun's avatar
Matthias Braun committed
62
63
64
65
66
67
68
69
70
	amd64_attr_t =>
		"init_amd64_attributes(res, irn_flags_, in_reqs, n_res, op_mode);",
	amd64_addr_attr_t =>
		"init_amd64_attributes(res, irn_flags_, in_reqs, n_res, op_mode);\n"
		."\tattr->insn_mode = insn_mode;\n"
		."\tattr->addr = addr;",
	amd64_binop_addr_attr_t =>
		"init_be_info(res, irn_flags_, in_reqs, n_res);\n"
		."\t*attr = *attr_init;",
71
	amd64_switch_jmp_attr_t =>
Matthias Braun's avatar
Matthias Braun committed
72
73
		"init_amd64_attributes(res, irn_flags_, in_reqs, n_res, op_mode);\n"
		."\tinit_amd64_switch_attributes(res, table, table_entity);",
74
	amd64_cc_attr_t =>
Matthias Braun's avatar
Matthias Braun committed
75
76
		"init_amd64_attributes(res, irn_flags_, in_reqs, n_res, op_mode);\n"
		."\tinit_amd64_cc_attributes(res, cc);",
77
	amd64_movimm_attr_t =>
Matthias Braun's avatar
Matthias Braun committed
78
79
80
81
82
		"init_amd64_attributes(res, irn_flags_, in_reqs, n_res, op_mode);\n"
		."\tinit_amd64_movimm_attributes(res, insn_mode, entity, offset);",
	amd64_shift_attr_t =>
		"init_be_info(res, irn_flags_, in_reqs, n_res);\n"
		."\t*attr = *attr_init;\n",
83
84
85
);

%compare_attr = (
Matthias Braun's avatar
Matthias Braun committed
86
	amd64_addr_attr_t       => "cmp_amd64_addr_attr",
87
	amd64_attr_t            => "cmp_amd64_attr",
Matthias Braun's avatar
Matthias Braun committed
88
	amd64_binop_addr_attr_t => "cmp_amd64_binop_addr_attr",
89
	amd64_cc_attr_t         => "cmp_amd64_cc_attr",
Matthias Braun's avatar
Matthias Braun committed
90
91
92
	amd64_movimm_attr_t     => "cmp_amd64_movimm_attr",
	amd64_shift_attr_t      => "cmp_amd64_shift_attr",
	amd64_switch_jmp_attr_t => "cmp_amd64_switch_jmp_attr",
93
94
95
);

%nodes = (
96
PushAM => {
97
	op_flags  => [ "uses_memory" ],
98
	state     => "exc_pinned",
99
100
	reg_req   => { out => [ "rsp:I|S", "none" ] },
	arity     => "variable",
101
	outs      => [ "stack", "M" ],
Matthias Braun's avatar
Matthias Braun committed
102
103
104
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_addr_t addr",
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_ADDR;\n",
Matthias Braun's avatar
Matthias Braun committed
105
	emit      => "push%M %A",
106
107
},

108
109
110
111
112
113
114
115
116
117
PushRbp => {
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
	reg_req   => { in => [ "rsp" ], out => [ "rsp:I|S" ] },
	ins       => [ "stack" ],
	outs      => [ "stack" ],
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
	emit      => "pushq %%rbp",
},

118
119
120
PopAM => {
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
121
122
	reg_req   => { out => [ "rsp:I|S", "none" ] },
	arity     => "variable",
123
	outs      => [ "stack", "M" ],
Matthias Braun's avatar
Matthias Braun committed
124
125
126
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_addr_t addr",
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_ADDR;\n",
Matthias Braun's avatar
Matthias Braun committed
127
	emit      => "pop%M %A",
128
},
129

130
131
132
133
134
135
136
137
138
Leave => {
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
	reg_req   => { in => [ "rbp" ], out => [ "rbp:I", "rbp:I|S" ] },
	outs      => [ "frame", "stack" ],
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
	emit      => "leave",
},

139
Add => {
Matthias Braun's avatar
Matthias Braun committed
140
141
142
143
144
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
	reg_req   => { out => [ "gp", "flags", "none" ] },
	arity     => "variable",
	outs      => [ "res", "flags", "M" ],
Matthias Braun's avatar
Matthias Braun committed
145
146
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
147
148
	emit      => "add%M %AM",
	modified_flags => $status_flags,
149
},
150

151
And => {
Matthias Braun's avatar
Matthias Braun committed
152
153
154
155
156
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
	reg_req   => { out => [ "gp", "flags", "none" ] },
	arity     => "variable",
	outs      => [ "res", "flags", "M" ],
Matthias Braun's avatar
Matthias Braun committed
157
158
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
159
160
161
	emit      => "and%M %AM",
	modified_flags => $status_flags,

162
163
},

Matthias Braun's avatar
Matthias Braun committed
164
Div => {
165
	state     => "pinned",
Matthias Braun's avatar
Matthias Braun committed
166
167
168
169
170
	reg_req   => { out => [ "rax", "flags", "none", "rdx" ] },
	arity     => "variable",
	outs      => [ "res_div", "flags", "M", "res_mod" ],
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
171
	emit      => "div%M %AM",
172
	modified_flags => $status_flags,
Matthias Braun's avatar
Matthias Braun committed
173
174
175
},

IDiv => {
176
	state     => "pinned",
Matthias Braun's avatar
Matthias Braun committed
177
178
179
180
181
182
	reg_req   => { out => [ "rax", "flags", "none", "rdx" ] },
	arity     => "variable",
	outs      => [ "res_div", "flags", "M", "res_mod" ],
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit      => "idiv%M %AM",
183
	modified_flags => $status_flags,
Matthias Braun's avatar
Matthias Braun committed
184
185
},

186
187
IMul => {
	irn_flags => [ "rematerializable" ],
Robin Redeker's avatar
Robin Redeker committed
188
	state     => "exc_pinned",
Matthias Braun's avatar
Matthias Braun committed
189
190
191
	reg_req   => { out => [ "gp", "flags", "none" ] },
	outs      => [ "res", "flags", "M" ],
	arity     => "variable",
Matthias Braun's avatar
Matthias Braun committed
192
193
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
194
195
	emit      => "imul%M %AM",
	modified_flags => $status_flags,
196
},
197

198
199
200
201
202
203
204
205
206
207
208
209
210
IMul1Op => {
	# Do not rematerialize this node
	# It produces 2 results and has strict constraints
	state     => "exc_pinned",
	reg_req   => { out => [ "rax", "flags", "none", "rdx" ] },
	outs      => [ "res_low", "flags", "M", "res_high" ],
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit      => "imul%M %AM",
	modified_flags => $status_flags,
},

211
212
213
214
215
216
217
218
219
220
221
222
223
Mul => {
	# Do not rematerialize this node
	# It produces 2 results and has strict constraints
	state     => "exc_pinned",
	reg_req   => { out => [ "rax", "flags", "none", "rdx" ] },
	outs      => [ "res_low", "flags", "M", "res_high" ],
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit      => "mul%M %AM",
	modified_flags => $status_flags,
},

224
Or => {
Matthias Braun's avatar
Matthias Braun committed
225
226
227
228
229
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
	reg_req   => { out => [ "gp", "flags", "none" ] },
	outs      => [ "res", "flags", "M" ],
	arity     => "variable",
Matthias Braun's avatar
Matthias Braun committed
230
231
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
232
233
	emit      => "or%M %AM",
	modified_flags => $status_flags,
234
235
236
237
},

Shl => {
	irn_flags => [ "rematerializable" ],
Matthias Braun's avatar
Matthias Braun committed
238
	reg_req   => { out => [ "gp" ] },
239
	out       => [ "res" ],
Matthias Braun's avatar
Matthias Braun committed
240
	arity     => "variable",
Matthias Braun's avatar
Matthias Braun committed
241
242
243
	attr_type => "amd64_shift_attr_t",
	attr      => "const amd64_shift_attr_t *attr_init",
	emit      => "shl%MS %SO",
244
245
246
247
248
249
	mode      => $mode_gp,
	modified_flags => $status_flags
},

Shr => {
	irn_flags => [ "rematerializable" ],
Matthias Braun's avatar
Matthias Braun committed
250
	reg_req   => { out => [ "gp" ] },
251
	out       => [ "res" ],
Matthias Braun's avatar
Matthias Braun committed
252
	arity     => "variable",
Matthias Braun's avatar
Matthias Braun committed
253
254
255
	attr_type => "amd64_shift_attr_t",
	attr      => "const amd64_shift_attr_t *attr_init",
	emit      => "shr%MS %SO",
256
257
258
259
260
261
	mode      => $mode_gp,
	modified_flags => $status_flags
},

Sar => {
	irn_flags => [ "rematerializable" ],
Matthias Braun's avatar
Matthias Braun committed
262
	reg_req   => { out => [ "gp" ] },
263
	out       => [ "res" ],
Matthias Braun's avatar
Matthias Braun committed
264
	arity     => "variable",
Matthias Braun's avatar
Matthias Braun committed
265
266
267
	attr_type => "amd64_shift_attr_t",
	attr      => "const amd64_shift_attr_t *attr_init",
	emit      => "sar%MS %SO",
268
269
270
271
	mode      => $mode_gp,
	modified_flags => $status_flags
},

272
Sub => {
Matthias Braun's avatar
Matthias Braun committed
273
274
275
276
277
278
279
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
	reg_req   => { out => [ "gp", "flags", "none" ] },
	outs      => [ "res", "flags", "M" ],
	arity     => "variable",
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
280
	emit      => "sub%M %AM",
281
	modified_flags => $status_flags,
282
},
283

284
285
Sbb => {
	state     => "exc_pinned",
Tobias Rapp's avatar
Tobias Rapp committed
286
	reg_req   => { out => [ "gp", "flags", "none" ] },
287
	outs      => [ "res", "flags", "M" ],
Tobias Rapp's avatar
Tobias Rapp committed
288
	arity     => "variable",
289
290
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Tobias Rapp's avatar
Tobias Rapp committed
291
	emit      => "sbb%M %AM",
292
293
294
	modified_flags => $status_flags,
},

295
Neg => {
296
	irn_flags => [ "rematerializable" ],
Matthias Braun's avatar
Matthias Braun committed
297
	reg_req   => { in => [ "gp" ], out => [ "in_r1" ] },
298
	ins       => [ "val" ],
299
	outs      => [ "res" ],
300
	attr_type => "amd64_addr_attr_t",
Matthias Braun's avatar
Matthias Braun committed
301
	attr      => "amd64_insn_mode_t insn_mode",
302
303
304
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_UNOP_REG;\n"
	            ."amd64_addr_t addr = { { NULL, 0 }, NO_INPUT, NO_INPUT, NO_INPUT, 0, AMD64_SEGMENT_DEFAULT };",
	emit      => "neg%M %AM",
305
306
307
	mode      => $mode_gp,
	modified_flags => $status_flags
},
308

Christoph Mallon's avatar
Christoph Mallon committed
309
310
Not => {
	irn_flags => [ "rematerializable" ],
Matthias Braun's avatar
Matthias Braun committed
311
	attr      => "amd64_insn_mode_t insn_mode",
Matthias Braun's avatar
Matthias Braun committed
312
	init_attr => "attr->insn_mode = insn_mode;",
Christoph Mallon's avatar
Christoph Mallon committed
313
314
315
	reg_req   => { in => [ "gp" ], out => [ "in_r1" ] },
	ins       => [ "val" ],
	outs      => [ "res" ],
316
317
318
319
	attr_type => "amd64_addr_attr_t",
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_UNOP_REG;\n"
	            ."amd64_addr_t addr = { { NULL, 0 }, NO_INPUT, NO_INPUT, NO_INPUT, 0, AMD64_SEGMENT_DEFAULT };",
	emit      => "not%M %AM",
Christoph Mallon's avatar
Christoph Mallon committed
320
321
322
323
	mode      => $mode_gp,
	modified_flags => $status_flags
},

324
Xor => {
Matthias Braun's avatar
Matthias Braun committed
325
326
327
328
329
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
	reg_req   => { out => [ "gp", "flags", "none" ] },
	arity     => "variable",
	outs      => [ "res", "flags", "M" ],
Matthias Braun's avatar
Matthias Braun committed
330
331
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
332
333
	emit      => "xor%M %AM",
	modified_flags => $status_flags,
334
335
},

Matthias Braun's avatar
Matthias Braun committed
336
Xor0 => {
Matthias Braun's avatar
Matthias Braun committed
337
338
339
340
341
342
343
	op_flags  => [ "constlike" ],
	irn_flags => [ "rematerializable" ],
	reg_req   => { out => [ "gp" ] },
	outs      => [ "res" ],
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_REG_REG;",
	emit      => "xorl %3D0, %3D0",
	mode      => $mode_gp,
344
	modified_flags => $status_flags,
Matthias Braun's avatar
Matthias Braun committed
345
346
},

Matthias Braun's avatar
Matthias Braun committed
347
MovImm => {
348
	op_flags  => [ "constlike" ],
349
	irn_flags => [ "rematerializable" ],
350
	reg_req   => { out => [ "gp" ] },
Matthias Braun's avatar
Matthias Braun committed
351
352
353
354
	attr_type => "amd64_movimm_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, int64_t offset, ir_entity *entity",
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_IMM64;",
	emit      => 'mov%MM $%C, %D0',
355
	mode      => $mode_gp,
356
},
357

Matthias Braun's avatar
Matthias Braun committed
358
Movs => {
359
	state     => "exc_pinned",
Matthias Braun's avatar
Matthias Braun committed
360
361
362
	reg_req   => { out => [ "gp", "none", "none" ] },
	outs      => [ "res", "unused", "M" ],
	arity     => "variable",
Matthias Braun's avatar
Matthias Braun committed
363
364
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
Matthias Braun's avatar
Matthias Braun committed
365
366
367
	emit      => "movs%Mq %AM, %^D0",
},

Matthias Braun's avatar
Matthias Braun committed
368
Mov => {
Matthias Braun's avatar
Matthias Braun committed
369
370
371
372
	state     => "exc_pinned",
	reg_req   => { out => [ "gp", "none", "none" ] },
	outs      => [ "res", "unused", "M" ],
	arity     => "variable",
Matthias Braun's avatar
Matthias Braun committed
373
374
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
375
},
376

377
378
379
IJmp => {
	state     => "pinned",
	op_flags  => [ "cfopcode", "unknown_jump" ],
380
381
	reg_req   => { in => [ "gp" ], out => [ "none", "none", "none" ] },
	outs      => [ "X", "unused", "M" ],
382
383
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
384
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
385
	emit      => "jmp %*AM",
386
387
},

388
Jmp => {
Matthias Braun's avatar
Matthias Braun committed
389
390
391
392
393
	state    => "pinned",
	op_flags => [ "cfopcode" ],
	reg_req  => { out => [ "none" ] },
	fixed    => "amd64_op_mode_t op_mode = AMD64_OP_IMM32;",
	mode     => "mode_X",
394
},
395

396
Cmp => {
397
	irn_flags => [ "rematerializable" ],
398
	state     => "exc_pinned",
Matthias Braun's avatar
Matthias Braun committed
399
400
401
	reg_req   => { out => [ "none", "flags", "none" ] },
	arity     => "variable",
	outs      => [ "dummy", "flags", "M" ],
Matthias Braun's avatar
Matthias Braun committed
402
403
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
404
	emit      => "cmp%M %AM",
405
	modified_flags => $status_flags,
406
},
407

Matthias Braun's avatar
Matthias Braun committed
408
409
410
411
412
Lea => {
	irn_flags => [ "rematerializable" ],
	arity     => "variable",
	outs      => [ "res", "flags", "M" ],
	reg_req   => { out => [ "gp", "flags", "none" ] },
Matthias Braun's avatar
Matthias Braun committed
413
414
415
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_addr_t addr",
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_ADDR;\n",
Matthias Braun's avatar
Matthias Braun committed
416
	emit      => "lea%M %A, %D0",
Matthias Braun's avatar
Matthias Braun committed
417
418
},

419
420
Jcc => {
	state     => "pinned",
421
	op_flags  => [ "cfopcode", "forking" ],
422
423
424
	reg_req   => { in  => [ "eflags" ], out => [ "none", "none" ] },
	ins       => [ "eflags" ],
	outs      => [ "false", "true" ],
425
	attr_type => "amd64_cc_attr_t",
Matthias Braun's avatar
Matthias Braun committed
426
427
	attr      => "x86_condition_code_t cc",
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
428
429
	mode      => "mode_T",
},
430

431
Store => {
432
	op_flags  => [ "uses_memory" ],
433
	state     => "exc_pinned",
Matthias Braun's avatar
Matthias Braun committed
434
435
	reg_req   => { out => [ "none" ] },
	arity     => "variable",
436
	outs      => [ "M" ],
Matthias Braun's avatar
Matthias Braun committed
437
438
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
439
440
	mode      => "mode_M",
	emit      => "mov%M %S0, %A",
441
},
442
443

SwitchJmp => {
Matthias Braun's avatar
Matthias Braun committed
444
445
446
447
448
449
450
451
	op_flags  => [ "cfopcode", "forking" ],
	state     => "pinned",
	mode      => "mode_T",
	reg_req   => { in => [ "gp" ], out => [ "none" ] },
	out_arity => "variable",
	attr_type => "amd64_switch_jmp_attr_t",
	attr      => "const ir_switch_table *table, ir_entity *table_entity",
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
452
453
},

454
455
456
457
Call => {
	state     => "exc_pinned",
	arity     => "variable",
	out_arity => "variable",
Matthias Braun's avatar
Matthias Braun committed
458
459
460
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_op_mode_t op_mode, amd64_addr_t addr",
	fixed     => "amd64_insn_mode_t insn_mode = INSN_MODE_64;\n",
461
	emit      => "call %*AM",
462
	modified_flags => $all_flags,
463
464
465
466
467
468
},

Start => {
	state     => "pinned",
	out_arity => "variable",
	ins       => [],
Matthias Braun's avatar
Matthias Braun committed
469
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
470
471
472
},

Return => {
Matthias Braun's avatar
Matthias Braun committed
473
	state    => "pinned",
474
475
476
	op_flags => [ "cfopcode" ],
	arity    => "variable",
	reg_req  => { out => [ "none" ] },
Matthias Braun's avatar
Matthias Braun committed
477
	fixed    => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
478
479
480
	mode     => "mode_X",
},

481
482
# SSE

483
xAdds => {
484
485
	irn_flags  => [ "rematerializable" ],
	state     => "exc_pinned",
486
487
	reg_req   => { out => [ "xmm", "none", "none" ] },
	outs      => [ "res", "none", "M" ],
488
489
490
491
492
493
	arity     => "variable",
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
	emit      => "adds%MX %AM",
},

494
495
496
497
498
499
500
501
502
503
504
xDivs => {
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
	reg_req   => { out => [ "xmm", "none", "none" ] },
	outs      => [ "res_div", "none", "M" ],
	arity     => "variable",
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
	emit      => "divs%MX %AM",
},

505
506
507
508
509
510
511
512
513
514
xMovs => {
	state     => "exc_pinned",
	reg_req   => { out => [ "xmm", "none", "none" ] },
	outs      => [ "res", "unused", "M" ],
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit      => "movs%MX %AM, %D0",
},

Tobias Rapp's avatar
Tobias Rapp committed
515
516
517
518
519
520
521
522
523
524
525
xMuls => {
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
	reg_req   => { out => [ "xmm", "none", "none" ] },
	outs      => [ "res", "none", "M" ],
	arity     => "variable",
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
	emit      => "muls%MX %AM",
},

526
xStores => {
527
528
529
530
531
532
533
534
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
	reg_req   => { out => [ "none" ] },
	arity     => "variable",
	outs      => [ "M" ],
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
	mode      => "mode_M",
535
	emit      => "movs%MX %^S0, %A",
536
537
538
},


539
xSubs => {
540
541
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
542
543
	reg_req   => { out => [ "xmm", "none", "none" ] },
	outs      => [ "res", "none", "M" ],
544
545
546
	arity     => "variable",
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Tobias Rapp's avatar
Tobias Rapp committed
547
	emit      => "subs%MX %AM",
548
549
},

Tobias Rapp's avatar
Tobias Rapp committed
550
551
552
553
554
555
556
557
558
559
560
561
xUcomis => {
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
	reg_req   => { out => [ "none", "flags", "none" ] },
	arity     => "variable",
	outs      => [ "dummy", "flags", "M" ],
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
	emit      => "ucomis%MX %AM",
	modified_flags => $status_flags,
},

562
xXorp0 => {
563
564
565
566
567
	op_flags  => [ "constlike" ],
	irn_flags => [ "rematerializable" ],
	reg_req   => { out => [ "xmm" ] },
	outs      => [ "res" ],
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_REG_REG;",
568
	emit      => "xorpd %^D0, %^D0",
569
570
571
	mode      => $mode_xmm,
},

572
573
574
575
576
577
578
579
580
581
582
xXorp  => {
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
	reg_req   => { out => [ "xmm", "none", "none" ] },
	arity     => "variable",
	outs      => [ "res", "none", "M" ],
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
	emit      => "xorp%MX %AM",
},

583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
# Conversion operations

CvtSS2SD => {
	state     => "exc_pinned",
	reg_req   => { out => [ "xmm", "none", "none" ] },
	outs      => [ "res", "none", "M" ],
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit      => "cvtss2sd %AM, %^D0",
},

CvtSD2SS => {
	state     => "exc_pinned",
	reg_req   => { out => [ "xmm", "none", "none" ] },
	outs      => [ "res", "none", "M" ],
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit      => "cvtsd2ss %AM, %^D0",
},

CvtSD2SI => {
	state     => "exc_pinned",
	reg_req   => { out => [ "gp", "none", "none" ] },
	outs      => [ "res", "none", "M" ],
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
612
	emit      => "cvttsd2si %AM, %D0",
613
614
615
616
617
618
619
620
621
},

CvtSS2SI => {
	state     => "exc_pinned",
	reg_req   => { out => [ "gp", "none", "none" ] },
	outs      => [ "res", "none", "M" ],
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
622
	emit      => "cvttss2si %AM, %D0",
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
},

CvtSI2SS => {
	state     => "exc_pinned",
	reg_req   => { out => [ "xmm", "none", "none" ] },
	outs      => [ "res", "none", "M" ],
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit      => "cvtsi2ss %AM, %^D0",
},

CvtSI2SD => {
	state     => "exc_pinned",
	reg_req   => { out => [ "xmm", "none", "none" ] },
	outs      => [ "res", "none", "M" ],
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit      => "cvtsi2sd %AM, %^D0",
},

645
);