ia32_spec.pl 36 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
12
13
# the number of additional opcodes you want to register
$additional_opcodes = 0;

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" => [ "gp" ] },
474
  "emit"      => '. lea %D1, %ia32_emit_am /* LEA(%A1, %A2) */'
Christian Würdig's avatar
Christian Würdig committed
475
476
},

Christian Würdig's avatar
Christian Würdig committed
477
478
479
480
481
482
483
484
485
486
487
488
#--------------------------------------------------------#
#    __ _             _                     _            #
#   / _| |           | |                   | |           #
#  | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
#  |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
#  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
#  |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
#--------------------------------------------------------#

# commutative operations

"fAdd" => {
489
490
  "irn_flags" => "R",
  "comment"   => "construct SSE Add: Add(a, b) = Add(b, a) = a + b",
Christian Würdig's avatar
Christian Würdig committed
491
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
492
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
493
  "emit"      => '. adds%M %ia32_emit_binop /* SSE Add(%A3, %A4) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
494
495
496
},

"fMul" => {
497
498
  "irn_flags" => "R",
  "comment"   => "construct SSE Mul: Mul(a, b) = Mul(b, a) = a * b",
Christian Würdig's avatar
Christian Würdig committed
499
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
500
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
501
  "emit"      => '. muls%M %ia32_emit_binop /* SSE Mul(%A3, %A4) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
502
503
504
},

"fMax" => {
505
506
  "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
507
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
508
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
509
  "emit"      => '. maxs%M %ia32_emit_binop /* SSE Max(%A3, %A4) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
510
511
512
},

"fMin" => {
513
514
  "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
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"      => '. mins%M %ia32_emit_binop /* SSE Min(%A3, %A4) -> %D1 */'
518
519
520
521
522
},

"fAnd" => {
  "irn_flags" => "R",
  "comment"   => "construct SSE And: And(a, b) = a AND 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"      => '. andp%M %ia32_emit_binop /* SSE And(%A3, %A4) -> %D1 */'
526
527
528
529
530
},

"fOr" => {
  "irn_flags" => "R",
  "comment"   => "construct SSE Or: Or(a, b) = a OR 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"      => '. orp%M %ia32_emit_binop /* SSE Or(%A3, %A4) -> %D1 */'
534
535
536
537
538
},

"fEor" => {
  "irn_flags" => "R",
  "comment"   => "construct SSE Eor: Eor(a, b) = a XOR 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"      => '. xorp%M %ia32_emit_binop /* SSE Xor(%A3, %A4) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
542
543
544
545
546
},

# not commutative operations

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

"fDiv" => {
555
556
  "irn_flags" => "R",
  "comment"   => "construct SSE Div: Div(a, b) = a / b",
Christian Würdig's avatar
Christian Würdig committed
557
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
558
  "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3 !in_r4" ] },
559
  "emit"      => '. divs%M %ia32_emit_binop /* SSE Div(%A1, %A2) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
560
561
562
563
564
},

# other operations

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

Christian Würdig's avatar
Christian Würdig committed
571
"fConst" => {
572
573
574
  "op_flags"  => "c",
  "irn_flags" => "R",
  "comment"   => "represents a SSE constant",
Christian Würdig's avatar
Christian Würdig committed
575
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
576
  "reg_req"   => { "out" => [ "xmm" ] },
577
  "emit"      => '. mov%M %D1, %C /* Load fConst into register */',
Christian Würdig's avatar
Christian Würdig committed
578
},
Christian Würdig's avatar
Christian Würdig committed
579

Christian Würdig's avatar
Christian Würdig committed
580
# Load / Store
Christian Würdig's avatar
Christian Würdig committed
581

Christian Würdig's avatar
Christian Würdig committed
582
"fLoad" => {
583
584
585
586
  "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
587
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
588
  "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "xmm" ] },
589
  "emit"      => '. movs%M %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */'
Christian Würdig's avatar
Christian Würdig committed
590
},
Christian Würdig's avatar
Christian Würdig committed
591

Christian Würdig's avatar
Christian Würdig committed
592
593
594
595
"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
596
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
597
  "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ] },
598
  "emit"     => '. movs%M %ia32_emit_binop /* Store(%S3) -> (%A1) */'
Christian Würdig's avatar
Christian Würdig committed
599
600
},

601
602
603
# CopyB

"CopyB" => {
Christian Würdig's avatar
Christian Würdig committed
604
605
606
607
  "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
608
609
},

610
"CopyB_i" => {
Christian Würdig's avatar
Christian Würdig committed
611
612
613
614
615
  "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
616
617
},

Christian Würdig's avatar
Christian Würdig committed
618
619
# Conversions

Christian Würdig's avatar
Christian Würdig committed
620
"Conv_I2I" => {
Christian Würdig's avatar
Christian Würdig committed
621
622
623
624
625
626
627
  "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
628
629
630
631
  "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
632
"Conv_I2FP" => {
633
  "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "xmm", "none" ] },
634
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
Christian Würdig's avatar
Christian Würdig committed
635
636
637
638
  "comment"  => "construct Conv Int -> Floating Point"
},

"Conv_FP2I" => {
639
  "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "gp", "none" ] },
640
  "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
Christian Würdig's avatar
Christian Würdig committed
641
642
643
644
  "comment"  => "construct Conv Floating Point -> Int"
},

"Conv_FP2FP" => {
645
  "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "xmm", "none" ] },
646
647
  "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
648
649
},

650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
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
#--------------------------------------------------------#
#    __ _             _                     _            #
#   / _| |           | |                   | |           #
#  | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
#  |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
#  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
#  |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
#--------------------------------------------------------#

# virtual float nodes

"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" ] },
},

737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
# 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" ] },
},

752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
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
# 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" ] },
},

#--------------------------------------------------------#
#    __ _             _                     _            #
#   / _| |           | |                   | |           #
#  | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
#  |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
#  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
#  |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
#--------------------------------------------------------#

# x87 float nodes

"fadd" => {
816
  "rd_constructor" => "NONE",
817
818
819
  "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
  "reg_req"   => { },
#  "emit"      => '. fadd %ia32_emit_binop /* x87 fadd(%A1, %A2) -> %D1 */'
820
821
822
823
824
825
826
827
828
  "emit"      => '. fadd %X1, %X2 /* x87 fadd(%X1, %X2) -> %X3 */'
},

"faddp" => {
  "rd_constructor" => "NONE",
  "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
  "reg_req"   => { },
#  "emit"      => '. faddp %ia32_emit_binop /* x87 fadd(%A1, %A2) -> %D1 */'
  "emit"      => '. faddp %X1, %X2 /* x87 fadd(%X1, %X2) -> %X3 and pop */'
829
830
831
},

"fmul" => {
832
  "rd_constructor" => "NONE",
833
834
835
  "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
  "reg_req"   => { },
#  "emit"      => '. fmul %ia32_emit_binop /* x87 fmul(%A1, %A2) -> %D1 */'
836
837
838
839
840
841
842
843
844
  "emit"      => '. fmul %X1, %X2 /* x87 fmul(%X1, %X2) -> %X3 */'
},

"fmulp" => {
  "rd_constructor" => "NONE",
  "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
  "reg_req"   => { },
#  "emit"      => '. fmulp %ia32_emit_binop /* x87 fmul(%A1, %A2) -> %D1 */'
  "emit"      => '. fmulp %X1, %X2 /* x87 fmul(%X1, %X2) -> %X3 and pop */'
845
846
847
},

"fsub" => {
848
  "rd_constructor" => "NONE",
849
850
  "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
  "reg_req"   => { },
851
852
853
854
855
856
857
858
859
860
#  "emit"      => '. fsub %ia32_emit_binop /* x87 fsub(%A1, %A2) -> %D1 */'
  "emit"      => '. fsub %X1, %X2 /* x87 fsub(%X1, %X2) -> %X3 */'
},

"fsubp" => {
  "rd_constructor" => "NONE",
  "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
  "reg_req"   => { },
#  "emit"      => '. fsubp %ia32_emit_binop /* x87 fsub(%A1, %A2) -> %D1 */'
  "emit"      => '. fsubp %X1, %X2 /* x87 fsub(%X1, %X2) -> %X3 and pop */'
861
862
863
},

"fsubr" => {
864
  "rd_constructor" => "NONE",
865
866
867
  "irn_flags" => "R",
  "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
  "reg_req"   => { },
868
869
870
871
872
873
874
875
876
877
878
#  "emit"      => '. fsubr %ia32_emit_binop /* x87 fsubr(%A1, %A2) -> %D1 */'
  "emit"      => '. fsubr %X1, %X2 /* x87 fsubr(%X1, %X2) -> %X3 */'
},

"fsubrp" => {
  "rd_constructor" => "NONE",
  "irn_flags" => "R",
  "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
  "reg_req"   => { },
#  "emit"      => '. fsubrp %ia32_emit_binop /* x87 fsubr(%A1, %A2) -> %D1 */'
  "emit"      => '. fsubrp %X1, %X2 /* x87 fsubr(%X1, %X2) -> %X3 and pop */'
879
880
881
},

"fdiv" => {
882
  "rd_constructor" => "NONE",
883
884
  "comment"   => "x87 fp Div: Div(a, b) = a / b",
  "reg_req"   => { },
885
886
887
888
889
890
891
892
893
894
#  "emit"      => '. fdiv %ia32_emit_binop /* x87 fdiv(%A1, %A2) -> %D1 */'
  "emit"      => '. fdiv %X1, %X2 /* x87 fdiv(%X1, %X2) -> %X3 */'
},

"fdivp" => {
  "rd_constructor" => "NONE",
  "comment"   => "x87 fp Div: Div(a, b) = a / b",
  "reg_req"   => { },
#  "emit"      => '. fdivp %ia32_emit_binop /* x87 fdiv(%A1, %A2) -> %D1 */'
  "emit"      => '. fdivp %X1, %X2 /* x87 fdiv(%X1, %X2) -> %X3 and pop */'
895
896
897
},

"fdivr" => {
898
  "rd_constructor" => "NONE",
899
900
  "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
  "reg_req"   => { },
901
902
903
904
905
906
907
908
909
910
#  "emit"      => '. fdivr %ia32_emit_binop /* x87 fdivr(%A1, %A2) -> %D1 */'
  "emit"      => '. fdivr %X1, %X2 /* x87 fdivr(%X1, %X2) -> %X3 */'
},

"fdivrp" => {
  "rd_constructor" => "NONE",
  "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
  "reg_req"   => { },
#  "emit"      => '. fdivrp %ia32_emit_binop /* x87 fdivr(%A1, %A2) -> %D1 */'
  "emit"      => '. fdivrp %X1, %X2 /* x87 fdivr(%X1, %X2) -> %X3 and pop */'
911
912
913
},

"fabs" => {
914
  "rd_constructor" => "NONE",
915
916
  "comment"   => "x87 fp Abs: Abs(a) = |a|",
  "reg_req"   => { },
917
  "emit"      => '. fabs %X1 /* x87 fabs(%X1) -> %X3 */'
918
919
920
},

"fchs" => {
921
  "rd_constructor" => "NONE",
922
923
  "comment"   => "x87 fp Chs: Chs(a) = -a",
  "reg_req"   => { },
924
  "emit"      => '. fchs %X1 /* x87 fchs(%X1) -> %X3 */'
925
926
927
},

"fsin" => {
928
  "rd_constructor" => "NONE",
929
930
  "comment"   => "x87 fp Sin: Sin(a) = sin(a)",
  "reg_req"   => { },
931
  "emit"      => '. fsin %X1 /* x87 sin(%X1) -> %X3 */'
932
933
934
},

"fcos" => {
935
  "rd_constructor" => "NONE",
936
937
  "comment"   => "x87 fp Cos: Cos(a) = cos(a)",
  "reg_req"   => { },
938
  "emit"      => '. fcos %X1 /* x87 cos(%X1) -> %X3 */'
939
940
941
},

"fsqrt" => {
942
  "rd_constructor" => "NONE",
943
944
  "comment"   => "x87 fp Sqrt: Sqrt(a) = a ^ 0.5",
  "reg_req"   => { },
945
  "emit"      => '. fsqrt %X1 $ /* x87 sqrt(%X1) -> %X3 */'
946
947
},

948
# x87 Load and Store
949
950

"fld" => {
951
  "rd_constructor" => "NONE",
952
953
954
955
  "op_flags"  => "L|F",
  "state"     => "exc_pinned",
  "comment"   => "x87 fp Load: Load(ptr, mem) = LD ptr -> reg",
  "reg_req"   => { },
956
  "emit"      => '. fld %X3, %ia32_emit_am /* Load((%A1)) -> %X3 */'
957
958
959
},

"fst" => {
960
  "rd_constructor" => "NONE",
961
962
963
964
  "op_flags"  => "L|F",
  "state"     => "exc_pinned",
  "comment"   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
  "reg_req"   => { },
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
  "emit"      => '. fst %ia32_emit_binop /* Store(%X3) -> (%A1) */'
},

"fstp" => {
  "rd_constructor" => "NONE",
  "op_flags"  => "L|F",
  "state"     => "exc_pinned",
  "comment"   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
  "reg_req"   => { },
  "emit"      => '. fstp %ia32_emit_binop /* Store(%X3) -> (%A1) and pop */'
},

# Conversions

"fild" => {
  "irn_flags" => "R",
  "comment"   => "x87 fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
  "reg_req"   => { },
  "emit"      => '. fild %X3, %ia32_emit_am /* integer Load((%A1)) -> %X3 */'
},

"fist" => {
  "rd_constructor" => "NONE",
  "comment"   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
  "reg_req"   => { },
  "emit"      => '. fist %ia32_emit_binop /* integer Store(%X3) -> (%A1) */'
},

"fistp" => {
  "rd_constructor" => "NONE",
  "comment"   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
  "reg_req"   => { },
  "emit"      => '. fistp %ia32_emit_binop /* integer Store(%X3) -> (%A1) and pop */'
998
999
1000
},

# constants
For faster browsing, not all history is shown. View entire blame