amd64_spec.pl 17.2 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
	xmm => [
Matthias Braun's avatar
Matthias Braun committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
		{ 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 },
		{ name => "xmm8",  dwarf => 25 },
		{ name => "xmm9",  dwarf => 26 },
		{ name => "xmm10", dwarf => 27 },
		{ name => "xmm11", dwarf => 28 },
		{ name => "xmm12", dwarf => 29 },
		{ name => "xmm13", dwarf => 30 },
		{ name => "xmm14", dwarf => 31 },
		{ name => "xmm15", dwarf => 32 },
50
51
		{ mode => $mode_xmm }
	]
52
53
);

54
55
56
57
58
59
60
sub amd64_custom_init_attr {
	my $constr = shift;
	my $node   = shift;
	my $name   = shift;
	my $res    = "";

	if(defined($node->{modified_flags})) {
61
		$res .= "\tarch_add_irn_flags(res, arch_irn_flag_modify_flags);\n";
62
63
64
65
66
	}
	return $res;
}
$custom_init_attr_func = \&amd64_custom_init_attr;

67
68
69
70
%custom_irn_flags = (
	commutative => "(arch_irn_flags_t)amd64_arch_irn_flag_commutative_binop",
);

71
72
$default_copy_attr = "amd64_copy_attr";

73
%init_attr = (
Matthias Braun's avatar
Matthias Braun committed
74
75
76
77
78
79
80
	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 =>
81
		"be_info_init_irn(res, irn_flags_, in_reqs, n_res);\n"
Matthias Braun's avatar
Matthias Braun committed
82
		."\t*attr = *attr_init;",
83
	amd64_switch_jmp_attr_t =>
Matthias Braun's avatar
Matthias Braun committed
84
85
		"init_amd64_attributes(res, irn_flags_, in_reqs, n_res, op_mode);\n"
		."\tinit_amd64_switch_attributes(res, table, table_entity);",
86
	amd64_cc_attr_t =>
Matthias Braun's avatar
Matthias Braun committed
87
88
		"init_amd64_attributes(res, irn_flags_, in_reqs, n_res, op_mode);\n"
		."\tinit_amd64_cc_attributes(res, cc);",
89
	amd64_movimm_attr_t =>
Matthias Braun's avatar
Matthias Braun committed
90
91
92
		"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 =>
93
		"be_info_init_irn(res, irn_flags_, in_reqs, n_res);\n"
Matthias Braun's avatar
Matthias Braun committed
94
		."\t*attr = *attr_init;\n",
95
96
);

97
98
my $binop = {
	state          => "exc_pinned",
99
	in_reqs        => "...",
100
	out_reqs       => [ "gp", "flags", "none" ],
101
102
103
104
105
106
107
108
109
	outs           => [ "res", "flags", "M" ],
	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",
110
	in_reqs        => "...",
111
	out_reqs       => [ "gp", "flags", "none" ],
112
113
114
115
116
117
118
119
	outs           => [ "res", "flags", "M" ],
	attr_type      => "amd64_binop_addr_attr_t",
	attr           => "const amd64_binop_addr_attr_t *attr_init",
	modified_flags => $status_flags,
};

my $divop = {
	state          => "pinned",
120
	in_reqs        => "...",
121
	out_reqs       => [ "rax", "flags", "none", "rdx" ],
122
123
	outs           => [ "res_div", "flags", "M", "res_mod" ],
	attr_type      => "amd64_addr_attr_t",
124
	fixed          => "amd64_addr_t addr = { { NULL, 0, X86_IMM_VALUE }, NO_INPUT, NO_INPUT, NO_INPUT, 0, AMD64_SEGMENT_DEFAULT };\n"
125
126
127
128
129
130
131
132
133
134
135
	                 ."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",
136
	in_reqs        => "...",
137
	out_reqs       => [ "rax", "flags", "none", "rdx" ],
138
139
140
141
142
143
144
	outs           => [ "res_low", "flags", "M", "res_high" ],
	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 = {
145
146
147
148
149
150
	irn_flags      => [ "rematerializable" ],
	in_reqs        => "...",
	out_reqs       => [ "gp", "flags" ],
	outs           => [ "res", "flags" ],
	attr_type      => "amd64_shift_attr_t",
	attr           => "const amd64_shift_attr_t *attr_init",
151
152
153
154
155
	modified_flags => $status_flags
};

my $unop = {
	irn_flags      => [ "rematerializable" ],
156
157
	in_reqs        => [ "gp" ],
	out_reqs       => [ "in_r1", "flags" ],
158
159
160
161
162
	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"
163
	                 ."amd64_addr_t addr = { { NULL, 0, X86_IMM_VALUE }, NO_INPUT, NO_INPUT, NO_INPUT, 0, AMD64_SEGMENT_DEFAULT };",
164
165
166
167
168
169
	modified_flags => $status_flags
};

my $binopx = {
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
170
	in_reqs   => "...",
171
	out_reqs  => [ "xmm", "none", "none" ],
172
173
174
175
176
177
178
179
	outs      => [ "res", "none", "M" ],
	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",
180
	in_reqs   => "...",
181
	out_reqs  => [ "xmm", "none", "none" ],
182
183
184
185
186
187
188
	outs      => [ "res", "none", "M" ],
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
};

my $cvtop2x = {
	state     => "exc_pinned",
189
	in_reqs   => "...",
190
	out_reqs  => [ "xmm", "none", "none" ],
191
192
193
194
195
196
197
	outs      => [ "res", "none", "M" ],
	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",
198
	in_reqs   => "...",
199
	out_reqs  => [ "gp", "none", "none" ],
200
201
202
203
204
205
206
	outs      => [ "res", "none", "M" ],
	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",
207
	in_reqs   => "...",
208
	outs      => [ "res", "none", "M" ],
209
	out_reqs  => [ "xmm", "none", "none" ],
210
211
212
213
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_op_mode_t op_mode, amd64_addr_t addr",
};

214
%nodes = (
215
push_am => {
216
	op_flags  => [ "uses_memory" ],
217
	state     => "exc_pinned",
218
	in_reqs   => "...",
219
	out_reqs  => [ "rsp:I", "none" ],
220
	outs      => [ "stack", "M" ],
Matthias Braun's avatar
Matthias Braun committed
221
222
223
	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
224
	emit      => "push%M %A",
225
226
},

227
push_reg => {
228
229
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
230
	in_reqs   => [ "rsp", "gp" ],
231
	out_reqs  => [ "rsp:I" ],
232
	ins       => [ "stack", "val" ],
233
234
	outs      => [ "stack" ],
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
235
	emit      => "pushq %^S1",
236
237
},

238
pop_am => {
239
240
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
241
	in_reqs   => "...",
242
	out_reqs  => [ "rsp:I", "none" ],
243
	outs      => [ "stack", "M" ],
Matthias Braun's avatar
Matthias Braun committed
244
245
246
	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
247
	emit      => "pop%M %A",
248
},
249

250
sub_sp => {
Tobias Rapp's avatar
Tobias Rapp committed
251
	state     => "pinned",
252
	in_reqs   => "...",
253
	out_reqs  => [ "rsp:I", "gp", "none" ],
Tobias Rapp's avatar
Tobias Rapp committed
254
255
256
257
258
259
260
261
	outs      => [ "stack", "addr", "M" ],
	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,
},

262
leave => {
263
264
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
265
	in_reqs   => [ "rbp" ],
266
	out_reqs  => [ "rbp:I", "rsp:I" ],
267
268
269
270
271
	outs      => [ "frame", "stack" ],
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
	emit      => "leave",
},

272
add => {
273
274
	template => $binop_commutative,
	emit     => "add%M %AM",
275
},
276

277
and => {
278
279
	template => $binop_commutative,
	emit     => "and%M %AM",
280
},
Matthias Braun's avatar
Matthias Braun committed
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
	out_reqs  => [ "gp", "flags" ],
357
	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
	out_reqs  => [ "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",
376
	in_reqs   => "...",
377
	out_reqs  => [ "gp", "none", "none" ],
Matthias Braun's avatar
Matthias Braun committed
378
	outs      => [ "res", "unused", "M" ],
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
	state     => "exc_pinned",
386
	in_reqs   => "...",
387
	out_reqs  => [ "gp", "none", "none" ],
Matthias Braun's avatar
Matthias Braun committed
388
	outs      => [ "res", "unused", "M" ],
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
	in_reqs   => "...",
397
	out_reqs  => [ "none", "none", "none" ],
398
	outs      => [ "X", "unused", "M" ],
399
	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
	state    => "pinned",
	op_flags => [ "cfopcode" ],
407
	out_reqs => [ "none" ],
Matthias Braun's avatar
Matthias Braun committed
408
409
	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",
415
	in_reqs   => "...",
416
	out_reqs  => [ "none", "flags", "none" ],
Matthias Braun's avatar
Matthias Braun committed
417
	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
	irn_flags => [ "rematerializable" ],
426
	in_reqs   => "...",
427
	outs      => [ "res" ],
428
	out_reqs  => [ "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
	in_reqs   => [ "eflags" ],
	out_reqs  => [ "none", "none" ],
441
442
	ins       => [ "eflags" ],
	outs      => [ "false", "true" ],
443
	attr_type => "amd64_cc_attr_t",
Matthias Braun's avatar
Matthias Braun committed
444
445
	attr      => "x86_condition_code_t cc",
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
446
},
447

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

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

470
call => {
471
	state     => "exc_pinned",
472
	in_reqs   => "...",
473
	out_reqs  => "...",
474
	outs      => [ "M", "stack", "flags", "first_result" ],
Matthias Braun's avatar
Matthias Braun committed
475
476
477
	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",
478
	emit      => "call %*AM",
479
	modified_flags => $all_flags,
480
481
},

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

491
ret => {
Matthias Braun's avatar
Matthias Braun committed
492
	state    => "pinned",
493
	op_flags => [ "cfopcode" ],
494
	in_reqs  => "...",
495
	out_reqs => [ "none" ],
496
	ins      => [ "mem", "stack", "first_result" ],
Matthias Braun's avatar
Matthias Braun committed
497
	fixed    => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
498
	mode     => "mode_X",
499
	emit     => "ret",
500
501
},

502
503
# SSE

504
adds => {
505
506
	template => $binopx_commutative,
	emit     => "adds%MX %AM",
507
508
},

509
divs => {
510
511
	template => $binopx,
	emit     => "divs%MX %AM",
512
513
},

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

520
muls => {
521
522
	template => $binopx_commutative,
	emit     => "muls%MX %AM",
Tobias Rapp's avatar
Tobias Rapp committed
523
524
},

525
movs_store_xmm => {
526
527
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
528
	in_reqs   => "...",
529
	out_reqs  => [ "none" ],
530
531
532
533
	outs      => [ "M" ],
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
	mode      => "mode_M",
534
	emit      => "movs%MX %^S0, %A",
535
536
},

537
subs => {
538
539
	template => $binopx,
	emit     => "subs%MX %AM",
540
541
},

542
ucomis => {
Tobias Rapp's avatar
Tobias Rapp committed
543
544
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
545
	in_reqs   => "...",
546
	out_reqs  => [ "none", "flags", "none" ],
Tobias Rapp's avatar
Tobias Rapp committed
547
548
549
550
551
552
553
	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,
},

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

564
xorp  => {
565
566
	template => $binopx_commutative,
	emit     => "xorp%MX %AM",
567
568
},

569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
movd_xmm_gp => {
	state     => "exc_pinned",
	ins       => [ "operand" ],
	outs      => [ "res" ],
	in_reqs  => [ "xmm" ],
	out_reqs  => [ "gp" ],
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit      => "movd %S0, %D0"
},

movd_gp_xmm => {
	state     => "exc_pinned",
	ins       => [ "operand" ],
	outs      => [ "res" ],
	in_reqs   => [ "gp" ],
	out_reqs  => [ "xmm" ],
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit      => "movd %S0, %D0"
},

591
592
# Conversion operations

593
cvtss2sd => {
594
595
	template => $cvtop2x,
	emit     => "cvtss2sd %AM, %^D0",
596
597
},

598
cvtsd2ss => {
599
600
601
602
	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",
603
604
},

605
cvttsd2si => {
606
607
	template => $cvtopx2i,
	emit     => "cvttsd2si %AM, %D0",
608
609
},

610
cvttss2si => {
611
612
	template => $cvtopx2i,
	emit     => "cvttss2si %AM, %D0",
613
614
},

615
cvtsi2ss => {
616
617
	template => $cvtop2x,
	emit     => "cvtsi2ss %AM, %^D0",
618
619
},

620
cvtsi2sd => {
621
622
	template => $cvtop2x,
	emit     => "cvtsi2sd %AM, %^D0",
623
624
},

625
movq => {
626
627
628
	template => $movopx,
	fixed    => "amd64_insn_mode_t insn_mode = INSN_MODE_64;\n",
	emit     => "movq %AM, %D0",
629
630
},

631
movdqa => {
632
633
634
	template => $movopx,
	fixed    => "amd64_insn_mode_t insn_mode = INSN_MODE_128;\n",
	emit     => "movdqa %AM, %D0",
635
636
},

637
movdqu => {
638
639
640
	template => $movopx,
	fixed    => "amd64_insn_mode_t insn_mode = INSN_MODE_128;\n",
	emit     => "movdqu %AM, %D0",
641
642
643
644
645
},

movdqu_store => {
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
646
	in_reqs   => "...",
647
	out_reqs  => [ "none" ],
648
649
650
651
652
653
654
	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",
},

655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
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 => {
680
681
	template => $binopx,
	emit     => "punpckldq %AM",
682
683
684
},

subpd => {
685
686
	template => $binopx,
	emit     => "subpd %AM",
687
688
689
},

haddpd => {
690
691
	template => $binopx,
	emit     => "haddpd %AM",
692
693
},

694
);