annotate graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java @ 21437:3c66c48a28f3

AMD64MacroAssembler#movlong: use sign-extend 32bit move if possible.
author Josef Eisl <josef.eisl@jku.at>
date Wed, 20 May 2015 16:30:05 +0200
parents 5a42f9b582c6
children 48c1ebd24120
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
19874
89c729e9e0a4 Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 18253
diff changeset
2 * Copyright (c) 2009, 2015, 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 */
6531
4afe23aa0a00 renamed packages: com.oracle.max.asm... -> com.oracle.graal.asm...
Doug Simon <doug.simon@oracle.com>
parents: 6497
diff changeset
23 package com.oracle.graal.asm.amd64;
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
24
6531
4afe23aa0a00 renamed packages: com.oracle.max.asm... -> com.oracle.graal.asm...
Doug Simon <doug.simon@oracle.com>
parents: 6497
diff changeset
25 import static com.oracle.graal.asm.amd64.AMD64AsmOptions.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26
6580
d56d600819fe moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6531
diff changeset
27 import com.oracle.graal.amd64.*;
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
28 import com.oracle.graal.api.code.*;
9756
d51f6d7fa6c4 Remove magic number in macro assembler.
Roland Schatz <roland.schatz@oracle.com>
parents: 9581
diff changeset
29 import com.oracle.graal.api.meta.*;
21437
3c66c48a28f3 AMD64MacroAssembler#movlong: use sign-extend 32bit move if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 20085
diff changeset
30 import com.oracle.graal.asm.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 * This class implements commonly used X86 code patterns.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 public class AMD64MacroAssembler extends AMD64Assembler {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
37 public AMD64MacroAssembler(TargetDescription target, RegisterConfig registerConfig) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 super(target, registerConfig);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
41 public final void decrementq(Register reg, int value) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42 if (value == Integer.MIN_VALUE) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 subq(reg, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 if (value < 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 incrementq(reg, -value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50 if (value == 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52 }
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
53 if (value == 1 && UseIncDec) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 decq(reg);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 subq(reg, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59
20085
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
60 public final void decrementq(AMD64Address dst, int value) {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
61 if (value == Integer.MIN_VALUE) {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
62 subq(dst, value);
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
63 return;
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
64 }
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
65 if (value < 0) {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
66 incrementq(dst, -value);
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
67 return;
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
68 }
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
69 if (value == 0) {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
70 return;
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
71 }
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
72 if (value == 1 && UseIncDec) {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
73 decq(dst);
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
74 } else {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
75 subq(dst, value);
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
76 }
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
77 }
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
78
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
79 public void incrementq(Register reg, int value) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80 if (value == Integer.MIN_VALUE) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 addq(reg, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84 if (value < 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 decrementq(reg, -value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 if (value == 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 }
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
91 if (value == 1 && UseIncDec) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 incq(reg);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 addq(reg, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97
20085
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
98 public final void incrementq(AMD64Address dst, int value) {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
99 if (value == Integer.MIN_VALUE) {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
100 addq(dst, value);
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
101 return;
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
102 }
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
103 if (value < 0) {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
104 decrementq(dst, -value);
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
105 return;
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
106 }
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
107 if (value == 0) {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
108 return;
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
109 }
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
110 if (value == 1 && UseIncDec) {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
111 incq(dst);
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
112 } else {
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
113 addq(dst, value);
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
114 }
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
115 }
5a42f9b582c6 AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents: 19874
diff changeset
116
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 14559
diff changeset
117 public final void movptr(Register dst, AMD64Address src) {
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 14559
diff changeset
118 movq(dst, src);
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 14559
diff changeset
119 }
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 14559
diff changeset
120
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 14559
diff changeset
121 public final void movptr(AMD64Address dst, Register src) {
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 14559
diff changeset
122 movq(dst, src);
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 14559
diff changeset
123 }
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 14559
diff changeset
124
7839
838293a77af7 Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 7822
diff changeset
125 public final void movptr(AMD64Address dst, int src) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
126 movslq(dst, src);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
127 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
128
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
129 public final void cmpptr(Register src1, Register src2) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130 cmpq(src1, src2);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132
7839
838293a77af7 Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 7822
diff changeset
133 public final void cmpptr(Register src1, AMD64Address src2) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
134 cmpq(src1, src2);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
135 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
137 public final void decrementl(Register reg, int value) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
138 if (value == Integer.MIN_VALUE) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
139 subl(reg, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
140 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142 if (value < 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143 incrementl(reg, -value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
144 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
145 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
146 if (value == 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
147 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
148 }
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
149 if (value == 1 && UseIncDec) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
150 decl(reg);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
151 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
152 subl(reg, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
153 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
154 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
155
7839
838293a77af7 Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 7822
diff changeset
156 public final void decrementl(AMD64Address dst, int value) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
157 if (value == Integer.MIN_VALUE) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
158 subl(dst, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
159 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
160 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
161 if (value < 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
162 incrementl(dst, -value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
163 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
164 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
165 if (value == 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
166 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
167 }
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
168 if (value == 1 && UseIncDec) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
169 decl(dst);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
170 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
171 subl(dst, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
174
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
175 public final void incrementl(Register reg, int value) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176 if (value == Integer.MIN_VALUE) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
177 addl(reg, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
179 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
180 if (value < 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 decrementl(reg, -value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
182 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
183 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
184 if (value == 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
185 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
186 }
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
187 if (value == 1 && UseIncDec) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
188 incl(reg);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
189 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
190 addl(reg, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
191 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
192 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
193
7839
838293a77af7 Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 7822
diff changeset
194 public final void incrementl(AMD64Address dst, int value) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
195 if (value == Integer.MIN_VALUE) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
196 addl(dst, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
197 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
198 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
199 if (value < 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
200 decrementl(dst, -value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
201 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
202 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
203 if (value == 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
204 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
205 }
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
206 if (value == 1 && UseIncDec) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
207 incl(dst);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
208 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
209 addl(dst, value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
210 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
211 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
212
13265
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
213 public void movflt(Register dst, Register src) {
18253
edb88f5425e6 switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents: 15456
diff changeset
214 assert dst.getRegisterCategory().equals(AMD64.XMM) && src.getRegisterCategory().equals(AMD64.XMM);
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
215 if (UseXmmRegToRegMoveAll) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
216 movaps(dst, src);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
217 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
218 movss(dst, src);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
219 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
220 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
221
13265
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
222 public void movflt(Register dst, AMD64Address src) {
18253
edb88f5425e6 switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents: 15456
diff changeset
223 assert dst.getRegisterCategory().equals(AMD64.XMM);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
224 movss(dst, src);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
226
13265
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
227 public void movflt(AMD64Address dst, Register src) {
18253
edb88f5425e6 switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents: 15456
diff changeset
228 assert src.getRegisterCategory().equals(AMD64.XMM);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
229 movss(dst, src);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
230 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
231
13265
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
232 public void movdbl(Register dst, Register src) {
18253
edb88f5425e6 switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents: 15456
diff changeset
233 assert dst.getRegisterCategory().equals(AMD64.XMM) && src.getRegisterCategory().equals(AMD64.XMM);
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
234 if (UseXmmRegToRegMoveAll) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
235 movapd(dst, src);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
236 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
237 movsd(dst, src);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
238 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
239 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240
13265
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
241 public void movdbl(Register dst, AMD64Address src) {
18253
edb88f5425e6 switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents: 15456
diff changeset
242 assert dst.getRegisterCategory().equals(AMD64.XMM);
6493
85c1b84f8fd9 moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents: 6329
diff changeset
243 if (UseXmmLoadAndClearUpper) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
244 movsd(dst, src);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
245 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
246 movlpd(dst, src);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
247 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
248 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
249
13265
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
250 public void movdbl(AMD64Address dst, Register src) {
18253
edb88f5425e6 switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents: 15456
diff changeset
251 assert src.getRegisterCategory().equals(AMD64.XMM);
13265
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
252 movsd(dst, src);
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
253 }
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
254
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
255 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6580
diff changeset
256 * Non-atomic write of a 64-bit constant to memory. Do not use if the address might be a
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6580
diff changeset
257 * volatile field!
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
258 */
7839
838293a77af7 Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 7822
diff changeset
259 public final void movlong(AMD64Address dst, long src) {
21437
3c66c48a28f3 AMD64MacroAssembler#movlong: use sign-extend 32bit move if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 20085
diff changeset
260 if (NumUtil.isInt(src)) {
3c66c48a28f3 AMD64MacroAssembler#movlong: use sign-extend 32bit move if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 20085
diff changeset
261 AMD64MIOp.MOV.emit(this, OperandSize.QWORD, dst, (int) src);
3c66c48a28f3 AMD64MacroAssembler#movlong: use sign-extend 32bit move if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 20085
diff changeset
262 } else {
3c66c48a28f3 AMD64MacroAssembler#movlong: use sign-extend 32bit move if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 20085
diff changeset
263 AMD64Address high = new AMD64Address(dst.getBase(), dst.getIndex(), dst.getScale(), dst.getDisplacement() + 4);
3c66c48a28f3 AMD64MacroAssembler#movlong: use sign-extend 32bit move if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 20085
diff changeset
264 movl(dst, (int) (src & 0xFFFFFFFF));
3c66c48a28f3 AMD64MacroAssembler#movlong: use sign-extend 32bit move if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 20085
diff changeset
265 movl(high, (int) (src >> 32));
3c66c48a28f3 AMD64MacroAssembler#movlong: use sign-extend 32bit move if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 20085
diff changeset
266 }
3c66c48a28f3 AMD64MacroAssembler#movlong: use sign-extend 32bit move if possible.
Josef Eisl <josef.eisl@jku.at>
parents: 20085
diff changeset
267
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
268 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
269
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
270 public final void flog(Register dest, Register value, boolean base10) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
271 if (base10) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
272 fldlg2();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
273 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
274 fldln2();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
275 }
9581
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
276 AMD64Address tmp = trigPrologue(value);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
277 fyl2x();
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
278 trigEpilogue(dest, tmp);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
279 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
280
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
281 public final void fsin(Register dest, Register value) {
7839
838293a77af7 Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 7822
diff changeset
282 AMD64Address tmp = trigPrologue(value);
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
283 fsin();
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
284 trigEpilogue(dest, tmp);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
285 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
286
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
287 public final void fcos(Register dest, Register value) {
7839
838293a77af7 Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 7822
diff changeset
288 AMD64Address tmp = trigPrologue(value);
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
289 fcos();
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
290 trigEpilogue(dest, tmp);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
291 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
292
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
293 public final void ftan(Register dest, Register value) {
7839
838293a77af7 Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 7822
diff changeset
294 AMD64Address tmp = trigPrologue(value);
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
295 fptan();
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
296 fstp(0); // ftan pushes 1.0 in addition to the actual result, pop
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
297 trigEpilogue(dest, tmp);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
298 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
299
9581
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
300 public final void fpop() {
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
301 ffree(0);
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
302 fincstp();
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
303 }
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9425
diff changeset
304
7839
838293a77af7 Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 7822
diff changeset
305 private AMD64Address trigPrologue(Register value) {
18253
edb88f5425e6 switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents: 15456
diff changeset
306 assert value.getRegisterCategory().equals(AMD64.XMM);
8167
7f57c30575c8 Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
307 AMD64Address tmp = new AMD64Address(AMD64.rsp);
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13587
diff changeset
308 subq(AMD64.rsp, target.getSizeInBytes(Kind.Double));
13265
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
309 movdbl(tmp, value);
10513
00b70a864d3b updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents: 9756
diff changeset
310 fldd(tmp);
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
311 return tmp;
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
312 }
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
313
7839
838293a77af7 Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents: 7822
diff changeset
314 private void trigEpilogue(Register dest, AMD64Address tmp) {
18253
edb88f5425e6 switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents: 15456
diff changeset
315 assert dest.getRegisterCategory().equals(AMD64.XMM);
10513
00b70a864d3b updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents: 9756
diff changeset
316 fstpd(tmp);
13265
2d76d0c85345 Make selection of x86 floating point move instruction extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 10513
diff changeset
317 movdbl(dest, tmp);
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 13587
diff changeset
318 addq(AMD64.rsp, target.getSizeInBytes(Kind.Double));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
319 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
320
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
321 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6580
diff changeset
322 * Emit code to save a given set of callee save registers in the {@linkplain CalleeSaveLayout
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6580
diff changeset
323 * CSA} within the frame.
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 14559
diff changeset
324 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
325 * @param csl the description of the CSA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
326 * @param frameToCSA offset from the frame pointer to the CSA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
327 */
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
328 public final void save(CalleeSaveLayout csl, int frameToCSA) {
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
329 for (Register r : csl.registers) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
330 int offset = csl.offsetOf(r);
8167
7f57c30575c8 Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
331 movq(new AMD64Address(frameRegister, frameToCSA + offset), r);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
332 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
333 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
334
7822
03eec5b7a546 Clean up of AMD64MacroAssembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7791
diff changeset
335 public final void restore(CalleeSaveLayout csl, int frameToCSA) {
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
336 for (Register r : csl.registers) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
337 int offset = csl.offsetOf(r);
8167
7f57c30575c8 Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
338 movq(r, new AMD64Address(frameRegister, frameToCSA + offset));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
339 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
340 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
341 }