Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatSubNode.java @ 16919:0fe4732e5181
made use of generated Node classes predicated on value of graal.useGeneratedNodes system property (default is false)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 25 Aug 2014 13:45:12 +0200 |
parents | f90dcdbbb75e |
children | 5762848171e7 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
16215
b558af6ff4bc
don't pass stamps to arithmetic node constructors
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.nodes.calc; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5504
diff
changeset
|
25 import com.oracle.graal.api.meta.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
26 import com.oracle.graal.graph.*; |
11881
da9db8331658
moved Canonicalizable and Simplifiable to the com.oracle.graal.graph project (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11880
diff
changeset
|
27 import com.oracle.graal.graph.spi.*; |
15299
60406b8d6ad1
Move ArithmeticLIRGenerator to graal.lir (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15198
diff
changeset
|
28 import com.oracle.graal.lir.gen.*; |
16841
cbd42807a31f
moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
29 import com.oracle.graal.nodeinfo.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
30 import com.oracle.graal.nodes.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
31 import com.oracle.graal.nodes.spi.*; |
16217
561070049e73
implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16215
diff
changeset
|
32 import com.oracle.graal.nodes.util.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 @NodeInfo(shortName = "-") |
16811
5d468add216f
added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16783
diff
changeset
|
35 public class FloatSubNode extends FloatArithmeticNode { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
37 public static FloatSubNode create(ValueNode x, ValueNode y, boolean isStrictFP) { |
16919
0fe4732e5181
made use of generated Node classes predicated on value of graal.useGeneratedNodes system property (default is false)
Doug Simon <doug.simon@oracle.com>
parents:
16897
diff
changeset
|
38 return USE_GENERATED_NODES ? new FloatSubNodeGen(x, y, isStrictFP) : new FloatSubNode(x, y, isStrictFP); |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
39 } |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
40 |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
41 public static Class<? extends FloatSubNode> getGenClass() { |
16919
0fe4732e5181
made use of generated Node classes predicated on value of graal.useGeneratedNodes system property (default is false)
Doug Simon <doug.simon@oracle.com>
parents:
16897
diff
changeset
|
42 return USE_GENERATED_NODES ? FloatSubNodeGen.class : FloatSubNode.class; |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
43 } |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
44 |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
45 protected FloatSubNode(ValueNode x, ValueNode y, boolean isStrictFP) { |
16215
b558af6ff4bc
don't pass stamps to arithmetic node constructors
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
46 super(x.stamp().unrestricted(), x, y, isStrictFP); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 |
11851
04b039d82e86
Simplify constant folding.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
49 public Constant evalConst(Constant... inputs) { |
04b039d82e86
Simplify constant folding.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
50 assert inputs.length == 2; |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
11883
diff
changeset
|
51 assert inputs[0].getKind() == inputs[1].getKind(); |
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
11883
diff
changeset
|
52 if (inputs[0].getKind() == Kind.Float) { |
11859
ee88780346a4
Fix bug in constant folding.
Roland Schatz <roland.schatz@oracle.com>
parents:
11851
diff
changeset
|
53 return Constant.forFloat(inputs[0].asFloat() - inputs[1].asFloat()); |
11851
04b039d82e86
Simplify constant folding.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
54 } else { |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
11883
diff
changeset
|
55 assert inputs[0].getKind() == Kind.Double; |
11859
ee88780346a4
Fix bug in constant folding.
Roland Schatz <roland.schatz@oracle.com>
parents:
11851
diff
changeset
|
56 return Constant.forDouble(inputs[0].asDouble() - inputs[1].asDouble()); |
11851
04b039d82e86
Simplify constant folding.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
57 } |
04b039d82e86
Simplify constant folding.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
58 } |
04b039d82e86
Simplify constant folding.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
59 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 @Override |
16217
561070049e73
implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16215
diff
changeset
|
61 public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { |
561070049e73
implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16215
diff
changeset
|
62 if (GraphUtil.unproxify(forX) == GraphUtil.unproxify(forY)) { |
561070049e73
implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16215
diff
changeset
|
63 return ConstantNode.forFloatingStamp(stamp(), 0.0f); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 } |
16217
561070049e73
implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16215
diff
changeset
|
65 if (forX.isConstant() && forY.isConstant()) { |
561070049e73
implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16215
diff
changeset
|
66 return ConstantNode.forPrimitive(evalConst(forX.asConstant(), forY.asConstant())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 } |
16783
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
68 // Constant -0.0 is an additive identity, so (-0.0) - x == (-0.0) + (-x) == -x. |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
69 if (forX.isConstant()) { |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16895
diff
changeset
|
70 @SuppressWarnings("hiding") |
16783
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
71 Constant x = forX.asConstant(); |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
72 switch (x.getKind()) { |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
73 case Float: |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
74 if (Float.compare(x.asFloat(), -0.0f) == 0) { |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
75 return NegateNode.create(forY); |
16783
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
76 } |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
77 break; |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
78 case Double: |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
79 if (Double.compare(x.asDouble(), -0.0) == 0) { |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
80 return NegateNode.create(forY); |
16783
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
81 } |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
82 break; |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
83 default: |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
84 throw GraalGraphInternalError.shouldNotReachHere(); |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
85 } |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
86 } |
16501
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
87 // Constant -0.0 can't be eliminated since it can affect the sign of the result. |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
88 // Constant 0.0 is a subtractive identity. |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
89 if (forY.isConstant()) { |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16895
diff
changeset
|
90 @SuppressWarnings("hiding") |
16501
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
91 Constant y = forY.asConstant(); |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
92 switch (y.getKind()) { |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
93 case Float: |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
94 // use Float.compare because -0.0f == 0.0f |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
95 if (Float.compare(y.asFloat(), 0.0f) == 0) { |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
96 return forX; |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
97 } |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
98 break; |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
99 case Double: |
16510
b0ea5c266655
Fix typo in comment.
Roland Schatz <roland.schatz@oracle.com>
parents:
16501
diff
changeset
|
100 // use Double.compare because -0.0 == 0.0 |
16501
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
101 if (Double.compare(y.asDouble(), 0.0) == 0) { |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
102 return forX; |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
103 } |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
104 break; |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
105 default: |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
106 throw GraalGraphInternalError.shouldNotReachHere(); |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
107 } |
f0f4402a4f65
Canonicalize multiplication with 1.0 and addition with -0.0.
Roland Schatz <roland.schatz@oracle.com>
parents:
16217
diff
changeset
|
108 } |
16783
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
109 /* |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
110 * JVM spec, Chapter 6, dsub/fsub bytecode: For double subtraction, it is always the case |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
111 * that a-b produces the same result as a+(-b). |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
112 */ |
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
113 if (forY instanceof NegateNode) { |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
114 return FloatAddNode.create(forX, ((NegateNode) forY).getValue(), isStrictFP()); |
16783
c914e5837b4b
More canonicalizations in FloatAdd/SubNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
16510
diff
changeset
|
115 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
116 return this; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
117 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 @Override |
15130
ec22234bde0d
Pass more restricted interfaces to ArithmeticLIRLowerable and LocationNode in LIR generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
14950
diff
changeset
|
120 public void generate(NodeMappableLIRBuilder builder, ArithmeticLIRGenerator gen) { |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16169
diff
changeset
|
121 builder.setResult(this, gen.emitSub(builder.operand(getX()), builder.operand(getY()))); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 } |