amd64_spec.pl 16.5 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, op_mode);\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, op_mode);\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, op_mode);\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
	in_reqs   => [ "rsp", "gp" ],
213
	out_reqs  => [ "rsp:I" ],
214
	ins       => [ "stack", "val" ],
215
216
	outs      => [ "stack" ],
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_NONE;\n",
217
	emit      => "pushq %^S1",
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
	in_reqs   => [ "rbp" ],
248
	out_reqs  => [ "rbp:I", "rsp:I" ],
249
250
251
252
253
	outs      => [ "frame", "stack" ],
	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
351
	fixed     => "amd64_op_mode_t op_mode = AMD64_OP_IMM64;",
	emit      => 'mov%MM $%C, %D0',
352
	mode      => $mode_gp,
353
},
354

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

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

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

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

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

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

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

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

440
jmp_switch => {
Matthias Braun's avatar
Matthias Braun committed
441
442
	op_flags  => [ "cfopcode", "forking" ],
	state     => "pinned",
443
	in_reqs   => [ "gp" ],
444
	out_reqs  => "...",
Matthias Braun's avatar
Matthias Braun committed
445
446
447
	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",
448
449
},

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

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

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

482
483
# SSE

484
adds => {
485
486
	template => $binopx_commutative,
	emit     => "adds%MX %AM",
487
488
},

489
divs => {
490
491
	template => $binopx,
	emit     => "divs%MX %AM",
492
493
},

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

500
muls => {
501
502
	template => $binopx_commutative,
	emit     => "muls%MX %AM",
Tobias Rapp's avatar
Tobias Rapp committed
503
504
},

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

517
subs => {
518
519
	template => $binopx,
	emit     => "subs%MX %AM",
520
521
},

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

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

543
xorp  => {
544
545
	template => $binopx_commutative,
	emit     => "xorp%MX %AM",
546
547
},

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

570
571
# Conversion operations

572
cvtss2sd => {
573
574
	template => $cvtop2x,
	emit     => "cvtss2sd %AM, %^D0",
575
576
},

577
cvtsd2ss => {
578
579
580
581
	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",
582
583
},

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

589
cvttss2si => {
590
591
	template => $cvtopx2i,
	emit     => "cvttss2si %AM, %D0",
592
593
},

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

599
cvtsi2sd => {
600
601
	template => $cvtop2x,
	emit     => "cvtsi2sd %AM, %^D0",
602
603
},

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

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

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

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

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

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

haddpd => {
669
670
	template => $binopx,
	emit     => "haddpd %AM",
671
672
},

673
);