ia32_spec.pl 37.1 KB
Newer Older
1
2
3
4
5
6
7
# Creation: 2005/10/19
# $Id$
# This is the specification for the ia32 assembler Firm-operations

# the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
$arch = "ia32";

Christian Würdig's avatar
Christian Würdig committed
8
# this string marks the beginning of a comment in emit
9
$comment_string = "/*";
Christian Würdig's avatar
Christian Würdig committed
10

11
# the number of additional opcodes you want to register
12
#$additional_opcodes = 0;
13

14
15
16
17
18
19
# The node description is done as a perl hash initializer with the
# following structure:
#
# %nodes = (
#
# <op-name> => {
20
21
#   "op_flags"  => "N|L|C|X|I|F|Y|H|c|K",
#   "irn_flags" => "R|N|I"
Christian Würdig's avatar
Christian Würdig committed
22
23
#   "arity"     => "0|1|2|3 ... |variable|dynamic|any",
#   "state"     => "floats|pinned|mem_pinned|exc_pinned",
24
25
26
27
28
29
#   "args"      => [
#                    { "type" => "type 1", "name" => "name 1" },
#                    { "type" => "type 2", "name" => "name 2" },
#                    ...
#                  ],
#   "comment"   => "any comment for constructor",
30
31
#   "reg_req"   => { "in" => [ "reg_class|register" ], "out" => [ "reg_class|register|in_rX" ] },
#   "cmp_attr"  => "c source code for comparing node attributes",
32
#   "emit"      => "emit code with templates",
33
34
#   "attr"      => "attitional attribute arguments for constructor"
#   "init_attr" => "emit attribute initialization template"
Christian Würdig's avatar
Christian Würdig committed
35
#   "rd_constructor" => "c source code which constructs an ir_node"
36
37
38
39
40
41
# },
#
# ... # (all nodes you need to describe)
#
# ); # close the %nodes initializer

42
# op_flags: flags for the operation, OPTIONAL (default is "N")
43
44
45
46
47
48
49
50
51
52
# the op_flags correspond to the firm irop_flags:
#   N   irop_flag_none
#   L   irop_flag_labeled
#   C   irop_flag_commutative
#   X   irop_flag_cfopcode
#   I   irop_flag_ip_cfopcode
#   F   irop_flag_fragile
#   Y   irop_flag_forking
#   H   irop_flag_highlevel
#   c   irop_flag_constlike
Michael Beck's avatar
Michael Beck committed
53
#   K   irop_flag_keep
54
#
55
56
57
58
59
# irn_flags: special node flags, OPTIONAL (default is 0)
# following irn_flags are supported:
#   R   rematerializeable
#   N   not spillable
#   I   ignore for register allocation
Christian Würdig's avatar
Christian Würdig committed
60
#
Christian Würdig's avatar
Christian Würdig committed
61
# state: state of the operation, OPTIONAL (default is "floats")
Christian Würdig's avatar
Christian Würdig committed
62
63
64
65
#
# arity: arity of the operation, MUST NOT BE OMITTED
#
# args:  the OPTIONAL arguments of the node constructor (debug, irg and block
66
67
#        are always the first 3 arguments and are always autmatically
#        created)
Christian Würdig's avatar
Christian Würdig committed
68
#        If this key is missing the following arguments will be created:
69
70
#        for i = 1 .. arity: ir_node *op_i
#        ir_mode *mode
Christian Würdig's avatar
Christian Würdig committed
71
72
73
#
# comment: OPTIONAL comment for the node constructor
#
74
75
76
77
78
# rd_constructor: for every operation there will be a
#      new_rd_<arch>_<op-name> function with the arguments from above
#      which creates the ir_node corresponding to the defined operation
#      you can either put the complete source code of this function here
#
Christian Würdig's avatar
Christian Würdig committed
79
80
#      This key is OPTIONAL. If omitted, the following constructor will
#      be created:
81
82
83
84
#      if (!op_<arch>_<op-name>) assert(0);
#      for i = 1 to arity
#         set in[i] = op_i
#      done
Christian Würdig's avatar
Christian Würdig committed
85
#      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
86
87
#      return res
#
Christian Würdig's avatar
Christian Würdig committed
88
# NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
89

Christian Würdig's avatar
Christian Würdig committed
90
91
# register types:
#   0 - no special type
92
93
#   1 - caller save (register must be saved by the caller of a function)
#   2 - callee save (register must be saved by the called function)
Christian Würdig's avatar
Christian Würdig committed
94
#   4 - ignore (do not assign this register)
Christian Würdig's avatar
Christian Würdig committed
95
# NOTE: Last entry of each class is the largest Firm-Mode a register can hold
96
%reg_classes = (
97
  "gp" => [
98
99
100
101
102
103
104
            { "name" => "eax", "type" => 1 },
            { "name" => "edx", "type" => 1 },
            { "name" => "ebx", "type" => 2 },
            { "name" => "ecx", "type" => 1 },
            { "name" => "esi", "type" => 2 },
            { "name" => "edi", "type" => 2 },
            { "name" => "ebp", "type" => 2 },
Christian Würdig's avatar
Christian Würdig committed
105
            { "name" => "esp", "type" => 4 },
106
            { "name" => "gp_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
107
			{ "mode" => "mode_P" }
108
          ],
109
  "xmm" => [
110
111
112
113
114
115
116
117
            { "name" => "xmm0", "type" => 1 },
            { "name" => "xmm1", "type" => 1 },
            { "name" => "xmm2", "type" => 1 },
            { "name" => "xmm3", "type" => 1 },
            { "name" => "xmm4", "type" => 1 },
            { "name" => "xmm5", "type" => 1 },
            { "name" => "xmm6", "type" => 1 },
            { "name" => "xmm7", "type" => 1 },
118
            { "name" => "xmm_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
119
			{ "mode" => "mode_D" }
120
121
122
123
124
125
126
127
128
          ],
  "vfp" => [
            { "name" => "vf0", "type" => 1 },
            { "name" => "vf1", "type" => 1 },
            { "name" => "vf2", "type" => 1 },
            { "name" => "vf3", "type" => 1 },
            { "name" => "vf4", "type" => 1 },
            { "name" => "vf5", "type" => 1 },
            { "name" => "vf6", "type" => 1 },
129
            { "name" => "vf7", "type" => 1 },
130
131
132
133
134
135
136
137
138
139
140
141
142
143
            { "name" => "vfp_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
			{ "mode" => "mode_E" }
          ],
  "st" => [
            { "name" => "st0", "type" => 1 },
            { "name" => "st1", "type" => 1 },
            { "name" => "st2", "type" => 1 },
            { "name" => "st3", "type" => 1 },
            { "name" => "st4", "type" => 1 },
            { "name" => "st5", "type" => 1 },
            { "name" => "st6", "type" => 1 },
            { "name" => "st7", "type" => 1 },
            { "name" => "st_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
			{ "mode" => "mode_E" }
144
          ]
145
146
); # %reg_classes

147
148
149
150
151
152
153
154
155
156
157
158
159
#--------------------------------------------------#
#                        _                         #
#                       (_)                        #
#  _ __   _____      __  _ _ __    ___  _ __  ___  #
# | '_ \ / _ \ \ /\ / / | | '__|  / _ \| '_ \/ __| #
# | | | |  __/\ V  V /  | | |    | (_) | |_) \__ \ #
# |_| |_|\___| \_/\_/   |_|_|     \___/| .__/|___/ #
#                                      | |         #
#                                      |_|         #
#--------------------------------------------------#

%nodes = (

Christian Würdig's avatar
Christian Würdig committed
160
161
162
163
164
165
166
167
168
169
#-----------------------------------------------------------------#
#  _       _                                         _            #
# (_)     | |                                       | |           #
#  _ _ __ | |_ ___  __ _  ___ _ __   _ __   ___   __| | ___  ___  #
# | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
# | | | | | ||  __/ (_| |  __/ |    | | | | (_) | (_| |  __/\__ \ #
# |_|_| |_|\__\___|\__, |\___|_|    |_| |_|\___/ \__,_|\___||___/ #
#                   __/ |                                         #
#                  |___/                                          #
#-----------------------------------------------------------------#
Christian Würdig's avatar
Christian Würdig committed
170

171
172
# commutative operations

173
174
175
176
177
178
179
# NOTE:
# All nodes supporting Addressmode have 5 INs:
# 1 - base    r1 == NoReg in case of no AM or no base
# 2 - index   r2 == NoReg in case of no AM or no index
# 3 - op1     r3 == always present
# 4 - op2     r4 == NoReg in case of immediate operation
# 5 - mem     NoMem in case of no AM otherwise it takes the mem from the Load
180

181
182
183
"Add" => {
  "irn_flags" => "R",
  "comment"   => "construct Add: Add(a, b) = Add(b, a) = a + b",
Christian Würdig's avatar
Christian Würdig committed
184
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
185
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
Christian Würdig's avatar
cleanup    
Christian Würdig committed
186
  "emit"      => '. add %ia32_emit_binop /* Add(%A1, %A2) -> %D1 */',
187
188
189
},

"Mul" => {
190
191
  "irn_flags" => "A",
  "comment"   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
Christian Würdig's avatar
Christian Würdig committed
192
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
193
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
194
  "emit"      => '. imul %ia32_emit_binop /* Mul(%A1, %A2) -> %D1 */'
195
196
},

197
198
199
# Mulh is an exception from the 4 INs with AM because the target is always EAX:EDX
"Mulh" => {
  "comment"   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
Christian Würdig's avatar
Christian Würdig committed
200
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
201
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "eax in_r3", "edx in_r4" ] },
Christian Würdig's avatar
Christian Würdig committed
202
  "emit"      => '. imul %ia32_emit_binop /* Mulh(%A1, %A2) -> %D1 */'
203
204
},

205
"And" => {
206
207
  "irn_flags" => "R",
  "comment"   => "construct And: And(a, b) = And(b, a) = a AND b",
Christian Würdig's avatar
Christian Würdig committed
208
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
209
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
210
  "emit"      => '. and %ia32_emit_binop /* And(%A1, %A2) -> %D1 */'
211
212
213
},

"Or" => {
214
215
  "irn_flags" => "R",
  "comment"   => "construct Or: Or(a, b) = Or(b, a) = a OR b",
Christian Würdig's avatar
Christian Würdig committed
216
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
217
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
218
  "emit"      => '. or %ia32_emit_binop /* Or(%A1, %A2) -> %D1 */'
219
220
221
},

"Eor" => {
222
223
  "irn_flags" => "R",
  "comment"   => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b",
Christian Würdig's avatar
Christian Würdig committed
224
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
225
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
226
  "emit"      => '. xor %ia32_emit_binop /* Xor(%A1, %A2) -> %D1 */'
227
228
229
},

"Max" => {
230
231
232
233
  "irn_flags" => "R",
  "comment"   => "construct Max: Max(a, b) = Max(b, a) = a > b ? a : b",
  "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
  "emit"      =>
234
'2. cmp %S1, %S2 /* prepare Max (%S1 - %S2), (%A1, %A2) */
235
  if (mode_is_signed(get_irn_mode(n))) {
236
4.  cmovl %D1, %S2 /* %S1 is less %S2 */
237
238
  }
  else {
239
4.  cmovb %D1, %S2 /* %S1 is below %S2 */
240
241
  }
'
242
243
244
},

"Min" => {
245
246
247
248
  "irn_flags" => "R",
  "comment"   => "construct Min: Min(a, b) = Min(b, a) = a < b ? a : b",
  "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
  "emit"      =>
249
'2. cmp %S1, %S2 /* prepare Min (%S1 - %S2), (%A1, %A2) */
250
  if (mode_is_signed(get_irn_mode(n))) {
251
2.  cmovg %D1, %S2 /* %S1 is greater %S2 */
252
253
  }
  else {
254
2.  cmova %D1, %S2, %D1 /* %S1 is above %S2 */
255
256
  }
'
257
258
},

259
260
261
"CMov" => {
  "irn_flags" => "R",
  "comment"   => "construct Mux: Mux(sel, a, b) == sel ? a : b",
262
  "reg_req"   => { "in" => [ "gp", "gp", "gp" ], "out" => [ "in_r2" ] },
263
  "emit"      =>
264
265
'. cmp %S1, 0 /* compare Sel for CMov (%A2, %A3) */
. cmovne %D1, %S3 /* sel == true -> return %S3 */
266
267
268
'
},

269
270
271
# not commutative operations

"Sub" => {
272
273
  "irn_flags" => "R",
  "comment"   => "construct Sub: Sub(a, b) = a - b",
Christian Würdig's avatar
Christian Würdig committed
274
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
275
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
276
  "emit"      => '. sub %ia32_emit_binop /* Sub(%A1, %A2) -> %D1 */'
277
278
},

279
"DivMod" => {
280
281
282
283
  "op_flags" => "F|L",
  "state"    => "exc_pinned",
  "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "eax in_r1", "edx in_r3" ] },
  "emit"     =>
284
'  if (mode_is_signed(get_irn_mode(n))) {
285
4.  idiv %S2 /* signed DivMod(%S1, %S2) -> %D1, (%A1, %A2, %A3) */
286
287
  }
  else {
288
4.  div %S2 /* unsigned DivMod(%S1, %S2) -> %D1, (%A1, %A2, %A3) */
289
  }
Christian Würdig's avatar
Christian Würdig committed
290
'
291
292
293
},

"Shl" => {
294
295
  "irn_flags" => "R",
  "comment"   => "construct Shl: Shl(a, b) = a << b",
Christian Würdig's avatar
Christian Würdig committed
296
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
297
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
298
  "emit"      => '. shl %ia32_emit_binop /* Shl(%A1, %A2) -> %D1 */'
299
300
301
},

"Shr" => {
302
303
  "irn_flags" => "R",
  "comment"   => "construct Shr: Shr(a, b) = a >> b",
Christian Würdig's avatar
Christian Würdig committed
304
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
305
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
306
  "emit"      => '. shr %ia32_emit_binop /* Shr(%A1, %A2) -> %D1 */'
307
308
309
},

"Shrs" => {
310
311
  "irn_flags" => "R",
  "comment"   => "construct Shrs: Shrs(a, b) = a >> b",
Christian Würdig's avatar
Christian Würdig committed
312
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
313
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
314
  "emit"      => '. sar %ia32_emit_binop /* Shrs(%A1, %A2) -> %D1 */'
315
316
317
},

"RotR" => {
318
  "irn_flags" => "R",
319
  "comment"     => "construct RotR: RotR(a, b) = a ROTR b",
Christian Würdig's avatar
Christian Würdig committed
320
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
321
  "reg_req"     => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
322
  "emit"        => '. ror %ia32_emit_binop /* RotR(%A1, %A2) -> %D1 */'
323
324
},

325
"RotL" => {
326
327
  "irn_flags" => "R",
  "comment"   => "construct RotL: RotL(a, b) = a ROTL b",
Christian Würdig's avatar
Christian Würdig committed
328
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
329
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
330
  "emit"      => '. rol %ia32_emit_binop /* RotL(%A1, %A2) -> %D1 */'
331
332
},

333
# unary operations
Christian Würdig's avatar
Christian Würdig committed
334

Christian Würdig's avatar
Christian Würdig committed
335
"Minus" => {
336
337
  "irn_flags" => "R",
  "comment"   => "construct Minus: Minus(a) = -a",
Christian Würdig's avatar
Christian Würdig committed
338
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
339
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
340
  "emit"      => '. neg %ia32_emit_unop /* Neg(%A1) -> %D1, (%A1) */'
Christian Würdig's avatar
Christian Würdig committed
341
342
343
},

"Inc" => {
344
345
  "irn_flags" => "R",
  "comment"   => "construct Increment: Inc(a) = a++",
Christian Würdig's avatar
Christian Würdig committed
346
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
347
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
348
  "emit"      => '. inc %ia32_emit_unop /* Inc(%S1) -> %D1, (%A1) */'
Christian Würdig's avatar
Christian Würdig committed
349
350
351
},

"Dec" => {
352
353
  "irn_flags" => "R",
  "comment"   => "construct Decrement: Dec(a) = a--",
Christian Würdig's avatar
Christian Würdig committed
354
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
355
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
356
  "emit"      => '. dec %ia32_emit_unop /* Dec(%S1) -> %D1, (%A1) */'
357
358
359
},

"Not" => {
360
361
  "irn_flags" => "R",
  "comment"   => "construct Not: Not(a) = !a",
Christian Würdig's avatar
Christian Würdig committed
362
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
363
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
364
  "emit"      => '. not %ia32_emit_unop /* Not(%S1) -> %D1, (%A1) */'
Christian Würdig's avatar
Christian Würdig committed
365
366
},

Christian Würdig's avatar
Christian Würdig committed
367
368
# other operations

Christian Würdig's avatar
Christian Würdig committed
369
"CondJmp" => {
370
  "op_flags"  => "L|X|Y",
371
  "comment"   => "construct conditional jump: CMP A, B && JMPxx LABEL",
Christian Würdig's avatar
Christian Würdig committed
372
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
373
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ] },
Christian Würdig's avatar
Christian Würdig committed
374
375
},

376
377
378
"TestJmp" => {
  "op_flags"  => "L|X|Y",
  "comment"   => "construct conditional jump: TEST A, B && JMPxx LABEL",
379
380
381
382
383
384
385
386
387
388
389
390
391
392
  "reg_req"  => { "in" => [ "gp", "gp" ] },
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
},

"CJmpAM" => {
  "op_flags"  => "L|X|Y",
  "comment"   => "construct conditional jump without CMP (replaces CondJmp): JMPxx LABEL",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "none", "none" ] },
},

"CJmp" => {
  "op_flags"  => "L|X|Y",
  "comment"   => "construct conditional jump without CMP (replaces TestJmp): JMPxx LABEL",
393
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
394
  "reg_req"   => { "in" => [ "gp", "gp" ] },
395
396
},

Christian Würdig's avatar
Christian Würdig committed
397
"SwitchJmp" => {
398
399
  "op_flags"  => "L|X|Y",
  "comment"   => "construct switch",
Christian Würdig's avatar
Christian Würdig committed
400
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
Christian Würdig's avatar
Christian Würdig committed
401
  "reg_req"   => { "in" => [ "gp" ], "out" => [ "none" ] },
402
403
404
},

"Const" => {
405
406
407
  "op_flags"  => "c",
  "irn_flags" => "R",
  "comment"   => "represents an integer constant",
Christian Würdig's avatar
Christian Würdig committed
408
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
409
  "reg_req"   => { "out" => [ "gp" ] },
410
411
  "emit"      =>
'  if (get_ia32_Immop_tarval(n) == get_tarval_null(get_irn_mode(n))) {
412
4.   sub %D1, %D1 /* optimized mov 0 to register */
413
414
  }
  else {
415
    if (get_ia32_op_type(n) == ia32_SymConst) {
416
6.    mov %D1, OFFSET FLAT:%C /* Move address of SymConst into register */
Christian Würdig's avatar
Christian Würdig committed
417
418
419
420
    }
	else {
6.    mov %D1, %C /* Mov Const into register */
	}
421
422
  }
',
423
424
},

425
426
427
428
"Cdq" => {
  "irn_flags" => "R",
  "comment"   => "construct CDQ: sign extend EAX -> EDX:EAX",
  "reg_req"   => { "in" => [ "gp" ], "out" => [ "eax in_r1", "edx" ] },
429
  "emit"      => '. cdq /* sign extend EAX -> EDX:EAX, (%A1) */'
430
431
},

Christian Würdig's avatar
Christian Würdig committed
432
433
434
# Load / Store

"Load" => {
435
436
437
438
  "op_flags"  => "L|F",
  "irn_flags" => "R",
  "state"     => "exc_pinned",
  "comment"   => "construct Load: Load(ptr, mem) = LD ptr -> reg",
Christian Würdig's avatar
Christian Würdig committed
439
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
440
  "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "gp" ] },
Christian Würdig's avatar
Christian Würdig committed
441
442
  "emit"      =>
'  if (get_mode_size_bits(get_ia32_ls_mode(n)) < 32) {
443
4.   mov%Mx %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */
Christian Würdig's avatar
Christian Würdig committed
444
445
  }
  else {
446
4.   mov %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */
Christian Würdig's avatar
Christian Würdig committed
447
448
  }
'
Christian Würdig's avatar
Christian Würdig committed
449
450
451
},

"Store" => {
452
453
454
  "op_flags"  => "L|F",
  "state"     => "exc_pinned",
  "comment"   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
Christian Würdig's avatar
Christian Würdig committed
455
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
456
  "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ] },
457
  "emit"      => '. mov %ia32_emit_binop /* Store(%A3) -> (%A1) */'
Christian Würdig's avatar
Christian Würdig committed
458
459
},

460
461
462
463
464
"Store8Bit" => {
  "op_flags"  => "L|F",
  "state"     => "exc_pinned",
  "comment"   => "construct 8Bit Store: Store(ptr, val, mem) = ST ptr,val",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
Christian Würdig's avatar
Christian Würdig committed
465
466
  "reg_req"   => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ] },
  "emit"      => '. mov %ia32_emit_binop /* Store(%A3) -> (%A1) */'
467
468
},

Christian Würdig's avatar
Christian Würdig committed
469
"Lea" => {
470
471
  "irn_flags" => "R",
  "comment"   => "construct Lea: Lea(a,b) = lea [a+b*const+offs] | res = a + b * const + offs with const = 0,1,2,4,8",
Christian Würdig's avatar
Christian Würdig committed
472
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
473
  "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
474
  "emit"      => '. lea %D1, %ia32_emit_am /* LEA(%A1, %A2) */'
Christian Würdig's avatar
Christian Würdig committed
475
476
},

477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
"Push" => {
  "comment"   => "push a gp register on the stack",
  "reg_req"   => { "in" => [ "esp", "gp", "none" ], "out" => [ "gp" ] },
  "emit"      => '. push %S2 /* Push(%A2) */'
},

"Pop" => {
  "comment"   => "pop a gp register from the stack",
  "reg_req"   => { "in" => [ "esp", "none" ], "out" => [ "gp", "esp" ] },
  "emit"      => '. pop %D1 /* Pop -> %D1 */'
},

"Enter" => {
  "comment"   => "create stack frame",
  "reg_req"   => { "in" => [ "esp" ], "out" => [ "ebp", "esp" ] },
  "emit"      => '. enter /* Enter */'
},

"Leave" => {
  "comment"   => "destroy stack frame",
  "reg_req"   => { "in" => [ "esp", "ebp" ], "out" => [ "esp" ] },
  "emit"      => '. leave /* Enter */'
},

Michael Beck's avatar
Michael Beck committed
501
502
503
504
505
506
507
508
#-----------------------------------------------------------------------------#
#   _____ _____ ______    __ _             _                     _            #
#  / ____/ ____|  ____|  / _| |           | |                   | |           #
# | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
#  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
#  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
# |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
#-----------------------------------------------------------------------------#
Christian Würdig's avatar
Christian Würdig committed
509
510
511
512

# commutative operations

"fAdd" => {
513
514
  "irn_flags" => "R",
  "comment"   => "construct SSE Add: Add(a, b) = Add(b, a) = a + b",
Christian Würdig's avatar
Christian Würdig committed
515
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
516
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
517
  "emit"      => '. adds%M %ia32_emit_binop /* SSE Add(%A3, %A4) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
518
519
520
},

"fMul" => {
521
522
  "irn_flags" => "R",
  "comment"   => "construct SSE Mul: Mul(a, b) = Mul(b, a) = a * b",
Christian Würdig's avatar
Christian Würdig committed
523
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
524
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
525
  "emit"      => '. muls%M %ia32_emit_binop /* SSE Mul(%A3, %A4) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
526
527
528
},

"fMax" => {
529
530
  "irn_flags" => "R",
  "comment"   => "construct SSE Max: Max(a, b) = Max(b, a) = a > b ? a : b",
Christian Würdig's avatar
Christian Würdig committed
531
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
532
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
533
  "emit"      => '. maxs%M %ia32_emit_binop /* SSE Max(%A3, %A4) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
534
535
536
},

"fMin" => {
537
538
  "irn_flags" => "R",
  "comment"   => "construct SSE Min: Min(a, b) = Min(b, a) = a < b ? a : b",
Christian Würdig's avatar
Christian Würdig committed
539
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
540
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
541
  "emit"      => '. mins%M %ia32_emit_binop /* SSE Min(%A3, %A4) -> %D1 */'
542
543
544
545
546
},

"fAnd" => {
  "irn_flags" => "R",
  "comment"   => "construct SSE And: And(a, b) = a AND b",
Christian Würdig's avatar
Christian Würdig committed
547
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
548
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
549
  "emit"      => '. andp%M %ia32_emit_binop /* SSE And(%A3, %A4) -> %D1 */'
550
551
552
553
554
},

"fOr" => {
  "irn_flags" => "R",
  "comment"   => "construct SSE Or: Or(a, b) = a OR b",
Christian Würdig's avatar
Christian Würdig committed
555
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
556
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
557
  "emit"      => '. orp%M %ia32_emit_binop /* SSE Or(%A3, %A4) -> %D1 */'
558
559
560
561
562
},

"fEor" => {
  "irn_flags" => "R",
  "comment"   => "construct SSE Eor: Eor(a, b) = a XOR b",
Christian Würdig's avatar
Christian Würdig committed
563
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
564
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
565
  "emit"      => '. xorp%M %ia32_emit_binop /* SSE Xor(%A3, %A4) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
566
567
568
569
570
},

# not commutative operations

"fSub" => {
571
572
  "irn_flags" => "R",
  "comment"   => "construct SSE Sub: Sub(a, b) = a - b",
Christian Würdig's avatar
Christian Würdig committed
573
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
574
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
575
  "emit"      => '. subs%M %ia32_emit_binop /* SSE Sub(%A1, %A2) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
576
577
578
},

"fDiv" => {
579
580
  "irn_flags" => "R",
  "comment"   => "construct SSE Div: Div(a, b) = a / b",
Christian Würdig's avatar
Christian Würdig committed
581
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
582
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3 !in_r4" ] },
583
  "emit"      => '. divs%M %ia32_emit_binop /* SSE Div(%A1, %A2) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
584
585
586
587
588
},

# other operations

"fCondJmp" => {
589
  "op_flags"  => "L|X|Y",
590
  "comment"   => "construct conditional jump: UCOMIS A, B && JMPxx LABEL",
Christian Würdig's avatar
Christian Würdig committed
591
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
592
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "none", "none" ] },
Christian Würdig's avatar
Christian Würdig committed
593
},
Christian Würdig's avatar
Christian Würdig committed
594

Christian Würdig's avatar
Christian Würdig committed
595
"fConst" => {
596
597
598
  "op_flags"  => "c",
  "irn_flags" => "R",
  "comment"   => "represents a SSE constant",
Christian Würdig's avatar
Christian Würdig committed
599
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
600
  "reg_req"   => { "out" => [ "xmm" ] },
601
  "emit"      => '. mov%M %D1, %C /* Load fConst into register */',
Christian Würdig's avatar
Christian Würdig committed
602
},
Christian Würdig's avatar
Christian Würdig committed
603

Christian Würdig's avatar
Christian Würdig committed
604
# Load / Store
Christian Würdig's avatar
Christian Würdig committed
605

Christian Würdig's avatar
Christian Würdig committed
606
"fLoad" => {
607
608
609
610
  "op_flags"  => "L|F",
  "irn_flags" => "R",
  "state"     => "exc_pinned",
  "comment"   => "construct SSE Load: Load(ptr, mem) = LD ptr",
Christian Würdig's avatar
Christian Würdig committed
611
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
612
  "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "xmm" ] },
613
  "emit"      => '. movs%M %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
614
},
Christian Würdig's avatar
Christian Würdig committed
615

Christian Würdig's avatar
Christian Würdig committed
616
617
618
619
"fStore" => {
  "op_flags" => "L|F",
  "state"    => "exc_pinned",
  "comment"  => "construct Store: Store(ptr, val, mem) = ST ptr,val",
Christian Würdig's avatar
Christian Würdig committed
620
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
621
  "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ] },
622
  "emit"     => '. movs%M %ia32_emit_binop /* Store(%S3) -> (%A1) */'
Christian Würdig's avatar
Christian Würdig committed
623
624
},

625
626
627
# CopyB

"CopyB" => {
Christian Würdig's avatar
Christian Würdig committed
628
629
630
631
  "op_flags" => "F|H",
  "state"    => "pinned",
  "comment"  => "implements a memcopy: CopyB(dst, src, size, mem) == memcpy(dst, src, size)",
  "reg_req"  => { "in" => [ "edi", "esi", "ecx", "none" ], "out" => [ "none" ] },
Christian Würdig's avatar
Christian Würdig committed
632
633
},

634
"CopyB_i" => {
Christian Würdig's avatar
Christian Würdig committed
635
636
637
638
639
  "op_flags" => "F|H",
  "state"    => "pinned",
  "comment"  => "implements a memcopy: CopyB(dst, src, mem) == memcpy(dst, src, attr(size))",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"  => { "in" => [ "edi", "esi", "none" ], "out" => [ "none" ] },
Christian Würdig's avatar
Christian Würdig committed
640
641
},

Christian Würdig's avatar
Christian Würdig committed
642
643
# Conversions

Christian Würdig's avatar
Christian Würdig committed
644
"Conv_I2I" => {
Christian Würdig's avatar
Christian Würdig committed
645
646
647
648
649
650
651
  "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3", "none" ] },
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "comment"  => "construct Conv Int -> Int"
},

"Conv_I2I8Bit" => {
  "reg_req"  => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ], "out" => [ "in_r3", "none" ] },
Christian Würdig's avatar
Christian Würdig committed
652
653
654
655
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "comment"  => "construct Conv Int -> Int"
},

Christian Würdig's avatar
Christian Würdig committed
656
"Conv_I2FP" => {
657
  "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "xmm", "none" ] },
658
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
Christian Würdig's avatar
Christian Würdig committed
659
660
661
662
  "comment"  => "construct Conv Int -> Floating Point"
},

"Conv_FP2I" => {
663
  "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "gp", "none" ] },
664
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
Christian Würdig's avatar
Christian Würdig committed
665
666
667
668
  "comment"  => "construct Conv Floating Point -> Int"
},

"Conv_FP2FP" => {
669
  "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "xmm", "none" ] },
670
671
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "comment"  => "construct Conv Floating Point -> Floating Point",
Christian Würdig's avatar
Christian Würdig committed
672
673
},

Michael Beck's avatar
Michael Beck committed
674
675
676
677
678
679
680
681
682
683
684
685
686
#----------------------------------------------------------#
#        _      _               _    __ _             _    #
#       (_)    | |             | |  / _| |           | |   #
# __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
# \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
#  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
#   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
#                 | |                                      #
#  _ __   ___   __| | ___  ___                             #
# | '_ \ / _ \ / _` |/ _ \/ __|                            #
# | | | | (_) | (_| |  __/\__ \                            #
# |_| |_|\___/ \__,_|\___||___/                            #
#----------------------------------------------------------#
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763

"vfadd" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Add: Add(a, b) = Add(b, a) = a + b",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
},

"vfmul" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Mul: Mul(a, b) = Mul(b, a) = a + b",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
},

"vfsub" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Sub: Sub(a, b) = a - b",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
},

"vfdiv" => {
  "comment"   => "virtual fp Div: Div(a, b) = a / b",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
},

"vfabs" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Abs: Abs(a) = |a|",
  "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
},

"vfchs" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Chs: Chs(a) = -a",
  "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
},

"vfsin" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Sin: Sin(a) = sin(a)",
  "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
},

"vfcos" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Cos: Cos(a) = cos(a)",
  "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
},

"vfsqrt" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Sqrt: Sqrt(a) = a ^ 0.5",
  "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
},

# virtual Load and Store

"vfld" => {
  "op_flags"  => "L|F",
  "irn_flags" => "R",
  "state"     => "exc_pinned",
  "comment"   => "virtual fp Load: Load(ptr, mem) = LD ptr -> reg",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "vfp" ] },
},

"vfst" => {
  "op_flags"  => "L|F",
  "state"     => "exc_pinned",
  "comment"   => "virtual fp Store: Store(ptr, val, mem) = ST ptr,val",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"   => { "in" => [ "gp", "gp", "vfp", "none" ] },
},

764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# Conversions

"vfild" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "vfp" ] },
},

"vfist" => {
  "comment"   => "virtual fp integer Store: Store(ptr, val, mem) = iST ptr,val",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"   => { "in" => [ "gp", "gp", "vfp", "none" ] },
},

779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
# constants

"vfldz" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Load 0.0: Ld 0.0 -> reg",
  "reg_req"   => { "out" => [ "vfp" ] },
},

"vfld1" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Load 1.0: Ld 1.0 -> reg",
  "reg_req"   => { "out" => [ "vfp" ] },
},

"vfldpi" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Load pi: Ld pi -> reg",
  "reg_req"   => { "out" => [ "vfp" ] },
},

"vfldln2" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Load ln 2: Ld ln 2 -> reg",
  "reg_req"   => { "out" => [ "vfp" ] },
},

"vfldlg2" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Load lg 2: Ld lg 2 -> reg",
  "reg_req"   => { "out" => [ "vfp" ] },
},

"vfldl2t" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Load ld 10: Ld ld 10 -> reg",
  "reg_req"   => { "out" => [ "vfp" ] },
},

"vfldl2e" => {
  "irn_flags" => "R",
  "comment"   => "virtual fp Load ld e: Ld ld e -> reg",
  "reg_req"   => { "out" => [ "vfp" ] },
},

"vfConst" => {
  "op_flags"  => "c",
  "irn_flags" => "R",
  "comment"   => "represents a virtual floating point constant",
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
  "reg_req"   => { "out" => [ "vfp" ] },
},

Michael Beck's avatar
Michael Beck committed
831
832
833
834
835
836
837
#------------------------------------------------------------------------#
#       ___ _____    __ _             _                     _            #
# __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
# \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
#  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
# /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
#------------------------------------------------------------------------#
838
839

"fadd" => {
840
  "op_flags"  => "R",
841
  "rd_constructor" => "NONE",
842
843
  "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
  "reg_req"   => { },
844
  "emit"      => '. fadd %ia32_emit_x87_binop /* x87 fadd(%A1, %A2) -> %D1 */'
845
846
847
},

"faddp" => {
848
  "op_flags"  => "R",
849
850
851
  "rd_constructor" => "NONE",
  "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
  "reg_req"   => { },
852
  "emit"      => '. faddp %ia32_emit_x87_binop /* x87 fadd(%A1, %A2) -> %D1 */'
853
854
855
},

"fmul" => {
856
  "op_flags"  => "R",
857
  "rd_constructor" => "NONE",
858
859
  "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
860
  "emit"      => '. fmul %ia32_emit_x87_binop /* x87 fmul(%A1, %A2) -> %D1 */'
861
862
863
},

"fmulp" => {
864
  "op_flags"  => "R",
865
866
867
  "rd_constructor" => "NONE",
  "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
868
  "emit"      => '. fmulp %ia32_emit_x87_binop /* x87 fmul(%A1, %A2) -> %D1 */'
869
870
871
},

"fsub" => {
872
  "op_flags"  => "R",
873
  "rd_constructor" => "NONE",
874
875
  "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
876
  "emit"      => '. fsub %ia32_emit_x87_binop /* x87 fsub(%A1, %A2) -> %D1 */'
877
878
879
},

"fsubp" => {
880
  "op_flags"  => "R",
881
882
883
  "rd_constructor" => "NONE",
  "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
884
  "emit"      => '. fsubp %ia32_emit_x87_binop /* x87 fsub(%A1, %A2) -> %D1 */'
885
886
887
},

"fsubr" => {
888
  "op_flags"  => "R",
889
  "rd_constructor" => "NONE",
890
891
892
  "irn_flags" => "R",
  "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
893
  "emit"      => '. fsubr %ia32_emit_x87_binop /* x87 fsubr(%A1, %A2) -> %D1 */'
894
895
896
},

"fsubrp" => {
897
  "op_flags"  => "R",
898
899
900
901
  "rd_constructor" => "NONE",
  "irn_flags" => "R",
  "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
902
  "emit"      => '. fsubrp %ia32_emit_x87_binop /* x87 fsubr(%A1, %A2) -> %D1 */'
903
904
905
},

"fdiv" => {
906
  "op_flags"  => "R",
907
  "rd_constructor" => "NONE",
908
909
  "comment"   => "x87 fp Div: Div(a, b) = a / b",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
910
  "emit"      => '. fdiv %ia32_emit_x87_binop /* x87 fdiv(%A1, %A2) -> %D1 */'
911
912
913
},

"fdivp" => {
914
  "op_flags"  => "R",
915
916
917
  "rd_constructor" => "NONE",
  "comment"   => "x87 fp Div: Div(a, b) = a / b",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
918
  "emit"      => '. fdivp %ia32_emit_x87_binop /* x87 fdiv(%A1, %A2) -> %D1 */'
919
920
921
},

"fdivr" => {
922
  "op_flags"  => "R",
923
  "rd_constructor" => "NONE",
924
925
  "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
926
  "emit"      => '. fdivr %ia32_emit_x87_binop /* x87 fdivr(%A1, %A2) -> %D1 */'
927
928
929
},

"fdivrp" => {
930
  "op_flags"  => "R",
931
932
933
  "rd_constructor" => "NONE",
  "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
934
  "emit"      => '. fdivrp %ia32_emit_x87_binop /* x87 fdivr(%A1, %A2) -> %D1 */'
935
936
937
},

"fabs" => {
938
  "op_flags"  => "R",
939
  "rd_constructor" => "NONE",
940
941
  "comment"   => "x87 fp Abs: Abs(a) = |a|",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
942
  "emit"      => '. fabs /* x87 fabs(%S1) -> %D1 */'
943
944
945
},

"fchs" => {
946
  "op_flags"  => "R",
947
  "rd_constructor" => "NONE",
948
949
  "comment"   => "x87 fp Chs: Chs(a) = -a",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
950
  "emit"      => '. fchs /* x87 fchs(%S1) -> %D1 */'
951
952
953
},

"fsin" => {
954
  "op_flags"  => "R",
955
  "rd_constructor" => "NONE",
956
957
  "comment"   => "x87 fp Sin: Sin(a) = sin(a)",
  "reg_req"   => { },
Michael Beck's avatar
Michael Beck committed
958
  "emit"      => '. fsin /* x87 sin(%S1) -> %D1 */'
959
960
961
},

"fcos" => {
962
  "op_flags"  => "R",