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

3
4
$mode_gp      = "mode_Lu";
$mode_flags   = "mode_Iu";
5
$mode_xmm     = "amd64_mode_xmm";
6
7
8
$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
61
62
%custom_irn_flags = (
	commutative => "(arch_irn_flags_t)amd64_arch_irn_flag_commutative_binop",
);

63
64
$default_copy_attr = "amd64_copy_attr";

65
%init_attr = (
Matthias Braun's avatar
Matthias Braun committed
66
67
68
69
70
71
	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;",
72
73
74
	amd64_asm_attr_t =>
		"init_amd64_attributes(res, irn_flags_, in_reqs, n_res, op_mode);\n"
		."\tattr->asmattr = *asmattr;\n",
Matthias Braun's avatar
Matthias Braun committed
75
	amd64_binop_addr_attr_t =>
76
		"be_info_init_irn(res, irn_flags_, in_reqs, n_res);\n"
Matthias Braun's avatar
Matthias Braun committed
77
		."\t*attr = *attr_init;",
78
	amd64_switch_jmp_attr_t =>
Matthias Braun's avatar
Matthias Braun committed
79
80
		"init_amd64_attributes(res, irn_flags_, in_reqs, n_res, op_mode);\n"
		."\tinit_amd64_switch_attributes(res, table, table_entity);",
81
	amd64_cc_attr_t =>
Matthias Braun's avatar
Matthias Braun committed
82
83
		"init_amd64_attributes(res, irn_flags_, in_reqs, n_res, op_mode);\n"
		."\tinit_amd64_cc_attributes(res, cc);",
84
	amd64_movimm_attr_t =>
Matthias Braun's avatar
Matthias Braun committed
85
86
87
		"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 =>
88
		"be_info_init_irn(res, irn_flags_, in_reqs, n_res);\n"
Matthias Braun's avatar
Matthias Braun committed
89
		."\t*attr = *attr_init;\n",
90
91
);

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
my $binop = {
	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",
	modified_flags => $status_flags,
};

my $binop_commutative = {
	irn_flags      => [ "rematerializable", "commutative" ],
	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",
	modified_flags => $status_flags,
};

my $divop = {
	state          => "pinned",
	reg_req        => { out => [ "rax", "flags", "none", "rdx" ] },
	outs           => [ "res_div", "flags", "M", "res_mod" ],
	arity          => "variable",
	attr_type      => "amd64_addr_attr_t",
	fixed          => "amd64_addr_t addr = { { NULL, 0 }, NO_INPUT, NO_INPUT, NO_INPUT, 0, AMD64_SEGMENT_DEFAULT };\n"
	                 ."amd64_op_mode_t op_mode = AMD64_OP_RAX_REG;\n",
	attr           => "amd64_insn_mode_t insn_mode",
	modified_flags => $status_flags,
};

my $mulop = {
	# Do not rematerialize this node
	# TODO: should mark this commutative as soon as the backend code
	#       can handle this special case
	# 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",
	modified_flags => $status_flags,
};

my $shiftop = {
	irn_flags => [ "rematerializable" ],
	reg_req   => { out => [ "gp", "flags" ] },
	outs      => [ "res", "flags" ],
	arity     => "variable",
	attr_type => "amd64_shift_attr_t",
	attr      => "const amd64_shift_attr_t *attr_init",
	modified_flags => $status_flags
};

my $unop = {
	irn_flags      => [ "rematerializable" ],
	reg_req        => { in => [ "gp" ], out => [ "in_r1", "flags" ] },
	ins            => [ "val" ],
	outs           => [ "res", "flags" ],
	attr_type      => "amd64_addr_attr_t",
	attr           => "amd64_insn_mode_t insn_mode",
	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 };",
	modified_flags => $status_flags
};

my $binopx = {
	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",
};

my $binopx_commutative = {
	irn_flags => [ "rematerializable", "commutative" ],
	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",
};

my $cvtop2x = {
	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",
};

my $cvtopx2i = {
	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",
};

my $movopx = {
	state     => "exc_pinned",
	arity     => "variable",
	outs      => [ "res", "none", "M" ],
	reg_req   => { out => [ "xmm", "none", "none" ] },
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_op_mode_t op_mode, amd64_addr_t addr",
};

208
%nodes = (
209
push_am => {
210
	op_flags  => [ "uses_memory" ],
211
	state     => "exc_pinned",
212
213
	reg_req   => { out => [ "rsp:I|S", "none" ] },
	arity     => "variable",
214
	outs      => [ "stack", "M" ],
Matthias Braun's avatar
Matthias Braun committed
215
216
217
	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
218
	emit      => "push%M %A",
219
220
},

221
push_rbp => {
222
223
224
225
226
227
228
229
230
	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",
},

231
pop_am => {
232
233
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
234
235
	reg_req   => { out => [ "rsp:I|S", "none" ] },
	arity     => "variable",
236
	outs      => [ "stack", "M" ],
Matthias Braun's avatar
Matthias Braun committed
237
238
239
	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
240
	emit      => "pop%M %A",
241
},
242

243
sub_sp => {
Tobias Rapp's avatar
Tobias Rapp committed
244
245
246
247
248
249
250
251
252
253
254
	state     => "pinned",
	reg_req   => { out => [ "rsp:I|S", "gp", "none" ] },
	outs      => [ "stack", "addr", "M" ],
	arity     => "variable",
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
	emit      => "subq %AM\n".
	             "movq %%rsp, %D1",
	modified_flags => $status_flags,
},

255
leave => {
256
257
258
259
260
261
262
263
	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",
},

264
add => {
265
266
	template => $binop_commutative,
	emit     => "add%M %AM",
267
},
268

269
and => {
270
271
	template => $binop_commutative,
	emit     => "and%M %AM",
272
},
Matthias Braun's avatar
Matthias Braun committed
273

274
275
276
277
278
279
asm => {
	arity     => "variable",
	out_arity => "variable",
	attr_type => "amd64_asm_attr_t",
	attr      => "const x86_asm_attr_t *asmattr",
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
280
281
},

282
div => {
283
284
	template => $divop,
	emit     => "div%M %AM",
Matthias Braun's avatar
Matthias Braun committed
285
286
},

287
idiv => {
288
289
	template => $divop,
	emit     => "idiv%M %AM",
Matthias Braun's avatar
Matthias Braun committed
290
291
},

292
imul => {
293
294
	template => $binop_commutative,
	emit     => "imul%M %AM",
295
},
296

297
imul_1op => {
298
299
	template => $mulop,
	emit     => "imul%M %AM",
300
301
},

302
mul => {
303
304
	template => $mulop,
	emit     => "mul%M %AM",
305
306
},

307
or => {
308
309
	template => $binop_commutative,
	emit     => "or%M %AM",
310
311
},

312
shl => {
313
314
	template => $shiftop,
	emit     => "shl%MS %SO",
315
316
},

317
shr => {
318
319
	template => $shiftop,
	emit     => "shr%MS %SO",
320
321
},

322
sar => {
323
324
	template => $shiftop,
	emit     => "sar%MS %SO",
325
326
},

327
sub => {
328
	template  => $binop,
Matthias Braun's avatar
Matthias Braun committed
329
	irn_flags => [ "rematerializable" ],
330
	emit      => "sub%M %AM",
331
},
332

333
sbb => {
334
335
	template => $binop,
	emit     => "sbb%M %AM",
336
337
},

338
neg => {
339
340
	template => $unop,
	emit     => "neg%M %AM",
341
},
342

343
not => {
344
345
	template => $unop,
	emit     => "not%M %AM",
Christoph Mallon's avatar
Christoph Mallon committed
346
347
},

348
xor => {
349
350
	template => $binop_commutative,
	emit     => "xor%M %AM",
351
352
},

353
xor_0 => {
Matthias Braun's avatar
Matthias Braun committed
354
355
	op_flags  => [ "constlike" ],
	irn_flags => [ "rematerializable" ],
356
357
	reg_req   => { out => [ "gp", "flags" ] },
	outs      => [ "res", "flags" ],
Matthias Braun's avatar
Matthias Braun committed
358
359
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_REG_REG;",
	emit      => "xorl %3D0, %3D0",
360
	modified_flags => $status_flags,
Matthias Braun's avatar
Matthias Braun committed
361
362
},

363
mov_imm => {
364
	op_flags  => [ "constlike" ],
365
	irn_flags => [ "rematerializable" ],
366
	reg_req   => { out => [ "gp" ] },
Matthias Braun's avatar
Matthias Braun committed
367
368
369
370
	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',
371
	mode      => $mode_gp,
372
},
373

374
movs => {
375
	state     => "exc_pinned",
Matthias Braun's avatar
Matthias Braun committed
376
377
378
	reg_req   => { out => [ "gp", "none", "none" ] },
	outs      => [ "res", "unused", "M" ],
	arity     => "variable",
Matthias Braun's avatar
Matthias Braun committed
379
380
	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
381
382
383
	emit      => "movs%Mq %AM, %^D0",
},

384
mov_gp => {
Matthias Braun's avatar
Matthias Braun committed
385
386
387
388
	state     => "exc_pinned",
	reg_req   => { out => [ "gp", "none", "none" ] },
	outs      => [ "res", "unused", "M" ],
	arity     => "variable",
Matthias Braun's avatar
Matthias Braun committed
389
390
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
391
},
392

393
ijmp => {
394
395
	state     => "pinned",
	op_flags  => [ "cfopcode", "unknown_jump" ],
396
397
	reg_req   => { in => [ "gp" ], out => [ "none", "none", "none" ] },
	outs      => [ "X", "unused", "M" ],
398
399
	arity     => "variable",
	attr_type => "amd64_addr_attr_t",
400
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
401
	emit      => "jmp %*AM",
402
403
},

404
jmp => {
Matthias Braun's avatar
Matthias Braun committed
405
406
407
408
409
	state    => "pinned",
	op_flags => [ "cfopcode" ],
	reg_req  => { out => [ "none" ] },
	fixed    => "amd64_op_mode_t op_mode = AMD64_OP_IMM32;",
	mode     => "mode_X",
410
},
411

412
cmp => {
413
	irn_flags => [ "rematerializable" ],
414
	state     => "exc_pinned",
Matthias Braun's avatar
Matthias Braun committed
415
416
417
	reg_req   => { out => [ "none", "flags", "none" ] },
	arity     => "variable",
	outs      => [ "dummy", "flags", "M" ],
Matthias Braun's avatar
Matthias Braun committed
418
419
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
420
	emit      => "cmp%M %AM",
421
	modified_flags => $status_flags,
422
},
423

424
lea => {
Matthias Braun's avatar
Matthias Braun committed
425
426
	irn_flags => [ "rematerializable" ],
	arity     => "variable",
427
428
	outs      => [ "res" ],
	reg_req   => { out => [ "gp" ] },
Matthias Braun's avatar
Matthias Braun committed
429
430
431
	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
432
	emit      => "lea%M %A, %D0",
433
	mode      => $mode_gp,
Matthias Braun's avatar
Matthias Braun committed
434
435
},

436
jcc => {
437
	state     => "pinned",
438
	op_flags  => [ "cfopcode", "forking" ],
439
440
441
	reg_req   => { in  => [ "eflags" ], out => [ "none", "none" ] },
	ins       => [ "eflags" ],
	outs      => [ "false", "true" ],
442
	attr_type => "amd64_cc_attr_t",
Matthias Braun's avatar
Matthias Braun committed
443
444
	attr      => "x86_condition_code_t cc",
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
445
},
446

447
mov_store => {
448
	op_flags  => [ "uses_memory" ],
449
	state     => "exc_pinned",
Matthias Braun's avatar
Matthias Braun committed
450
451
	reg_req   => { out => [ "none" ] },
	arity     => "variable",
452
	outs      => [ "M" ],
Matthias Braun's avatar
Matthias Braun committed
453
454
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
455
456
	mode      => "mode_M",
	emit      => "mov%M %S0, %A",
457
},
458

459
jmp_switch => {
Matthias Braun's avatar
Matthias Braun committed
460
461
	op_flags  => [ "cfopcode", "forking" ],
	state     => "pinned",
462
	reg_req   => { in => [ "gp" ] },
Matthias Braun's avatar
Matthias Braun committed
463
464
465
466
	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",
467
468
},

469
call => {
470
471
472
	state     => "exc_pinned",
	arity     => "variable",
	out_arity => "variable",
Matthias Braun's avatar
Matthias Braun committed
473
474
475
	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",
476
	emit      => "call %*AM",
477
	modified_flags => $all_flags,
478
479
},

480
start => {
481
	irn_flags => [ "schedule_first" ],
482
483
484
	state     => "pinned",
	out_arity => "variable",
	ins       => [],
Matthias Braun's avatar
Matthias Braun committed
485
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
486
	emit      => "",
487
488
},

489
ret => {
Matthias Braun's avatar
Matthias Braun committed
490
	state    => "pinned",
491
492
493
	op_flags => [ "cfopcode" ],
	arity    => "variable",
	reg_req  => { out => [ "none" ] },
Matthias Braun's avatar
Matthias Braun committed
494
	fixed    => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
495
	mode     => "mode_X",
496
	emit     => "ret",
497
498
},

499
500
# SSE

501
adds => {
502
503
	template => $binopx_commutative,
	emit     => "adds%MX %AM",
504
505
},

506
divs => {
507
508
	template => $binopx,
	emit     => "divs%MX %AM",
509
510
},

511
movs_xmm => {
512
513
514
	template => $movopx,
	attr     => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit     => "movs%MX %AM, %D0",
515
516
},

517
muls => {
518
519
	template => $binopx_commutative,
	emit     => "muls%MX %AM",
Tobias Rapp's avatar
Tobias Rapp committed
520
521
},

522
movs_store_xmm => {
523
524
525
526
527
528
529
530
	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",
531
	emit      => "movs%MX %^S0, %A",
532
533
},

534
subs => {
535
536
	template => $binopx,
	emit     => "subs%MX %AM",
537
538
},

539
ucomis => {
Tobias Rapp's avatar
Tobias Rapp committed
540
541
542
543
544
545
546
547
548
549
550
	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,
},

551
xorpd_0 => {
552
553
554
555
556
	op_flags  => [ "constlike" ],
	irn_flags => [ "rematerializable" ],
	reg_req   => { out => [ "xmm" ] },
	outs      => [ "res" ],
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_REG_REG;",
557
	emit      => "xorpd %^D0, %^D0",
558
559
560
	mode      => $mode_xmm,
},

561
xorp  => {
562
563
	template => $binopx_commutative,
	emit     => "xorp%MX %AM",
564
565
},

566
567
# Conversion operations

568
cvtss2sd => {
569
570
	template => $cvtop2x,
	emit     => "cvtss2sd %AM, %^D0",
571
572
},

573
cvtsd2ss => {
574
575
576
577
	template => $cvtop2x,
	attr     => "amd64_op_mode_t op_mode, amd64_addr_t addr",
	fixed    => "amd64_insn_mode_t insn_mode = INSN_MODE_64;\n",
	emit     => "cvtsd2ss %AM, %^D0",
578
579
},

580
cvttsd2si => {
581
582
	template => $cvtopx2i,
	emit     => "cvttsd2si %AM, %D0",
583
584
},

585
cvttss2si => {
586
587
	template => $cvtopx2i,
	emit     => "cvttss2si %AM, %D0",
588
589
},

590
cvtsi2ss => {
591
592
	template => $cvtop2x,
	emit     => "cvtsi2ss %AM, %^D0",
593
594
},

595
cvtsi2sd => {
596
597
	template => $cvtop2x,
	emit     => "cvtsi2sd %AM, %^D0",
598
599
},

600
movq => {
601
602
603
	template => $movopx,
	fixed    => "amd64_insn_mode_t insn_mode = INSN_MODE_64;\n",
	emit     => "movq %AM, %D0",
604
605
},

606
movdqa => {
607
608
609
	template => $movopx,
	fixed    => "amd64_insn_mode_t insn_mode = INSN_MODE_128;\n",
	emit     => "movdqa %AM, %D0",
610
611
},

612
movdqu => {
613
614
615
	template => $movopx,
	fixed    => "amd64_insn_mode_t insn_mode = INSN_MODE_128;\n",
	emit     => "movdqu %AM, %D0",
616
617
618
619
620
621
622
623
624
625
626
627
628
629
},

movdqu_store => {
	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",
	emit      => "movdqu %^S0, %A",
},

630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
l_punpckldq => {
	ins       => [ "arg0", "arg1" ],
	outs      => [ "res" ],
	attr_type => "",
	dump_func => "NULL",
	mode      => $mode_xmm,
},

l_subpd => {
	ins       => [ "arg0", "arg1" ],
	outs      => [ "res" ],
	attr_type => "",
	dump_func => "NULL",
	mode      => $mode_xmm,
},

l_haddpd => {
	ins       => [ "arg0", "arg1" ],
	outs      => [ "res" ],
	attr_type => "",
	dump_func => "NULL",
	mode      => $mode_xmm,
},

punpckldq => {
655
656
	template => $binopx,
	emit     => "punpckldq %AM",
657
658
659
},

subpd => {
660
661
	template => $binopx,
	emit     => "subpd %AM",
662
663
664
},

haddpd => {
665
666
	template => $binopx,
	emit     => "haddpd %AM",
667
668
},

669
);