Fixed initialization of option tables
[libfirm] / ir / be / ia32 / ia32_spec.pl
1 # Creation: 2005/10/19
2 # $Id$
3 # This is the specification for the ia32 assembler Firm-operations
4
5 use File::Basename;
6
7 $new_emit_syntax = 1;
8 my $myname = $0;
9
10 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
11 $arch = "ia32";
12
13 # The node description is done as a perl hash initializer with the
14 # following structure:
15 #
16 # %nodes = (
17 #
18 # <op-name> => {
19 #   op_flags  => "N|L|C|X|I|F|Y|H|c|K",
20 #   irn_flags => "R|N|I|S"
21 #   arity     => "0|1|2|3 ... |variable|dynamic|any",
22 #   state     => "floats|pinned|mem_pinned|exc_pinned",
23 #   args      => [
24 #                    { type => "type 1", name => "name 1" },
25 #                    { type => "type 2", name => "name 2" },
26 #                    ...
27 #                  ],
28 #   comment   => "any comment for constructor",
29 #   reg_req   => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
30 #   cmp_attr  => "c source code for comparing node attributes",
31 #   emit      => "emit code with templates",
32 #   attr      => "attitional attribute arguments for constructor"
33 #   init_attr => "emit attribute initialization template"
34 #   rd_constructor => "c source code which constructs an ir_node"
35 #   latency   => "latency of this operation (can be float)"
36 #   attr_type => "name of the attribute struct",
37 # },
38 #
39 # ... # (all nodes you need to describe)
40 #
41 # ); # close the %nodes initializer
42
43 # op_flags: flags for the operation, OPTIONAL (default is "N")
44 # the op_flags correspond to the firm irop_flags:
45 #   N   irop_flag_none
46 #   L   irop_flag_labeled
47 #   C   irop_flag_commutative
48 #   X   irop_flag_cfopcode
49 #   I   irop_flag_ip_cfopcode
50 #   F   irop_flag_fragile
51 #   Y   irop_flag_forking
52 #   H   irop_flag_highlevel
53 #   c   irop_flag_constlike
54 #   K   irop_flag_keep
55 #
56 # irn_flags: special node flags, OPTIONAL (default is 0)
57 # following irn_flags are supported:
58 #   R   rematerializeable
59 #   N   not spillable
60 #   I   ignore for register allocation
61 #   S   modifies stack pointer
62 #
63 # state: state of the operation, OPTIONAL (default is "floats")
64 #
65 # arity: arity of the operation, MUST NOT BE OMITTED
66 #
67 # args:  the OPTIONAL arguments of the node constructor (debug, irg and block
68 #        are always the first 3 arguments and are always autmatically
69 #        created)
70 #        If this key is missing the following arguments will be created:
71 #        for i = 1 .. arity: ir_node *op_i
72 #        ir_mode *mode
73 #
74 # outs:  if a node defines more than one output, the names of the projections
75 #        nodes having outs having automatically the mode mode_T
76 #        One can also annotate some flags for each out, additional to irn_flags.
77 #        They are separated from name with a colon ':', and concatenated by pipe '|'
78 #        Only I and S are available at the moment (same meaning as in irn_flags).
79 #        example: [ "frame:I", "stack:I|S", "M" ]
80 #
81 # comment: OPTIONAL comment for the node constructor
82 #
83 # rd_constructor: for every operation there will be a
84 #      new_rd_<arch>_<op-name> function with the arguments from above
85 #      which creates the ir_node corresponding to the defined operation
86 #      you can either put the complete source code of this function here
87 #
88 #      This key is OPTIONAL. If omitted, the following constructor will
89 #      be created:
90 #      if (!op_<arch>_<op-name>) assert(0);
91 #      for i = 1 to arity
92 #         set in[i] = op_i
93 #      done
94 #      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
95 #      return res
96 #
97 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
98 #
99 # latency: the latency of the operation, default is 1
100 #
101
102 # register types:
103 #   0 - no special type
104 #   1 - caller save (register must be saved by the caller of a function)
105 #   2 - callee save (register must be saved by the called function)
106 #   4 - ignore (do not assign this register)
107 #   8 - emitter can choose an arbitrary register of this class
108 #  16 - the register is a virtual one
109 #  32 - register represents a state
110 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
111 %reg_classes = (
112         gp => [
113                 { name => "eax", type => 1 },
114                 { name => "edx", type => 1 },
115                 { name => "ebx", type => 2 },
116                 { name => "ecx", type => 1 },
117                 { name => "esi", type => 2 },
118                 { name => "edi", type => 2 },
119                 { name => "ebp", type => 2 },
120                 { name => "esp", type => 4 },
121                 { name => "gp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
122                 { name => "gp_UKNWN", type => 4 | 8 | 16 },  # we need a dummy register for Unknown nodes
123                 { mode => "mode_Iu" }
124         ],
125         mmx => [
126                 { name => "mm0", type => 4 },
127                 { name => "mm1", type => 4 },
128                 { name => "mm2", type => 4 },
129                 { name => "mm3", type => 4 },
130                 { name => "mm4", type => 4 },
131                 { name => "mm5", type => 4 },
132                 { name => "mm6", type => 4 },
133                 { name => "mm7", type => 4 },
134                 { mode => "mode_E" }
135         ],
136         xmm => [
137                 { name => "xmm0", type => 1 },
138                 { name => "xmm1", type => 1 },
139                 { name => "xmm2", type => 1 },
140                 { name => "xmm3", type => 1 },
141                 { name => "xmm4", type => 1 },
142                 { name => "xmm5", type => 1 },
143                 { name => "xmm6", type => 1 },
144                 { name => "xmm7", type => 1 },
145                 { name => "xmm_NOREG", type => 4 | 16 },     # we need a dummy register for NoReg nodes
146                 { name => "xmm_UKNWN", type => 4 | 8 | 16},  # we need a dummy register for Unknown nodes
147                 { mode => "mode_E" }
148         ],
149         vfp => [
150                 { name => "vf0", type => 1 | 16 },
151                 { name => "vf1", type => 1 | 16 },
152                 { name => "vf2", type => 1 | 16 },
153                 { name => "vf3", type => 1 | 16 },
154                 { name => "vf4", type => 1 | 16 },
155                 { name => "vf5", type => 1 | 16 },
156                 { name => "vf6", type => 1 | 16 },
157                 { name => "vf7", type => 1 | 16 },
158                 { name => "vfp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
159                 { name => "vfp_UKNWN", type => 4 | 8 | 16 },  # we need a dummy register for Unknown nodes
160                 { mode => "mode_E" }
161         ],
162         st => [
163                 { name => "st0", realname => "st",    type => 4 },
164                 { name => "st1", realname => "st(1)", type => 4 },
165                 { name => "st2", realname => "st(2)", type => 4 },
166                 { name => "st3", realname => "st(3)", type => 4 },
167                 { name => "st4", realname => "st(4)", type => 4 },
168                 { name => "st5", realname => "st(5)", type => 4 },
169                 { name => "st6", realname => "st(6)", type => 4 },
170                 { name => "st7", realname => "st(7)", type => 4 },
171                 { mode => "mode_E" }
172         ],
173         fp_cw => [      # the floating point control word
174                 { name => "fpcw", type => 4 | 32},
175                 { mode => "mode_fpcw" }
176         ],
177         flags => [
178                 { name => "eflags", type => 4 },
179                 { mode => "mode_Iu" }
180         ],
181         fp_sw => [
182                 { name => "fpsw", type => 4 },
183                 { mode => "mode_Hu" }
184         ],
185 ); # %reg_classes
186
187 %flags = (
188         CF  => { reg => "eflags", bit => 0 },
189         PF  => { reg => "eflags", bit => 2 },
190         AF  => { reg => "eflags", bit => 4 },
191         ZF  => { reg => "eflags", bit => 6 },
192         SF  => { reg => "eflags", bit => 7 },
193         TF  => { reg => "eflags", bit => 8 },
194         IF  => { reg => "eflags", bit => 9 },
195         DF  => { reg => "eflags", bit => 10 },
196         OF  => { reg => "eflags", bit => 11 },
197         IOPL0 => { reg => "eflags", bit => 12 },
198         IOPL1 => { reg => "eflags", bit => 13 },
199         NT  => { reg => "eflags", bit => 14 },
200         RF  => { reg => "eflags", bit => 16 },
201         VM  => { reg => "eflags", bit => 17 },
202         AC  => { reg => "eflags", bit => 18 },
203         VIF => { reg => "eflags", bit => 19 },
204         VIP => { reg => "eflags", bit => 20 },
205         ID  => { reg => "eflags", bit => 21 },
206
207         FP_IE => { reg => "fpsw", bit => 0 },
208         FP_DE => { reg => "fpsw", bit => 1 },
209         FP_ZE => { reg => "fpsw", bit => 2 },
210         FP_OE => { reg => "fpsw", bit => 3 },
211         FP_UE => { reg => "fpsw", bit => 4 },
212         FP_PE => { reg => "fpsw", bit => 5 },
213         FP_SF => { reg => "fpsw", bit => 6 },
214         FP_ES => { reg => "fpsw", bit => 7 },
215         FP_C0 => { reg => "fpsw", bit => 8 },
216         FP_C1 => { reg => "fpsw", bit => 9 },
217         FP_C2 => { reg => "fpsw", bit => 10 },
218         FP_TOP0 => { reg => "fpsw", bit => 11 },
219         FP_TOP1 => { reg => "fpsw", bit => 12 },
220         FP_TOP2 => { reg => "fpsw", bit => 13 },
221         FP_C3 => { reg => "fpsw", bit => 14 },
222         FP_B  => { reg => "fpsw", bit => 15 },
223
224         FP_IM => { reg => "fpcw", bit => 0 },
225         FP_DM => { reg => "fpcw", bit => 1 },
226         FP_ZM => { reg => "fpcw", bit => 2 },
227         FP_OM => { reg => "fpcw", bit => 3 },
228         FP_UM => { reg => "fpcw", bit => 4 },
229         FP_PM => { reg => "fpcw", bit => 5 },
230         FP_PC0 => { reg => "fpcw", bit => 8 },
231         FP_PC1 => { reg => "fpcw", bit => 9 },
232         FP_RC0 => { reg => "fpcw", bit => 10 },
233         FP_RC1 => { reg => "fpcw", bit => 11 },
234         FP_X  => { reg => "fpcw", bit => 12 }
235 ); # %flags
236
237 %cpu = (
238         GP     => [ 1, "GP_EAX", "GP_EBX", "GP_ECX", "GP_EDX", "GP_ESI", "GP_EDI", "GP_EBP" ],
239         SSE    => [ 1, "SSE_XMM0", "SSE_XMM1", "SSE_XMM2", "SSE_XMM3", "SSE_XMM4", "SSE_XMM5", "SSE_XMM6", "SSE_XMM7" ],
240         VFP    => [ 1, "VFP_VF0", "VFP_VF1", "VFP_VF2", "VFP_VF3", "VFP_VF4", "VFP_VF5", "VFP_VF6", "VFP_VF7" ],
241         BRANCH => [ 1, "BRANCH1", "BRANCH2" ],
242 ); # %cpu
243
244 %vliw = (
245         bundle_size       => 1,
246         bundels_per_cycle => 1
247 ); # vliw
248
249 %emit_templates = (
250         S0 => "${arch}_emit_source_register(env, node, 0);",
251         S1 => "${arch}_emit_source_register(env, node, 1);",
252         S2 => "${arch}_emit_source_register(env, node, 2);",
253         S3 => "${arch}_emit_source_register(env, node, 3);",
254         S4 => "${arch}_emit_source_register(env, node, 4);",
255         S5 => "${arch}_emit_source_register(env, node, 5);",
256         D0 => "${arch}_emit_dest_register(env, node, 0);",
257         D1 => "${arch}_emit_dest_register(env, node, 1);",
258         D2 => "${arch}_emit_dest_register(env, node, 2);",
259         D3 => "${arch}_emit_dest_register(env, node, 3);",
260         D4 => "${arch}_emit_dest_register(env, node, 4);",
261         D5 => "${arch}_emit_dest_register(env, node, 5);",
262         X0 => "${arch}_emit_x87_name(env, node, 0);",
263         X1 => "${arch}_emit_x87_name(env, node, 1);",
264         X2 => "${arch}_emit_x87_name(env, node, 2);",
265         C  => "${arch}_emit_immediate(env, node);",
266         SE => "${arch}_emit_extend_suffix(env, get_ia32_ls_mode(node));",
267         ME => "if(get_mode_size_bits(get_ia32_ls_mode(node)) != 32)\n
268                    ia32_emit_mode_suffix(env, node);",
269         M  => "${arch}_emit_mode_suffix(env, node);",
270         XM => "${arch}_emit_x87_mode_suffix(env, node);",
271         XXM => "${arch}_emit_xmm_mode_suffix(env, node);",
272         XSD => "${arch}_emit_xmm_mode_suffix_s(env, node);",
273         AM => "${arch}_emit_am(env, node);",
274         unop0 => "${arch}_emit_unop(env, node, 0);",
275         unop1 => "${arch}_emit_unop(env, node, 1);",
276         unop2 => "${arch}_emit_unop(env, node, 2);",
277         unop3 => "${arch}_emit_unop(env, node, 3);",
278         unop4 => "${arch}_emit_unop(env, node, 4);",
279         DAM0  => "${arch}_emit_am_or_dest_register(env, node, 0);",
280         DAM1  => "${arch}_emit_am_or_dest_register(env, node, 0);",
281         binop => "${arch}_emit_binop(env, node);",
282         x87_binop => "${arch}_emit_x87_binop(env, node);",
283 );
284
285 #--------------------------------------------------#
286 #                        _                         #
287 #                       (_)                        #
288 #  _ __   _____      __  _ _ __    ___  _ __  ___  #
289 # | '_ \ / _ \ \ /\ / / | | '__|  / _ \| '_ \/ __| #
290 # | | | |  __/\ V  V /  | | |    | (_) | |_) \__ \ #
291 # |_| |_|\___| \_/\_/   |_|_|     \___/| .__/|___/ #
292 #                                      | |         #
293 #                                      |_|         #
294 #--------------------------------------------------#
295
296 $default_attr_type = "ia32_attr_t";
297
298 %init_attr = (
299         ia32_attr_t     => "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);",
300         ia32_x87_attr_t =>
301                 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
302                 "\tinit_ia32_x87_attributes(res);",
303         ia32_asm_attr_t =>
304                 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
305                 "\tinit_ia32_x87_attributes(res);".
306                 "\tinit_ia32_asm_attributes(res);",
307         ia32_immediate_attr_t =>
308                 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
309                 "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, offset);"
310 );
311
312 %compare_attr = (
313         ia32_attr_t           => "ia32_compare_nodes_attr",
314         ia32_x87_attr_t       => "ia32_compare_x87_attr",
315         ia32_asm_attr_t       => "ia32_compare_asm_attr",
316         ia32_immediate_attr_t => "ia32_compare_immediate_attr",
317 );
318
319 %operands = (
320 );
321
322 $mode_xmm     = "mode_E";
323 $mode_gp      = "mode_Iu";
324 $mode_fpcw    = "mode_fpcw";
325 $status_flags = [ "CF", "PF", "AF", "ZF", "SF", "OF" ];
326 $fpcw_flags   = [ "FP_IM", "FP_DM", "FP_ZM", "FP_OM", "FP_UM", "FP_PM",
327                   "FP_PC0", "FP_PC1", "FP_RC0", "FP_RC1", "FP_X" ];
328
329 %nodes = (
330
331 Immediate => {
332         state     => "pinned",
333         op_flags  => "c",
334         irn_flags => "I",
335         reg_req   => { out => [ "gp_NOREG" ] },
336         attr      => "ir_entity *symconst, int symconst_sign, tarval *offset",
337         attr_type => "ia32_immediate_attr_t",
338         mode      => $mode_gp,
339 },
340
341 Asm => {
342         mode      => "mode_T",
343         arity     => "variable",
344         out_arity => "variable",
345         attr_type => "ia32_asm_attr_t",
346 },
347
348 #-----------------------------------------------------------------#
349 #  _       _                                         _            #
350 # (_)     | |                                       | |           #
351 #  _ _ __ | |_ ___  __ _  ___ _ __   _ __   ___   __| | ___  ___  #
352 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
353 # | | | | | ||  __/ (_| |  __/ |    | | | | (_) | (_| |  __/\__ \ #
354 # |_|_| |_|\__\___|\__, |\___|_|    |_| |_|\___/ \__,_|\___||___/ #
355 #                   __/ |                                         #
356 #                  |___/                                          #
357 #-----------------------------------------------------------------#
358
359 # commutative operations
360
361 # NOTE:
362 # All nodes supporting Addressmode have 5 INs:
363 # 1 - base    r1 == NoReg in case of no AM or no base
364 # 2 - index   r2 == NoReg in case of no AM or no index
365 # 3 - op1     r3 == always present
366 # 4 - op2     r4 == NoReg in case of immediate operation
367 # 5 - mem     NoMem in case of no AM otherwise it takes the mem from the Load
368
369 Add => {
370         irn_flags => "R",
371         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
372         ins       => [ "base", "index", "left", "right", "mem" ],
373         emit      => '. add%M %binop',
374         units     => [ "GP" ],
375         mode      => $mode_gp,
376         modified_flags => $status_flags
377 },
378
379 Adc => {
380         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
381         emit      => '. adc%M %binop',
382         units     => [ "GP" ],
383         mode      => $mode_gp,
384         modified_flags => $status_flags
385 },
386
387 Add64Bit => {
388         irn_flags => "R",
389         arity     => 4,
390         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
391         emit      => '
392 . movl %S0, %D0
393 . movl %S1, %D1
394 . addl %S2, %D0
395 . adcl %S3, %D1
396 ',
397         outs      => [ "low_res", "high_res" ],
398         units     => [ "GP" ],
399         modified_flags => $status_flags
400 },
401
402 l_Add => {
403         op_flags  => "C",
404         irn_flags => "R",
405         cmp_attr  => "return 1;",
406         arity     => 2,
407 },
408
409 l_Adc => {
410         op_flags  => "C",
411         cmp_attr  => "return 1;",
412         arity     => 2,
413 },
414
415 Mul => {
416         # we should not rematrialize this node. It produces 2 results and has
417         # very strict constrains
418         reg_req   => { in => [ "gp", "gp", "eax", "gp", "none" ], out => [ "eax", "edx", "none" ] },
419         emit      => '. mul%M %unop3',
420         outs      => [ "EAX", "EDX", "M" ],
421         ins       => [ "base", "index", "val_high", "val_low", "mem" ],
422         latency   => 10,
423         units     => [ "GP" ],
424         modified_flags => $status_flags
425 },
426
427 l_Mul => {
428         # we should not rematrialize this node. It produces 2 results and has
429         # very strict constrains
430         op_flags  => "C",
431         cmp_attr  => "return 1;",
432         outs      => [ "EAX", "EDX", "M" ],
433         arity     => 2
434 },
435
436 IMul => {
437         irn_flags => "R",
438         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
439         emit      => '. imul%M %binop',
440         latency   => 5,
441         units     => [ "GP" ],
442         mode      => $mode_gp,
443         modified_flags => $status_flags
444 },
445
446 IMul1OP => {
447         irn_flags => "R",
448         reg_req   => { in => [ "gp", "gp", "eax", "gp", "none" ], out => [ "eax", "edx", "none" ] },
449         emit      => '. imul%M %unop3',
450         outs      => [ "EAX", "EDX", "M" ],
451         ins       => [ "base", "index", "val_high", "val_low", "mem" ],
452         latency   => 5,
453         units     => [ "GP" ],
454         modified_flags => $status_flags
455 },
456
457 l_IMul => {
458         op_flags  => "C",
459         cmp_attr  => "return 1;",
460         arity     => 2
461 },
462
463 And => {
464         irn_flags => "R",
465         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
466         emit      => '. and%M %binop',
467         units     => [ "GP" ],
468         mode      => $mode_gp,
469         modified_flags => $status_flags
470 },
471
472 Or => {
473         irn_flags => "R",
474         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
475         emit      => '. or%M %binop',
476         units     => [ "GP" ],
477         mode      => $mode_gp,
478         modified_flags => $status_flags
479 },
480
481 Xor => {
482         irn_flags => "R",
483         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
484         emit      => '. xor%M %binop',
485         units     => [ "GP" ],
486         mode      => $mode_gp,
487         modified_flags => $status_flags
488 },
489
490 l_Xor => {
491         op_flags  => "C",
492         cmp_attr  => "return 1;",
493         arity     => 2,
494         modified_flags => $status_flags
495 },
496
497 # not commutative operations
498
499 Sub => {
500         irn_flags => "R",
501         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
502         emit      => '. sub%M %binop',
503         units     => [ "GP" ],
504         mode      => $mode_gp,
505         modified_flags => $status_flags
506 },
507
508 Sbb => {
509         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3 !in_r4" ] },
510         emit      => '. sbb%M %binop',
511         units     => [ "GP" ],
512         mode      => $mode_gp,
513         modified_flags => $status_flags
514 },
515
516 Sub64Bit => {
517         irn_flags => "R",
518         arity     => 4,
519         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
520         emit      => '
521 . movl %S0, %D0
522 . movl %S1, %D1
523 . subl %S2, %D0
524 . sbbl %S3, %D1
525 ',
526         outs      => [ "low_res", "high_res" ],
527         units     => [ "GP" ],
528         modified_flags => $status_flags
529 },
530
531 l_Sub => {
532         irn_flags => "R",
533         cmp_attr  => "return 1;",
534         arity     => 2,
535 },
536
537 l_Sbb => {
538         cmp_attr  => "return 1;",
539         arity     => 2,
540 },
541
542 IDiv => {
543         op_flags  => "F|L",
544         state     => "exc_pinned",
545         reg_req   => { in => [ "gp", "gp", "eax", "edx", "gp", "none" ], out => [ "eax", "edx", "none" ] },
546         attr      => "ia32_op_flavour_t dm_flav",
547         init_attr => "attr->data.op_flav = dm_flav;",
548         emit      => ". idiv%M %unop4",
549         outs      => [ "div_res", "mod_res", "M" ],
550         latency   => 25,
551         units     => [ "GP" ],
552         modified_flags => $status_flags
553 },
554
555 Div => {
556         op_flags  => "F|L",
557         state     => "exc_pinned",
558         reg_req   => { in => [ "gp", "gp", "eax", "edx", "gp", "none" ], out => [ "eax", "edx", "none" ] },
559         attr      => "ia32_op_flavour_t dm_flav",
560         init_attr => "attr->data.op_flav = dm_flav;",
561         emit      => ". div%M %unop4",
562         outs      => [ "div_res", "mod_res", "M" ],
563         latency   => 25,
564         units     => [ "GP" ],
565         modified_flags => $status_flags
566 },
567
568 Shl => {
569         irn_flags => "R",
570         # "in_r3" would be enough as out requirement, but the register allocator
571         # does strange things then and doesn't respect the constraint for in4
572         # if the same value is attached to in3 and in4 (if you have "i << i" in C)
573         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
574         ins       => [ "base", "index", "left", "right", "mem" ],
575         emit      => '. shl%M %binop',
576         units     => [ "GP" ],
577         mode      => $mode_gp,
578         modified_flags => $status_flags
579 },
580
581 l_Shl => {
582         cmp_attr  => "return 1;",
583         arity     => 2
584 },
585
586 ShlD => {
587         irn_flags => "R",
588         # Out requirements is: different from all in
589         # This is because, out must be different from LowPart and ShiftCount.
590         # We could say "!ecx !in_r4" but it can occur, that all values live through
591         # this Shift and the only value dying is the ShiftCount. Then there would be
592         # a register missing, as result must not be ecx and all other registers are
593         # occupied. What we should write is "!in_r4 !in_r5", but this is not
594         # supported (and probably never will). So we create artificial interferences
595         # of the result with all inputs, so the spiller can always assure a free
596         # register.
597         reg_req   => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
598         emit      =>
599 '
600 if (get_ia32_immop_type(node) == ia32_ImmNone) {
601         if (get_ia32_op_type(node) == ia32_AddrModeD) {
602                 . shld%M %%cl, %S3, %AM
603         } else {
604                 . shld%M %%cl, %S3, %S2
605         }
606 } else {
607         if (get_ia32_op_type(node) == ia32_AddrModeD) {
608                 . shld%M %C, %S3, %AM
609         } else {
610                 . shld%M %C, %S3, %S2
611         }
612 }
613 ',
614         latency   => 6,
615         units     => [ "GP" ],
616         mode      => $mode_gp,
617         modified_flags => $status_flags
618 },
619
620 l_ShlD => {
621         cmp_attr  => "return 1;",
622         arity     => 3,
623 },
624
625 Shr => {
626         irn_flags => "R",
627         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
628         emit      => '. shr%M %binop',
629         units     => [ "GP" ],
630         mode      => $mode_gp,
631         modified_flags => $status_flags
632 },
633
634 l_Shr => {
635         cmp_attr  => "return 1;",
636         arity     => 2
637 },
638
639 ShrD => {
640         irn_flags => "R",
641         # Out requirements is: different from all in
642         # This is because, out must be different from LowPart and ShiftCount.
643         # We could say "!ecx !in_r4" but it can occur, that all values live through
644         # this Shift and the only value dying is the ShiftCount. Then there would be a
645         # register missing, as result must not be ecx and all other registers are
646         # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
647         # (and probably never will). So we create artificial interferences of the result
648         # with all inputs, so the spiller can always assure a free register.
649         reg_req   => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
650         emit      => '
651 if (get_ia32_immop_type(node) == ia32_ImmNone) {
652         if (get_ia32_op_type(node) == ia32_AddrModeD) {
653                 . shrd%M %%cl, %S3, %AM
654         } else {
655                 . shrd%M %%cl, %S3, %S2
656         }
657 } else {
658         if (get_ia32_op_type(node) == ia32_AddrModeD) {
659                 . shrd%M %C, %S3, %AM
660         } else {
661                 . shrd%M %C, %S3, %S2
662         }
663 }
664 ',
665         latency   => 6,
666         units     => [ "GP" ],
667         mode      => $mode_gp,
668         modified_flags => $status_flags
669 },
670
671 l_ShrD => {
672         cmp_attr  => "return 1;",
673         arity     => 3
674 },
675
676 Sar => {
677         irn_flags => "R",
678         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
679         emit      => '. sar%M %binop',
680         units     => [ "GP" ],
681         mode      => $mode_gp,
682         modified_flags => $status_flags
683 },
684
685 l_Sar => {
686         cmp_attr  => "return 1;",
687         arity     => 2
688 },
689
690 Ror => {
691         irn_flags => "R",
692         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
693         emit      => '. ror%M %binop',
694         units     => [ "GP" ],
695         mode      => $mode_gp,
696         modified_flags => $status_flags
697 },
698
699 Rol => {
700         irn_flags => "R",
701         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
702         emit      => '. rol%M %binop',
703         units     => [ "GP" ],
704         mode      => $mode_gp,
705         modified_flags => $status_flags
706 },
707
708 # unary operations
709
710 Neg => {
711         irn_flags => "R",
712         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
713         emit      => '. neg%M %unop2',
714         ins       => [ "base", "index", "val", "mem" ],
715         units     => [ "GP" ],
716         mode      => $mode_gp,
717         modified_flags => $status_flags
718 },
719
720 Minus64Bit => {
721         irn_flags => "R",
722         reg_req   => { in => [ "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
723         emit      => '
724 . movl %S0, %D0
725 . movl %S0, %D1
726 . subl %S1, %D0
727 . sbbl %S2, %D1
728 ',
729         outs      => [ "low_res", "high_res" ],
730         units     => [ "GP" ],
731         modified_flags => $status_flags
732 },
733
734
735 l_Neg => {
736         cmp_attr  => "return 1;",
737         arity     => 1,
738 },
739
740 Inc => {
741         irn_flags => "R",
742         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
743         emit      => '. inc%M %unop2',
744         units     => [ "GP" ],
745         mode      => $mode_gp,
746         modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
747 },
748
749 Dec => {
750         irn_flags => "R",
751         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
752         emit      => '. dec%M %unop2',
753         units     => [ "GP" ],
754         mode      => $mode_gp,
755         modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
756 },
757
758 Not => {
759         irn_flags => "R",
760         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
761         ins       => [ "base", "index", "val", "mem" ],
762         emit      => '. not%M %unop2',
763         units     => [ "GP" ],
764         mode      => $mode_gp,
765         modified_flags => []
766 },
767
768 # other operations
769
770 CondJmp => {
771         state     => "pinned",
772         op_flags  => "L|X|Y",
773         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "none", "none"] },
774         outs      => [ "false", "true" ],
775         latency   => 3,
776         units     => [ "BRANCH" ],
777 },
778
779 TestJmp => {
780         state     => "pinned",
781         op_flags  => "L|X|Y",
782         reg_req  => { in => [ "gp", "gp" ], out => [ "none", "none" ] },
783         outs      => [ "false", "true" ],
784         latency   => 3,
785         units     => [ "BRANCH" ],
786 },
787
788 CJmpAM => {
789         state     => "pinned",
790         op_flags  => "L|X|Y",
791         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "none", "none" ] },
792         outs      => [ "false", "true" ],
793         units     => [ "BRANCH" ],
794 },
795
796 CJmp => {
797         state     => "pinned",
798         op_flags  => "L|X|Y",
799         reg_req   => { in => [ "gp", "gp" ] },
800         units     => [ "BRANCH" ],
801 },
802
803 SwitchJmp => {
804         state     => "pinned",
805         op_flags  => "L|X|Y",
806         reg_req   => { in => [ "gp" ], out => [ "none" ] },
807         latency   => 3,
808         units     => [ "BRANCH" ],
809 },
810
811 Const => {
812         op_flags  => "c",
813         irn_flags => "R",
814         reg_req   => { out => [ "gp" ] },
815         units     => [ "GP" ],
816         mode      => $mode_gp,
817 },
818
819 Unknown_GP => {
820         state     => "pinned",
821         op_flags  => "c",
822         irn_flags => "I",
823         reg_req   => { out => [ "gp_UKNWN" ] },
824         units     => [],
825         emit      => "",
826         mode      => $mode_gp
827 },
828
829 Unknown_VFP => {
830         state     => "pinned",
831         op_flags  => "c",
832         irn_flags => "I",
833         reg_req   => { out => [ "vfp_UKNWN" ] },
834         units     => [],
835         emit      => "",
836         mode      => "mode_E",
837         attr_type => "ia32_x87_attr_t",
838 },
839
840 Unknown_XMM => {
841         state     => "pinned",
842         op_flags  => "c",
843         irn_flags => "I",
844         reg_req   => { out => [ "xmm_UKNWN" ] },
845         units     => [],
846         emit      => "",
847         mode      => "mode_E"
848 },
849
850 NoReg_GP => {
851         state     => "pinned",
852         op_flags  => "c",
853         irn_flags => "I",
854         reg_req   => { out => [ "gp_NOREG" ] },
855         units     => [],
856         emit      => "",
857         mode      => $mode_gp
858 },
859
860 NoReg_VFP => {
861         state     => "pinned",
862         op_flags  => "c",
863         irn_flags => "I",
864         reg_req   => { out => [ "vfp_NOREG" ] },
865         units     => [],
866         emit      => "",
867         mode      => "mode_E",
868         attr_type => "ia32_x87_attr_t",
869 },
870
871 NoReg_XMM => {
872         state     => "pinned",
873         op_flags  => "c",
874         irn_flags => "I",
875         reg_req   => { out => [ "xmm_NOREG" ] },
876         units     => [],
877         emit      => "",
878         mode      => "mode_E"
879 },
880
881 ChangeCW => {
882         state     => "pinned",
883         op_flags  => "c",
884         irn_flags => "I",
885         reg_req   => { out => [ "fp_cw" ] },
886         mode      => $mode_fpcw,
887         latency   => 3,
888         units     => [ "GP" ],
889         modified_flags => $fpcw_flags
890 },
891
892 FldCW => {
893         op_flags  => "L|F",
894         state     => "exc_pinned",
895         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
896         latency   => 5,
897         emit      => ". fldcw %AM",
898         mode      => $mode_fpcw,
899         units     => [ "GP" ],
900         modified_flags => $fpcw_flags
901 },
902
903 FnstCW => {
904         op_flags  => "L|F",
905         state     => "exc_pinned",
906         reg_req   => { in => [ "gp", "gp", "fp_cw", "none" ], out => [ "none" ] },
907         latency   => 5,
908         emit      => ". fnstcw %AM",
909         mode      => "mode_M",
910         units     => [ "GP" ],
911 },
912
913 Cltd => {
914         # we should not rematrialize this node. It produces 2 results and has
915         # very strict constrains
916         reg_req   => { in => [ "gp" ], out => [ "eax in_r1", "edx" ] },
917         emit      => '. cltd',
918         outs      => [ "EAX", "EDX" ],
919         units     => [ "GP" ],
920 },
921
922 # Load / Store
923
924 Load => {
925         op_flags  => "L|F",
926         state     => "exc_pinned",
927         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
928         latency   => 3,
929         emit      => ". mov%SE%ME%.l %AM, %D0",
930         outs      => [ "res", "M" ],
931         units     => [ "GP" ],
932 },
933
934 l_Load => {
935         op_flags  => "L|F",
936         cmp_attr  => "return 1;",
937         outs      => [ "res", "M" ],
938         arity     => 2,
939 },
940
941 l_Store => {
942         op_flags  => "L|F",
943         cmp_attr  => "return 1;",
944         state     => "exc_pinned",
945         arity     => 3,
946         mode      => "mode_M",
947 },
948
949 Store => {
950         op_flags  => "L|F",
951         state     => "exc_pinned",
952         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "none" ] },
953         emit      => '. mov%M %binop',
954         latency   => 3,
955         units     => [ "GP" ],
956         mode      => "mode_M",
957 },
958
959 Store8Bit => {
960         op_flags  => "L|F",
961         state     => "exc_pinned",
962         reg_req   => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => ["none" ] },
963         emit      => '. mov%M %binop',
964         latency   => 3,
965         units     => [ "GP" ],
966         mode      => "mode_M",
967 },
968
969 Lea => {
970         irn_flags => "R",
971         reg_req   => { in => [ "gp", "gp" ], out => [ "in_r1" ] },
972         emit      => '. leal %AM, %D0',
973         latency   => 2,
974         units     => [ "GP" ],
975         mode      => $mode_gp,
976         modified_flags => [],
977 },
978
979 Push => {
980         reg_req   => { in => [ "gp", "gp", "gp", "esp", "none" ], out => [ "esp", "none" ] },
981         emit      => '. push%M %unop2',
982         ins       => [ "base", "index", "val", "stack", "mem" ],
983         outs      => [ "stack:I|S", "M" ],
984         latency   => 3,
985         units     => [ "GP" ],
986         modified_flags => [],
987 },
988
989 Pop => {
990         reg_req   => { in => [ "gp", "gp", "esp", "none" ], out => [ "esp", "gp", "none" ] },
991         emit      => '. pop%M %DAM1',
992         outs      => [ "stack:I|S", "res", "M" ],
993         ins       => [ "base", "index", "stack", "mem" ],
994         latency   => 4,
995         units     => [ "GP" ],
996         modified_flags => [],
997 },
998
999 Enter => {
1000         reg_req   => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1001         emit      => '. enter',
1002         outs      => [ "frame:I", "stack:I|S", "M" ],
1003         latency   => 15,
1004         units     => [ "GP" ],
1005 },
1006
1007 Leave => {
1008         reg_req   => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1009         emit      => '. leave',
1010         outs      => [ "frame:I", "stack:I|S" ],
1011         latency   => 3,
1012         units     => [ "GP" ],
1013 },
1014
1015 AddSP => {
1016         irn_flags => "I",
1017         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
1018         emit      => '. addl %binop',
1019         outs      => [ "stack:S", "M" ],
1020         units     => [ "GP" ],
1021         modified_flags => $status_flags
1022 },
1023
1024 SubSP => {
1025         irn_flags => "I",
1026         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
1027         emit      => '. subl %binop',
1028         outs      => [ "stack:S", "M" ],
1029         units     => [ "GP" ],
1030         modified_flags => $status_flags
1031 },
1032
1033 LdTls => {
1034         irn_flags => "R",
1035         reg_req   => { out => [ "gp" ] },
1036         units     => [ "GP" ],
1037 },
1038
1039 # the int instruction
1040 int => {
1041         reg_req   => { in => [ "none" ], out => [ "none" ] },
1042         mode      => "mode_M",
1043         attr      => "tarval *tv",
1044         init_attr => "\tset_ia32_Immop_tarval(res, tv);",
1045         emit      => '. int %C',
1046         units     => [ "GP" ],
1047         cmp_attr  => "return 1;",
1048 },
1049
1050
1051 #-----------------------------------------------------------------------------#
1052 #   _____ _____ ______    __ _             _                     _            #
1053 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
1054 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1055 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1056 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1057 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1058 #-----------------------------------------------------------------------------#
1059
1060 # commutative operations
1061
1062 xAdd => {
1063         irn_flags => "R",
1064         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1065         emit      => '. add%XXM %binop',
1066         latency   => 4,
1067         units     => [ "SSE" ],
1068         mode      => "mode_E",
1069 },
1070
1071 xMul => {
1072         irn_flags => "R",
1073         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1074         emit      => '. mul%XXM %binop',
1075         latency   => 4,
1076         units     => [ "SSE" ],
1077         mode      => "mode_E",
1078 },
1079
1080 xMax => {
1081         irn_flags => "R",
1082         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1083         emit      => '. max%XXM %binop',
1084         latency   => 2,
1085         units     => [ "SSE" ],
1086         mode      => "mode_E",
1087 },
1088
1089 xMin => {
1090         irn_flags => "R",
1091         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1092         emit      => '. min%XXM %binop',
1093         latency   => 2,
1094         units     => [ "SSE" ],
1095         mode      => "mode_E",
1096 },
1097
1098 xAnd => {
1099         irn_flags => "R",
1100         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1101         emit      => '. andp%XSD %binop',
1102         latency   => 3,
1103         units     => [ "SSE" ],
1104         mode      => "mode_E",
1105 },
1106
1107 xOr => {
1108         irn_flags => "R",
1109         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1110         emit      => '. orp%XSD %binop',
1111         units     => [ "SSE" ],
1112         mode      => "mode_E",
1113 },
1114
1115 xXor => {
1116         irn_flags => "R",
1117         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1118         emit      => '. xorp%XSD %binop',
1119         latency   => 3,
1120         units     => [ "SSE" ],
1121         mode      => "mode_E",
1122 },
1123
1124 # not commutative operations
1125
1126 xAndNot => {
1127         irn_flags => "R",
1128         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1129         emit      => '. andnp%XSD %binop',
1130         latency   => 3,
1131         units     => [ "SSE" ],
1132         mode      => "mode_E",
1133 },
1134
1135 xSub => {
1136         irn_flags => "R",
1137         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1138         emit      => '. sub%XXM %binop',
1139         latency   => 4,
1140         units     => [ "SSE" ],
1141         mode      => "mode_E",
1142 },
1143
1144 xDiv => {
1145         irn_flags => "R",
1146         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4", "none" ] },
1147         outs      => [ "res", "M" ],
1148         emit      => '. div%XXM %binop',
1149         latency   => 16,
1150         units     => [ "SSE" ],
1151 },
1152
1153 # other operations
1154
1155 xCmp => {
1156         irn_flags => "R",
1157         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1158         latency   => 3,
1159         units     => [ "SSE" ],
1160         mode      => "mode_E",
1161 },
1162
1163 xCondJmp => {
1164         state     => "pinned",
1165         op_flags  => "L|X|Y",
1166         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "none", "none" ] },
1167         outs      => [ "false", "true" ],
1168         latency   => 5,
1169         units     => [ "SSE" ],
1170 },
1171
1172 xConst => {
1173         op_flags  => "c",
1174         irn_flags => "R",
1175         reg_req   => { out => [ "xmm" ] },
1176         emit      => '. mov%XXM %C, %D0',
1177         latency   => 2,
1178         units     => [ "SSE" ],
1179         mode      => "mode_E",
1180 },
1181
1182 # Load / Store
1183
1184 xLoad => {
1185         op_flags  => "L|F",
1186         state     => "exc_pinned",
1187         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1188         emit      => '. mov%XXM %AM, %D0',
1189         outs      => [ "res", "M" ],
1190         latency   => 2,
1191         units     => [ "SSE" ],
1192 },
1193
1194 xStore => {
1195         op_flags => "L|F",
1196         state    => "exc_pinned",
1197         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1198         emit     => '. mov%XXM %binop',
1199         latency  => 2,
1200         units    => [ "SSE" ],
1201         mode     => "mode_M",
1202 },
1203
1204 xStoreSimple => {
1205         op_flags => "L|F",
1206         state    => "exc_pinned",
1207         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1208         ins      => [ "base", "index", "val", "mem" ],
1209         emit     => '. mov%XXM %S2, %AM',
1210         latency  => 2,
1211         units    => [ "SSE" ],
1212         mode     => "mode_M",
1213 },
1214
1215 CvtSI2SS => {
1216         op_flags => "L|F",
1217         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm" ] },
1218         emit     => '. cvtsi2ss %D0, %AM',
1219         latency  => 2,
1220         units    => [ "SSE" ],
1221         mode     => $mode_xmm
1222 },
1223
1224 CvtSI2SD => {
1225         op_flags => "L|F",
1226         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm" ] },
1227         emit     => '. cvtsi2sd %unop2',
1228         latency  => 2,
1229         units    => [ "SSE" ],
1230         mode     => $mode_xmm
1231 },
1232
1233
1234 l_X87toSSE => {
1235         op_flags => "L|F",
1236         cmp_attr => "return 1;",
1237         arity    => 3,
1238 },
1239
1240 l_SSEtoX87 => {
1241         op_flags => "L|F",
1242         cmp_attr => "return 1;",
1243         arity    => 3,
1244 },
1245
1246 GetST0 => {
1247         op_flags => "L|F",
1248         irn_flags => "I",
1249         state    => "exc_pinned",
1250         reg_req  => { in => [ "gp", "gp", "none" ] },
1251         emit     => '. fstp%XM %AM',
1252         latency  => 4,
1253         units    => [ "SSE" ],
1254         mode     => "mode_M",
1255 },
1256
1257 SetST0 => {
1258         op_flags => "L|F",
1259         irn_flags => "I",
1260         state    => "exc_pinned",
1261         reg_req  => { in => [ "gp", "gp", "none" ], out => [ "vf0", "none" ] },
1262         ins      => [ "base", "index", "mem" ],
1263         emit     => '. fld%XM %AM',
1264         outs     => [ "res", "M" ],
1265         latency  => 2,
1266         units     => [ "SSE" ],
1267 },
1268
1269 # CopyB
1270
1271 CopyB => {
1272         op_flags => "F|H",
1273         state    => "pinned",
1274         reg_req  => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1275         outs     => [ "DST", "SRC", "CNT", "M" ],
1276         units    => [ "GP" ],
1277         modified_flags => [ "DF" ]
1278 },
1279
1280 CopyB_i => {
1281         op_flags => "F|H",
1282         state    => "pinned",
1283         reg_req  => { in => [ "edi", "esi", "none" ], out => [  "edi", "esi", "none" ] },
1284         outs     => [ "DST", "SRC", "M" ],
1285         units    => [ "GP" ],
1286         modified_flags => [ "DF" ]
1287 },
1288
1289 # Conversions
1290
1291 Conv_I2I => {
1292         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3", "none" ] },
1293         units    => [ "GP" ],
1294         ins      => [ "base", "index", "val", "mem" ],
1295         mode     => $mode_gp,
1296         modified_flags => $status_flags
1297 },
1298
1299 Conv_I2I8Bit => {
1300         reg_req  => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => [ "in_r3", "none" ] },
1301         ins      => [ "base", "index", "val", "mem" ],
1302         units    => [ "GP" ],
1303         mode     => $mode_gp,
1304         modified_flags => $status_flags
1305 },
1306
1307 Conv_I2FP => {
1308         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1309         latency  => 10,
1310         units    => [ "SSE" ],
1311         mode     => "mode_E",
1312 },
1313
1314 Conv_FP2I => {
1315         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "gp", "none" ] },
1316         latency  => 10,
1317         units    => [ "SSE" ],
1318         mode     => $mode_gp,
1319 },
1320
1321 Conv_FP2FP => {
1322         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "xmm", "none" ] },
1323         latency  => 8,
1324         units    => [ "SSE" ],
1325         mode     => "mode_E",
1326 },
1327
1328 CmpCMov => {
1329         irn_flags => "R",
1330         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "in_r4" ] },
1331         ins       => [ "cmp_left", "cmp_right", "val_true", "val_false" ],
1332         attr      => "pn_Cmp pn_code",
1333         init_attr => "attr->pn_code = pn_code;",
1334         latency   => 2,
1335         units     => [ "GP" ],
1336         mode      => $mode_gp,
1337 },
1338
1339 xCmpCMov => {
1340         irn_flags => "R",
1341         reg_req   => { in => [ "xmm", "xmm", "gp", "gp" ], out => [ "in_r4" ] },
1342         latency   => 5,
1343         units     => [ "SSE" ],
1344         mode      => $mode_gp,
1345 },
1346
1347 vfCmpCMov => {
1348         irn_flags => "R",
1349         reg_req   => { in => [ "vfp", "vfp", "gp", "gp" ], out => [ "in_r4" ] },
1350         latency   => 10,
1351         units     => [ "VFP" ],
1352         mode      => $mode_gp,
1353         attr_type => "ia32_x87_attr_t",
1354 },
1355
1356 CmpSet => {
1357         irn_flags => "R",
1358         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1359         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1360         attr      => "pn_Cmp pn_code",
1361         init_attr => "attr->pn_code = pn_code;",
1362         latency   => 2,
1363         units     => [ "GP" ],
1364         mode      => $mode_gp,
1365 },
1366
1367 xCmpSet => {
1368         irn_flags => "R",
1369         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "eax ebx ecx edx" ] },
1370         latency   => 5,
1371         units     => [ "SSE" ],
1372         mode      => $mode_gp,
1373 },
1374
1375 vfCmpSet => {
1376         irn_flags => "R",
1377         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "eax ebx ecx edx" ] },
1378         latency   => 10,
1379         units     => [ "VFP" ],
1380         mode      => $mode_gp,
1381         attr_type => "ia32_x87_attr_t",
1382 },
1383
1384 vfCMov => {
1385         irn_flags => "R",
1386         reg_req   => { in => [ "vfp", "vfp", "vfp", "vfp" ], out => [ "vfp" ] },
1387         latency   => 10,
1388         units     => [ "VFP" ],
1389         mode      => "mode_E",
1390         attr_type => "ia32_x87_attr_t",
1391 },
1392
1393 #----------------------------------------------------------#
1394 #        _      _               _    __ _             _    #
1395 #       (_)    | |             | |  / _| |           | |   #
1396 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1397 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1398 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1399 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1400 #                 | |                                      #
1401 #  _ __   ___   __| | ___  ___                             #
1402 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1403 # | | | | (_) | (_| |  __/\__ \                            #
1404 # |_| |_|\___/ \__,_|\___||___/                            #
1405 #----------------------------------------------------------#
1406
1407 vfadd => {
1408         irn_flags => "R",
1409         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1410         latency   => 4,
1411         units     => [ "VFP" ],
1412         mode      => "mode_E",
1413         attr_type => "ia32_x87_attr_t",
1414 },
1415
1416 vfmul => {
1417         irn_flags => "R",
1418         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1419         latency   => 4,
1420         units     => [ "VFP" ],
1421         mode      => "mode_E",
1422         attr_type => "ia32_x87_attr_t",
1423 },
1424
1425 l_vfmul => {
1426         op_flags  => "C",
1427         cmp_attr  => "return 1;",
1428         arity     => 2,
1429 },
1430
1431 vfsub => {
1432         irn_flags => "R",
1433         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1434         latency   => 4,
1435         units     => [ "VFP" ],
1436         mode      => "mode_E",
1437         attr_type => "ia32_x87_attr_t",
1438 },
1439
1440 l_vfsub => {
1441         cmp_attr  => "return 1;",
1442         arity     => 2,
1443 },
1444
1445 vfdiv => {
1446         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp", "none" ] },
1447         outs      => [ "res", "M" ],
1448         latency   => 20,
1449         units     => [ "VFP" ],
1450         attr_type => "ia32_x87_attr_t",
1451 },
1452
1453 l_vfdiv => {
1454         cmp_attr  => "return 1;",
1455         outs      => [ "res", "M" ],
1456         arity     => 2,
1457 },
1458
1459 vfprem => {
1460         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1461         latency   => 20,
1462         units     => [ "VFP" ],
1463         mode      => "mode_E",
1464         attr_type => "ia32_x87_attr_t",
1465 },
1466
1467 l_vfprem => {
1468         cmp_attr  => "return 1;",
1469         arity     => 2,
1470 },
1471
1472 vfabs => {
1473         irn_flags => "R",
1474         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1475         latency   => 2,
1476         units     => [ "VFP" ],
1477         mode      => "mode_E",
1478         attr_type => "ia32_x87_attr_t",
1479 },
1480
1481 vfchs => {
1482         irn_flags => "R",
1483         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1484         latency   => 2,
1485         units     => [ "VFP" ],
1486         mode      => "mode_E",
1487         attr_type => "ia32_x87_attr_t",
1488 },
1489
1490 vfsin => {
1491         irn_flags => "R",
1492         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1493         latency   => 150,
1494         units     => [ "VFP" ],
1495         mode      => "mode_E",
1496         attr_type => "ia32_x87_attr_t",
1497 },
1498
1499 vfcos => {
1500         irn_flags => "R",
1501         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1502         latency   => 150,
1503         units     => [ "VFP" ],
1504         mode      => "mode_E",
1505         attr_type => "ia32_x87_attr_t",
1506 },
1507
1508 vfsqrt => {
1509         irn_flags => "R",
1510         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1511         latency   => 30,
1512         units     => [ "VFP" ],
1513         mode      => "mode_E",
1514         attr_type => "ia32_x87_attr_t",
1515 },
1516
1517 # virtual Load and Store
1518
1519 vfld => {
1520         op_flags  => "L|F",
1521         state     => "exc_pinned",
1522         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1523         outs      => [ "res", "M" ],
1524         latency   => 2,
1525         units     => [ "VFP" ],
1526         attr_type => "ia32_x87_attr_t",
1527 },
1528
1529 vfst => {
1530         op_flags  => "L|F",
1531         state     => "exc_pinned",
1532         reg_req   => { in => [ "gp", "gp", "vfp", "none" ] },
1533         latency   => 2,
1534         units     => [ "VFP" ],
1535         mode      => "mode_M",
1536         attr_type => "ia32_x87_attr_t",
1537 },
1538
1539 # Conversions
1540
1541 vfild => {
1542         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1543         outs      => [ "res", "M" ],
1544         latency   => 4,
1545         units     => [ "VFP" ],
1546         attr_type => "ia32_x87_attr_t",
1547 },
1548
1549 l_vfild => {
1550         cmp_attr  => "return 1;",
1551         outs      => [ "res", "M" ],
1552         arity     => 2,
1553 },
1554
1555 vfist => {
1556         reg_req   => { in => [ "gp", "gp", "vfp", "fpcw", "none" ] },
1557         latency   => 4,
1558         units     => [ "VFP" ],
1559         mode      => "mode_M",
1560         attr_type => "ia32_x87_attr_t",
1561 },
1562
1563 l_vfist => {
1564         cmp_attr  => "return 1;",
1565         arity     => 3,
1566         mode      => "mode_M",
1567 },
1568
1569
1570 # constants
1571
1572 vfldz => {
1573         irn_flags => "R",
1574         reg_req   => { out => [ "vfp" ] },
1575         latency   => 4,
1576         units     => [ "VFP" ],
1577         mode      => "mode_E",
1578         attr_type => "ia32_x87_attr_t",
1579 },
1580
1581 vfld1 => {
1582         irn_flags => "R",
1583         reg_req   => { out => [ "vfp" ] },
1584         latency   => 4,
1585         units     => [ "VFP" ],
1586         mode      => "mode_E",
1587         attr_type => "ia32_x87_attr_t",
1588 },
1589
1590 vfldpi => {
1591         irn_flags => "R",
1592         reg_req   => { out => [ "vfp" ] },
1593         latency   => 4,
1594         units     => [ "VFP" ],
1595         mode      => "mode_E",
1596         attr_type => "ia32_x87_attr_t",
1597 },
1598
1599 vfldln2 => {
1600         irn_flags => "R",
1601         reg_req   => { out => [ "vfp" ] },
1602         latency   => 4,
1603         units     => [ "VFP" ],
1604         mode      => "mode_E",
1605         attr_type => "ia32_x87_attr_t",
1606 },
1607
1608 vfldlg2 => {
1609         irn_flags => "R",
1610         reg_req   => { out => [ "vfp" ] },
1611         latency   => 4,
1612         units     => [ "VFP" ],
1613         mode      => "mode_E",
1614         attr_type => "ia32_x87_attr_t",
1615 },
1616
1617 vfldl2t => {
1618         irn_flags => "R",
1619         reg_req   => { out => [ "vfp" ] },
1620         latency   => 4,
1621         units     => [ "VFP" ],
1622         mode      => "mode_E",
1623         attr_type => "ia32_x87_attr_t",
1624 },
1625
1626 vfldl2e => {
1627         irn_flags => "R",
1628         reg_req   => { out => [ "vfp" ] },
1629         latency   => 4,
1630         units     => [ "VFP" ],
1631         mode      => "mode_E",
1632         attr_type => "ia32_x87_attr_t",
1633 },
1634
1635 vfConst => {
1636         op_flags  => "c",
1637         irn_flags => "R",
1638         reg_req   => { out => [ "vfp" ] },
1639         latency   => 3,
1640         units     => [ "VFP" ],
1641         mode      => "mode_E",
1642         attr_type => "ia32_x87_attr_t",
1643 },
1644
1645 # other
1646
1647 vfCondJmp => {
1648         state     => "pinned",
1649         op_flags  => "L|X|Y",
1650         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "none", "none", "eax" ] },
1651         outs      => [ "false", "true", "temp_reg_eax" ],
1652         latency   => 10,
1653         units     => [ "VFP" ],
1654         attr_type => "ia32_x87_attr_t",
1655 },
1656
1657 #------------------------------------------------------------------------#
1658 #       ___ _____    __ _             _                     _            #
1659 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1660 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1661 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1662 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1663 #------------------------------------------------------------------------#
1664
1665 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1666 #       are swapped, we work this around in the emitter...
1667
1668 fadd => {
1669         op_flags  => "R",
1670         rd_constructor => "NONE",
1671         reg_req   => { },
1672         emit      => '. fadd%XM %x87_binop',
1673         attr_type => "ia32_x87_attr_t",
1674 },
1675
1676 faddp => {
1677         op_flags  => "R",
1678         rd_constructor => "NONE",
1679         reg_req   => { },
1680         emit      => '. faddp %x87_binop',
1681         attr_type => "ia32_x87_attr_t",
1682 },
1683
1684 fmul => {
1685         op_flags  => "R",
1686         rd_constructor => "NONE",
1687         reg_req   => { },
1688         emit      => '. fmul%XM %x87_binop',
1689         attr_type => "ia32_x87_attr_t",
1690 },
1691
1692 fmulp => {
1693         op_flags  => "R",
1694         rd_constructor => "NONE",
1695         reg_req   => { },
1696         emit      => '. fmulp %x87_binop',,
1697         attr_type => "ia32_x87_attr_t",
1698 },
1699
1700 fsub => {
1701         op_flags  => "R",
1702         rd_constructor => "NONE",
1703         reg_req   => { },
1704         emit      => '. fsub%XM %x87_binop',
1705         attr_type => "ia32_x87_attr_t",
1706 },
1707
1708 fsubp => {
1709         op_flags  => "R",
1710         rd_constructor => "NONE",
1711         reg_req   => { },
1712 # see note about gas bugs
1713         emit      => '. fsubrp %x87_binop',
1714         attr_type => "ia32_x87_attr_t",
1715 },
1716
1717 fsubr => {
1718         op_flags  => "R",
1719         rd_constructor => "NONE",
1720         irn_flags => "R",
1721         reg_req   => { },
1722         emit      => '. fsubr%XM %x87_binop',
1723         attr_type => "ia32_x87_attr_t",
1724 },
1725
1726 fsubrp => {
1727         op_flags  => "R",
1728         rd_constructor => "NONE",
1729         irn_flags => "R",
1730         reg_req   => { },
1731 # see note about gas bugs
1732         emit      => '. fsubp %x87_binop',
1733         attr_type => "ia32_x87_attr_t",
1734 },
1735
1736 fprem => {
1737         op_flags  => "R",
1738         rd_constructor => "NONE",
1739         reg_req   => { },
1740         emit      => '. fprem1',
1741         attr_type => "ia32_x87_attr_t",
1742 },
1743
1744 # this node is just here, to keep the simulator running
1745 # we can omit this when a fprem simulation function exists
1746 fpremp => {
1747         op_flags  => "R",
1748         rd_constructor => "NONE",
1749         reg_req   => { },
1750         emit      => '. fprem1',
1751         attr_type => "ia32_x87_attr_t",
1752 },
1753
1754 fdiv => {
1755         op_flags  => "R",
1756         rd_constructor => "NONE",
1757         reg_req   => { },
1758         emit      => '. fdiv%XM %x87_binop',
1759         attr_type => "ia32_x87_attr_t",
1760 },
1761
1762 fdivp => {
1763         op_flags  => "R",
1764         rd_constructor => "NONE",
1765         reg_req   => { },
1766 # see note about gas bugs
1767         emit      => '. fdivrp %x87_binop',
1768         attr_type => "ia32_x87_attr_t",
1769 },
1770
1771 fdivr => {
1772         op_flags  => "R",
1773         rd_constructor => "NONE",
1774         reg_req   => { },
1775         emit      => '. fdivr%XM %x87_binop',
1776         attr_type => "ia32_x87_attr_t",
1777 },
1778
1779 fdivrp => {
1780         op_flags  => "R",
1781         rd_constructor => "NONE",
1782         reg_req   => { },
1783 # see note about gas bugs
1784         emit      => '. fdivp %x87_binop',
1785         attr_type => "ia32_x87_attr_t",
1786 },
1787
1788 fabs => {
1789         op_flags  => "R",
1790         rd_constructor => "NONE",
1791         reg_req   => { },
1792         emit      => '. fabs',
1793         attr_type => "ia32_x87_attr_t",
1794 },
1795
1796 fchs => {
1797         op_flags  => "R|K",
1798         rd_constructor => "NONE",
1799         reg_req   => { },
1800         emit      => '. fchs',
1801         attr_type => "ia32_x87_attr_t",
1802 },
1803
1804 fsin => {
1805         op_flags  => "R",
1806         rd_constructor => "NONE",
1807         reg_req   => { },
1808         emit      => '. fsin',
1809         attr_type => "ia32_x87_attr_t",
1810 },
1811
1812 fcos => {
1813         op_flags  => "R",
1814         rd_constructor => "NONE",
1815         reg_req   => { },
1816         emit      => '. fcos',
1817         attr_type => "ia32_x87_attr_t",
1818 },
1819
1820 fsqrt => {
1821         op_flags  => "R",
1822         rd_constructor => "NONE",
1823         reg_req   => { },
1824         emit      => '. fsqrt $',
1825         attr_type => "ia32_x87_attr_t",
1826 },
1827
1828 # x87 Load and Store
1829
1830 fld => {
1831         rd_constructor => "NONE",
1832         op_flags  => "R|L|F",
1833         state     => "exc_pinned",
1834         reg_req   => { },
1835         emit      => '. fld%XM %AM',
1836         attr_type => "ia32_x87_attr_t",
1837 },
1838
1839 fst => {
1840         rd_constructor => "NONE",
1841         op_flags  => "R|L|F",
1842         state     => "exc_pinned",
1843         reg_req   => { },
1844         emit      => '. fst%XM %AM',
1845         mode      => "mode_M",
1846         attr_type => "ia32_x87_attr_t",
1847 },
1848
1849 fstp => {
1850         rd_constructor => "NONE",
1851         op_flags  => "R|L|F",
1852         state     => "exc_pinned",
1853         reg_req   => { },
1854         emit      => '. fstp%XM %AM',
1855         mode      => "mode_M",
1856         attr_type => "ia32_x87_attr_t",
1857 },
1858
1859 # Conversions
1860
1861 fild => {
1862         op_flags  => "R",
1863         rd_constructor => "NONE",
1864         reg_req   => { },
1865         emit      => '. fild%XM %AM',
1866         attr_type => "ia32_x87_attr_t",
1867 },
1868
1869 fist => {
1870         op_flags  => "R",
1871         rd_constructor => "NONE",
1872         reg_req   => { },
1873         emit      => '. fist%XM %AM',
1874         mode      => "mode_M",
1875         attr_type => "ia32_x87_attr_t",
1876 },
1877
1878 fistp => {
1879         op_flags  => "R",
1880         rd_constructor => "NONE",
1881         reg_req   => { },
1882         emit      => '. fistp%XM %AM',
1883         mode      => "mode_M",
1884         attr_type => "ia32_x87_attr_t",
1885 },
1886
1887 # constants
1888
1889 fldz => {
1890         op_flags  => "R|c|K",
1891         irn_flags  => "R",
1892         reg_req   => { },
1893         emit      => '. fldz',
1894         attr_type => "ia32_x87_attr_t",
1895 },
1896
1897 fld1 => {
1898         op_flags  => "R|c|K",
1899         irn_flags  => "R",
1900         reg_req   => { },
1901         emit      => '. fld1',
1902         attr_type => "ia32_x87_attr_t",
1903 },
1904
1905 fldpi => {
1906         op_flags  => "R|c|K",
1907         irn_flags  => "R",
1908         reg_req   => { },
1909         emit      => '. fldpi',
1910         attr_type => "ia32_x87_attr_t",
1911 },
1912
1913 fldln2 => {
1914         op_flags  => "R|c|K",
1915         irn_flags  => "R",
1916         reg_req   => { },
1917         emit      => '. fldln2',
1918         attr_type => "ia32_x87_attr_t",
1919 },
1920
1921 fldlg2 => {
1922         op_flags  => "R|c|K",
1923         irn_flags  => "R",
1924         reg_req   => { },
1925         emit      => '. fldlg2',
1926         attr_type => "ia32_x87_attr_t",
1927 },
1928
1929 fldl2t => {
1930         op_flags  => "R|c|K",
1931         irn_flags  => "R",
1932         reg_req   => { },
1933         emit      => '. fldll2t',
1934         attr_type => "ia32_x87_attr_t",
1935 },
1936
1937 fldl2e => {
1938         op_flags  => "R|c|K",
1939         irn_flags  => "R",
1940         reg_req   => { },
1941         emit      => '. fldl2e',
1942         attr_type => "ia32_x87_attr_t",
1943 },
1944
1945 # fxch, fpush, fpop
1946 # Note that it is NEVER allowed to do CSE on these nodes
1947 # Moreover, note the virtual register requierements!
1948
1949 fxch => {
1950         op_flags  => "R|K",
1951         reg_req   => { },
1952         cmp_attr  => "return 1;",
1953         emit      => '. fxch %X0',
1954         attr_type => "ia32_x87_attr_t",
1955 },
1956
1957 fpush => {
1958         op_flags  => "R|K",
1959         reg_req   => {},
1960         cmp_attr  => "return 1;",
1961         emit      => '. fld %X0',
1962         attr_type => "ia32_x87_attr_t",
1963 },
1964
1965 fpushCopy => {
1966         op_flags  => "R",
1967         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1968         cmp_attr  => "return 1;",
1969         emit      => '. fld %X0',
1970         attr_type => "ia32_x87_attr_t",
1971 },
1972
1973 fpop => {
1974         op_flags  => "R|K",
1975         reg_req   => { },
1976         cmp_attr  => "return 1;",
1977         emit      => '. fstp %X0',
1978         attr_type => "ia32_x87_attr_t",
1979 },
1980
1981 # compare
1982
1983 fcomJmp => {
1984         op_flags  => "L|X|Y",
1985         reg_req   => { },
1986         attr_type => "ia32_x87_attr_t",
1987 },
1988
1989 fcompJmp => {
1990         op_flags  => "L|X|Y",
1991         reg_req   => { },
1992         attr_type => "ia32_x87_attr_t",
1993 },
1994
1995 fcomppJmp => {
1996         op_flags  => "L|X|Y",
1997         reg_req   => { },
1998         attr_type => "ia32_x87_attr_t",
1999 },
2000
2001 fcomrJmp => {
2002         op_flags  => "L|X|Y",
2003         reg_req   => { },
2004         attr_type => "ia32_x87_attr_t",
2005 },
2006
2007 fcomrpJmp => {
2008         op_flags  => "L|X|Y",
2009         reg_req   => { },
2010         attr_type => "ia32_x87_attr_t",
2011 },
2012
2013 fcomrppJmp => {
2014         op_flags  => "L|X|Y",
2015         reg_req   => { },
2016         attr_type => "ia32_x87_attr_t",
2017 },
2018
2019
2020 # -------------------------------------------------------------------------------- #
2021 #  ____ ____  _____                  _                               _             #
2022 # / ___/ ___|| ____| __   _____  ___| |_ ___  _ __   _ __   ___   __| | ___  ___   #
2023 # \___ \___ \|  _|   \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __|  #
2024 #  ___) |__) | |___   \ V /  __/ (__| || (_) | |    | | | | (_) | (_| |  __/\__ \  #
2025 # |____/____/|_____|   \_/ \___|\___|\__\___/|_|    |_| |_|\___/ \__,_|\___||___/  #
2026 #                                                                                  #
2027 # -------------------------------------------------------------------------------- #
2028
2029
2030 # Spilling and reloading of SSE registers, hardcoded, not generated #
2031
2032 xxLoad => {
2033         op_flags  => "L|F",
2034         state     => "exc_pinned",
2035         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2036         emit      => '. movdqu %D0, %AM',
2037         outs      => [ "res", "M" ],
2038         units     => [ "SSE" ],
2039 },
2040
2041 xxStore => {
2042         op_flags => "L|F",
2043         state    => "exc_pinned",
2044         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
2045         emit     => '. movdqu %binop',
2046         units    => [ "SSE" ],
2047         mode     => "mode_M",
2048 },
2049
2050 ); # end of %nodes
2051
2052 # Include the generated SIMD node specification written by the SIMD optimization
2053 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2054 unless ($return = do $my_script_name) {
2055         warn "couldn't parse $my_script_name: $@" if $@;
2056         warn "couldn't do $my_script_name: $!"    unless defined $return;
2057         warn "couldn't run $my_script_name"       unless $return;
2058 }