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

3
4
5
$mode_gp    = "mode_Lu";
$mode_flags = "mode_Iu";
$mode_xmm   = "amd64_mode_xmm";
6

7
8
%reg_classes = (
	gp => [
9
10
11
12
13
14
15
		{ 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 },
16
		{ name => "rsp", dwarf => 7 },
17
18
19
20
21
22
23
24
		{ 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 },
25
		{ mode => $mode_gp }
26
	],
27
	flags => [
28
		{ name => "eflags", dwarf => 49 },
29
		{ mode => $mode_flags, flags => "manual_ra" }
30
	],
31
	xmm => [
Matthias Braun's avatar
Matthias Braun committed
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
		{ 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 },
48
49
		{ mode => $mode_xmm }
	]
50
51
);

52
53
54
55
%custom_irn_flags = (
	commutative => "(arch_irn_flags_t)amd64_arch_irn_flag_commutative_binop",
);

56
57
$default_copy_attr = "amd64_copy_attr";

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

82
my $binop = {
83
84
85
	irn_flags => [ "modify_flags" ],
	state     => "exc_pinned",
	in_reqs   => "...",
86
	out_reqs  => [ "gp", "flags", "mem" ],
87
88
89
	outs      => [ "res", "flags", "M" ],
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
90
91
92
};

my $binop_commutative = {
93
94
95
	irn_flags => [ "modify_flags", "rematerializable", "commutative" ],
	state     => "exc_pinned",
	in_reqs   => "...",
96
	out_reqs  => [ "gp", "flags", "mem" ],
97
98
99
	outs      => [ "res", "flags", "M" ],
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
100
101
102
};

my $divop = {
103
104
105
	irn_flags => [ "modify_flags" ],
	state     => "pinned",
	in_reqs   => "...",
106
	out_reqs  => [ "rax", "flags", "mem", "rdx" ],
107
108
109
110
111
	outs      => [ "res_div", "flags", "M", "res_mod" ],
	attr_type => "amd64_addr_attr_t",
	fixed     => "amd64_addr_t addr = { { NULL, 0, X86_IMM_VALUE }, 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",
112
113
114
115
116
117
118
};

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
119
120
121
	irn_flags => [ "modify_flags" ],
	state     => "exc_pinned",
	in_reqs   => "...",
122
	out_reqs  => [ "rax", "flags", "mem", "rdx" ],
123
124
125
	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",
126
127
128
};

my $shiftop = {
129
130
131
132
133
134
	irn_flags => [ "modify_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",
135
136
137
};

my $unop = {
138
139
140
141
142
143
144
145
146
	irn_flags => [ "modify_flags", "rematerializable" ],
	in_reqs   => [ "gp" ],
	out_reqs  => [ "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, X86_IMM_VALUE }, NO_INPUT, NO_INPUT, NO_INPUT, 0, AMD64_SEGMENT_DEFAULT };",
147
148
149
150
151
};

my $binopx = {
	irn_flags => [ "rematerializable" ],
	state     => "exc_pinned",
152
	in_reqs   => "...",
153
	out_reqs  => [ "xmm", "none", "mem" ],
154
155
156
157
158
159
160
161
	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",
162
	in_reqs   => "...",
163
	out_reqs  => [ "xmm", "none", "mem" ],
164
165
166
167
168
169
170
	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",
171
	in_reqs   => "...",
172
	out_reqs  => [ "xmm", "none", "mem" ],
173
174
175
176
177
178
179
	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",
180
	in_reqs   => "...",
181
	out_reqs  => [ "gp", "none", "mem" ],
182
183
184
185
186
187
188
	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",
189
	in_reqs   => "...",
190
	outs      => [ "res", "none", "M" ],
191
	out_reqs  => [ "xmm", "none", "mem" ],
192
193
194
195
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_op_mode_t op_mode, amd64_addr_t addr",
};

196
%nodes = (
197
push_am => {
198
	op_flags  => [ "uses_memory" ],
199
	state     => "exc_pinned",
200
	in_reqs   => "...",
201
	out_reqs  => [ "rsp:I", "mem" ],
202
	outs      => [ "stack", "M" ],
Matthias Braun's avatar
Matthias Braun committed
203
204
205
	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
206
	emit      => "push%M %A",
207
208
},

209
push_reg => {
210
211
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
212
213
214
215
	in_reqs   => [ "rsp",   "mem", "gp"  ],
	ins       => [ "stack", "mem", "val" ],
	out_reqs  => [ "rsp:I", "mem" ],
	outs      => [ "stack", "M"   ],
216
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
217
	emit      => "pushq %^S2",
218
219
},

220
pop_am => {
221
222
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
223
	in_reqs   => "...",
224
	out_reqs  => [ "rsp:I", "mem" ],
225
	outs      => [ "stack", "M" ],
Matthias Braun's avatar
Matthias Braun committed
226
227
228
	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
229
	emit      => "pop%M %A",
230
},
231

232
sub_sp => {
233
	irn_flags => [ "modify_flags" ],
Tobias Rapp's avatar
Tobias Rapp committed
234
	state     => "pinned",
235
	in_reqs   => "...",
236
	out_reqs  => [ "rsp:I", "gp", "mem" ],
Tobias Rapp's avatar
Tobias Rapp committed
237
238
239
240
241
242
243
	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",
},

244
leave => {
245
246
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
247
248
249
	in_reqs   => [ "rbp", "mem" ],
	out_reqs  => [ "rbp:I", "mem", "rsp:I" ],
	outs      => [ "frame", "M",   "stack" ],
250
251
252
253
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
	emit      => "leave",
},

254
add => {
255
256
	template => $binop_commutative,
	emit     => "add%M %AM",
257
},
258

259
and => {
260
261
	template => $binop_commutative,
	emit     => "and%M %AM",
262
},
Matthias Braun's avatar
Matthias Braun committed
263

264
div => {
265
266
	template => $divop,
	emit     => "div%M %AM",
Matthias Braun's avatar
Matthias Braun committed
267
268
},

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

274
imul => {
275
276
	template => $binop_commutative,
	emit     => "imul%M %AM",
277
},
278

279
imul_1op => {
280
281
	template => $mulop,
	emit     => "imul%M %AM",
282
283
},

284
mul => {
285
286
	template => $mulop,
	emit     => "mul%M %AM",
287
288
},

289
or => {
290
291
	template => $binop_commutative,
	emit     => "or%M %AM",
292
293
},

294
shl => {
295
296
	template => $shiftop,
	emit     => "shl%MS %SO",
297
298
},

299
shr => {
300
301
	template => $shiftop,
	emit     => "shr%MS %SO",
302
303
},

304
sar => {
305
306
	template => $shiftop,
	emit     => "sar%MS %SO",
307
308
},

309
sub => {
310
	template  => $binop,
Matthias Braun's avatar
Matthias Braun committed
311
	irn_flags => [ "rematerializable" ],
312
	emit      => "sub%M %AM",
313
},
314

315
sbb => {
316
317
	template => $binop,
	emit     => "sbb%M %AM",
318
319
},

320
neg => {
321
322
	template => $unop,
	emit     => "neg%M %AM",
323
},
324

325
not => {
326
327
	template => $unop,
	emit     => "not%M %AM",
Christoph Mallon's avatar
Christoph Mallon committed
328
329
},

330
xor => {
331
332
	template => $binop_commutative,
	emit     => "xor%M %AM",
333
334
},

335
xor_0 => {
Matthias Braun's avatar
Matthias Braun committed
336
	op_flags  => [ "constlike" ],
337
	irn_flags => [ "modify_flags", "rematerializable" ],
338
	out_reqs  => [ "gp", "flags" ],
339
	outs      => [ "res", "flags" ],
Matthias Braun's avatar
Matthias Braun committed
340
341
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_REG_REG;",
	emit      => "xorl %3D0, %3D0",
Matthias Braun's avatar
Matthias Braun committed
342
343
},

344
mov_imm => {
345
	op_flags  => [ "constlike" ],
346
	irn_flags => [ "rematerializable" ],
347
	out_reqs  => [ "gp" ],
Matthias Braun's avatar
Matthias Braun committed
348
	attr_type => "amd64_movimm_attr_t",
Matthias Braun's avatar
Matthias Braun committed
349
	attr      => "amd64_insn_mode_t insn_mode, const amd64_imm64_t *imm",
Matthias Braun's avatar
Matthias Braun committed
350
	emit      => 'mov%MM $%C, %D0',
351
	mode      => $mode_gp,
352
},
353

354
movs => {
355
	state     => "exc_pinned",
356
	in_reqs   => "...",
357
	out_reqs  => [ "gp", "none", "mem" ],
Matthias Braun's avatar
Matthias Braun committed
358
	outs      => [ "res", "unused", "M" ],
Matthias Braun's avatar
Matthias Braun committed
359
360
	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
361
362
363
	emit      => "movs%Mq %AM, %^D0",
},

364
mov_gp => {
Matthias Braun's avatar
Matthias Braun committed
365
	state     => "exc_pinned",
366
	in_reqs   => "...",
367
	out_reqs  => [ "gp", "none", "mem" ],
Matthias Braun's avatar
Matthias Braun committed
368
	outs      => [ "res", "unused", "M" ],
Matthias Braun's avatar
Matthias Braun committed
369
370
	attr_type => "amd64_addr_attr_t",
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
371
},
372

373
ijmp => {
374
375
	state     => "pinned",
	op_flags  => [ "cfopcode", "unknown_jump" ],
376
	in_reqs   => "...",
377
	out_reqs  => [ "exec", "none", "mem" ],
378
	outs      => [ "X", "unused", "M" ],
379
	attr_type => "amd64_addr_attr_t",
380
	attr      => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
381
	emit      => "jmp %*AM",
382
383
},

384
jmp => {
Matthias Braun's avatar
Matthias Braun committed
385
386
	state    => "pinned",
	op_flags => [ "cfopcode" ],
387
	out_reqs => [ "exec" ],
Matthias Braun's avatar
Matthias Braun committed
388
389
	fixed    => "amd64_op_mode_t op_mode = AMD64_OP_IMM32;",
	mode     => "mode_X",
390
},
391

392
cmp => {
393
	irn_flags => [ "modify_flags", "rematerializable" ],
394
	state     => "exc_pinned",
395
	in_reqs   => "...",
396
	out_reqs  => [ "none", "flags", "mem" ],
Matthias Braun's avatar
Matthias Braun committed
397
	outs      => [ "dummy", "flags", "M" ],
Matthias Braun's avatar
Matthias Braun committed
398
399
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
400
	emit      => "cmp%M %AM",
401
},
402

403
lea => {
Matthias Braun's avatar
Matthias Braun committed
404
	irn_flags => [ "rematerializable" ],
405
	in_reqs   => "...",
406
	outs      => [ "res" ],
407
	out_reqs  => [ "gp" ],
Matthias Braun's avatar
Matthias Braun committed
408
409
410
	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
411
	emit      => "lea%M %A, %D0",
412
	mode      => $mode_gp,
Matthias Braun's avatar
Matthias Braun committed
413
414
},

415
jcc => {
416
	state     => "pinned",
417
	op_flags  => [ "cfopcode", "forking" ],
418
	in_reqs   => [ "eflags" ],
419
	out_reqs  => [ "exec", "exec" ],
420
421
	ins       => [ "eflags" ],
	outs      => [ "false", "true" ],
422
	attr_type => "amd64_cc_attr_t",
Matthias Braun's avatar
Matthias Braun committed
423
	attr      => "x86_condition_code_t cc",
424
},
425

426
mov_store => {
427
	op_flags  => [ "uses_memory" ],
428
	state     => "exc_pinned",
429
	in_reqs   => "...",
430
	out_reqs  => [ "mem" ],
431
	outs      => [ "M" ],
Matthias Braun's avatar
Matthias Braun committed
432
433
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
Matthias Braun's avatar
Matthias Braun committed
434
435
	mode      => "mode_M",
	emit      => "mov%M %S0, %A",
436
},
437

438
jmp_switch => {
Matthias Braun's avatar
Matthias Braun committed
439
440
	op_flags  => [ "cfopcode", "forking" ],
	state     => "pinned",
441
	in_reqs   => [ "gp" ],
442
	out_reqs  => "...",
Matthias Braun's avatar
Matthias Braun committed
443
444
	attr_type => "amd64_switch_jmp_attr_t",
	attr      => "const ir_switch_table *table, ir_entity *table_entity",
445
446
},

447
call => {
448
	irn_flags => [ "modify_flags" ],
449
	state     => "exc_pinned",
450
	in_reqs   => "...",
451
	out_reqs  => "...",
452
	outs      => [ "M", "stack", "flags", "first_result" ],
Matthias Braun's avatar
Matthias Braun committed
453
454
455
	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",
456
	emit      => "call %*AM",
457
458
},

459
start => {
460
	irn_flags => [ "schedule_first" ],
461
	state     => "pinned",
462
	out_reqs  => "...",
463
	ins       => [],
Matthias Braun's avatar
Matthias Braun committed
464
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
465
	emit      => "",
466
467
},

468
ret => {
Matthias Braun's avatar
Matthias Braun committed
469
	state    => "pinned",
470
	op_flags => [ "cfopcode" ],
471
	in_reqs  => "...",
472
	out_reqs => [ "exec" ],
473
	ins      => [ "mem", "stack", "first_result" ],
Matthias Braun's avatar
Matthias Braun committed
474
	fixed    => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
475
	mode     => "mode_X",
476
	emit     => "ret",
477
478
},

479
480
# SSE

481
adds => {
482
483
	template => $binopx_commutative,
	emit     => "adds%MX %AM",
484
485
},

486
divs => {
487
488
	template => $binopx,
	emit     => "divs%MX %AM",
489
490
},

491
movs_xmm => {
492
493
494
	template => $movopx,
	attr     => "amd64_insn_mode_t insn_mode, amd64_op_mode_t op_mode, amd64_addr_t addr",
	emit     => "movs%MX %AM, %D0",
495
496
},

497
muls => {
498
499
	template => $binopx_commutative,
	emit     => "muls%MX %AM",
Tobias Rapp's avatar
Tobias Rapp committed
500
501
},

502
movs_store_xmm => {
503
504
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
505
	in_reqs   => "...",
506
	out_reqs  => [ "mem" ],
507
508
509
510
	outs      => [ "M" ],
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
	mode      => "mode_M",
511
	emit      => "movs%MX %^S0, %A",
512
513
},

514
subs => {
515
516
	template => $binopx,
	emit     => "subs%MX %AM",
517
518
},

519
ucomis => {
520
	irn_flags => [ "modify_flags", "rematerializable" ],
Tobias Rapp's avatar
Tobias Rapp committed
521
	state     => "exc_pinned",
522
	in_reqs   => "...",
523
	out_reqs  => [ "none", "flags", "mem" ],
Tobias Rapp's avatar
Tobias Rapp committed
524
525
526
527
528
529
	outs      => [ "dummy", "flags", "M" ],
	attr_type => "amd64_binop_addr_attr_t",
	attr      => "const amd64_binop_addr_attr_t *attr_init",
	emit      => "ucomis%MX %AM",
},

530
xorpd_0 => {
531
532
	op_flags  => [ "constlike" ],
	irn_flags => [ "rematerializable" ],
533
	out_reqs  => [ "xmm" ],
534
535
	outs      => [ "res" ],
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_REG_REG;",
536
	emit      => "xorpd %^D0, %^D0",
537
538
539
	mode      => $mode_xmm,
},

540
xorp  => {
541
542
	template => $binopx_commutative,
	emit     => "xorp%MX %AM",
543
544
},

545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
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"
},

567
568
# Conversion operations

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

574
cvtsd2ss => {
575
576
577
578
	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",
579
580
},

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

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

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

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

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

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

613
movdqu => {
614
615
616
	template => $movopx,
	fixed    => "amd64_insn_mode_t insn_mode = INSN_MODE_128;\n",
	emit     => "movdqu %AM, %D0",
617
618
619
620
621
},

movdqu_store => {
	op_flags  => [ "uses_memory" ],
	state     => "exc_pinned",
622
	in_reqs   => "...",
623
	out_reqs  => [ "mem" ],
624
625
626
627
628
629
630
	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",
},

631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
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 => {
656
657
	template => $binopx,
	emit     => "punpckldq %AM",
658
659
660
},

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

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

670
);