Mercurial > hg > graal-compiler
annotate graal/com.oracle.jvmci.asm.amd64/src/com/oracle/jvmci/asm/amd64/AMD64Assembler.java @ 21708:6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 03 Jun 2015 18:06:44 +0200 |
parents | graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java@5024c80224c7 |
children |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
18841
f2f2897880c8
Avoid unnecessary register-register move before IMUL instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
18415
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 */ |
21708
6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
23 package com.oracle.jvmci.asm.amd64; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
21673
5024c80224c7
moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
25 import com.oracle.jvmci.amd64.*; |
5024c80224c7
moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
26 import com.oracle.jvmci.amd64.AMD64.*; |
21708
6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
27 import com.oracle.jvmci.asm.*; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21080
diff
changeset
|
28 import com.oracle.jvmci.code.Register; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21080
diff
changeset
|
29 import com.oracle.jvmci.code.TargetDescription; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21080
diff
changeset
|
30 import com.oracle.jvmci.code.RegisterConfig; |
21673
5024c80224c7
moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
31 |
5024c80224c7
moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
32 import static com.oracle.jvmci.amd64.AMD64.*; |
21708
6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
33 import static com.oracle.jvmci.asm.NumUtil.*; |
6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
34 import static com.oracle.jvmci.asm.amd64.AMD64AsmOptions.*; |
6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
35 import static com.oracle.jvmci.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.*; |
6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
36 import static com.oracle.jvmci.asm.amd64.AMD64Assembler.AMD64MOp.*; |
6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
37 import static com.oracle.jvmci.asm.amd64.AMD64Assembler.OperandSize.*; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21080
diff
changeset
|
38 import static com.oracle.jvmci.code.MemoryBarriers.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21080
diff
changeset
|
40 import com.oracle.jvmci.code.Register.RegisterCategory; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 * This class implements an assembler that can encode most X86 instructions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 */ |
14032
d1c1f103d42c
renamed com.oracle.graal.asm.AbstractAssembler to com.oracle.graal.asm.Assembler
twisti
parents:
14031
diff
changeset
|
45 public class AMD64Assembler extends Assembler { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
46 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 private static final int MinEncodingNeedsRex = 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 /** |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
50 * A sentinel value used as a place holder in an instruction stream for an address that will be |
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
51 * patched. |
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
52 */ |
8167
7f57c30575c8
Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents:
8141
diff
changeset
|
53 private static final AMD64Address Placeholder = new AMD64Address(rip); |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
54 |
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
55 /** |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 * The x86 condition codes used for conditional jumps/moves. |
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 public enum ConditionFlag { |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
59 Zero(0x4, "|zero|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
60 NotZero(0x5, "|nzero|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
61 Equal(0x4, "="), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
62 NotEqual(0x5, "!="), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
63 Less(0xc, "<"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
64 LessEqual(0xe, "<="), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
65 Greater(0xf, ">"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
66 GreaterEqual(0xd, ">="), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
67 Below(0x2, "|<|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
68 BelowEqual(0x6, "|<=|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
69 Above(0x7, "|>|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
70 AboveEqual(0x3, "|>=|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
71 Overflow(0x0, "|of|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
72 NoOverflow(0x1, "|nof|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
73 CarrySet(0x2, "|carry|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
74 CarryClear(0x3, "|ncarry|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
75 Negative(0x8, "|neg|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
76 Positive(0x9, "|pos|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
77 Parity(0xa, "|par|"), |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
78 NoParity(0xb, "|npar|"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
80 private final int value; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
81 private final String operator; |
5402
80127e4a1742
remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
82 |
80127e4a1742
remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
83 private ConditionFlag(int value, String operator) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 this.value = value; |
5402
80127e4a1742
remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
85 this.operator = operator; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
86 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 |
5402
80127e4a1742
remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
88 public ConditionFlag negate() { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
89 switch (this) { |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
90 case Zero: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
91 return NotZero; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
92 case NotZero: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
93 return Zero; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
94 case Equal: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
95 return NotEqual; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
96 case NotEqual: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
97 return Equal; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
98 case Less: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
99 return GreaterEqual; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
100 case LessEqual: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
101 return Greater; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
102 case Greater: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
103 return LessEqual; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
104 case GreaterEqual: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
105 return Less; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
106 case Below: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
107 return AboveEqual; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
108 case BelowEqual: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
109 return Above; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
110 case Above: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
111 return BelowEqual; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
112 case AboveEqual: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
113 return Below; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
114 case Overflow: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
115 return NoOverflow; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
116 case NoOverflow: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
117 return Overflow; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
118 case CarrySet: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
119 return CarryClear; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
120 case CarryClear: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
121 return CarrySet; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
122 case Negative: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
123 return Positive; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
124 case Positive: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
125 return Negative; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
126 case Parity: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
127 return NoParity; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
128 case NoParity: |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
129 return Parity; |
5402
80127e4a1742
remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
130 } |
80127e4a1742
remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
131 throw new IllegalArgumentException(); |
80127e4a1742
remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents:
5233
diff
changeset
|
132 } |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
133 |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
134 public int getValue() { |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
135 return value; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
136 } |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
137 |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
138 @Override |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
139 public String toString() { |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
140 return operator; |
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
141 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
142 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 * Constants for X86 prefix bytes. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
146 */ |
4249
1aaf3592e516
Fix some warnings from findbugs
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4209
diff
changeset
|
147 private static class Prefix { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
148 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
149 private static final int REX = 0x40; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
150 private static final int REXB = 0x41; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 private static final int REXX = 0x42; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 private static final int REXXB = 0x43; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 private static final int REXR = 0x44; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 private static final int REXRB = 0x45; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
155 private static final int REXRX = 0x46; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 private static final int REXRXB = 0x47; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 private static final int REXW = 0x48; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 private static final int REXWB = 0x49; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 private static final int REXWX = 0x4A; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
160 private static final int REXWXB = 0x4B; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
161 private static final int REXWR = 0x4C; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
162 private static final int REXWRB = 0x4D; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 private static final int REXWRX = 0x4E; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
164 private static final int REXWRXB = 0x4F; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
167 /** |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
168 * The x86 operand sizes. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
169 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
170 public static enum OperandSize { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
171 BYTE(1) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
172 @Override |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
173 protected void emitImmediate(AMD64Assembler asm, int imm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
174 assert imm == (byte) imm; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
175 asm.emitByte(imm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
176 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
177 }, |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
178 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
179 WORD(2, 0x66) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
180 @Override |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
181 protected void emitImmediate(AMD64Assembler asm, int imm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
182 assert imm == (short) imm; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
183 asm.emitShort(imm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
184 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
185 }, |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
186 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
187 DWORD(4) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
188 @Override |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
189 protected void emitImmediate(AMD64Assembler asm, int imm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
190 asm.emitInt(imm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
191 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
192 }, |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
193 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
194 QWORD(8) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
195 @Override |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
196 protected void emitImmediate(AMD64Assembler asm, int imm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
197 asm.emitInt(imm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
198 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
199 }, |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
200 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
201 SS(4, 0xF3, true), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
202 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
203 SD(8, 0xF2, true), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
204 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
205 PS(16, true), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
206 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
207 PD(16, 0x66, true); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
208 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
209 private final int sizePrefix; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
210 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
211 private final int bytes; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
212 private final boolean xmm; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
213 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
214 private OperandSize(int bytes) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
215 this(bytes, 0); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
216 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
217 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
218 private OperandSize(int bytes, int sizePrefix) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
219 this(bytes, sizePrefix, false); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
220 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
221 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
222 private OperandSize(int bytes, boolean xmm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
223 this(bytes, 0, xmm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
224 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
225 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
226 private OperandSize(int bytes, int sizePrefix, boolean xmm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
227 this.sizePrefix = sizePrefix; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
228 this.bytes = bytes; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
229 this.xmm = xmm; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
230 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
231 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
232 public int getBytes() { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
233 return bytes; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
234 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
235 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
236 public boolean isXmmType() { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
237 return xmm; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
238 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
239 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
240 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
241 * Emit an immediate of this size. Note that immediate {@link #QWORD} operands are encoded |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
242 * as sign-extended 32-bit values. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
243 * |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
244 * @param asm |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
245 * @param imm |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
246 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
247 protected void emitImmediate(AMD64Assembler asm, int imm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
248 assert false; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
249 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
250 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
251 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
252 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
253 * Operand size and register type constraints. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
254 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
255 private static enum OpAssertion { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
256 ByteAssertion(CPU, CPU, BYTE), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
257 IntegerAssertion(CPU, CPU, WORD, DWORD, QWORD), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
258 No16BitAssertion(CPU, CPU, DWORD, QWORD), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
259 QwordOnlyAssertion(CPU, CPU, QWORD), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
260 FloatingAssertion(XMM, XMM, SS, SD, PS, PD), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
261 PackedFloatingAssertion(XMM, XMM, PS, PD), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
262 SingleAssertion(XMM, XMM, SS), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
263 DoubleAssertion(XMM, XMM, SD), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
264 IntToFloatingAssertion(XMM, CPU, DWORD, QWORD), |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
265 FloatingToIntAssertion(CPU, XMM, DWORD, QWORD); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
266 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
267 private final RegisterCategory resultCategory; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
268 private final RegisterCategory inputCategory; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
269 private final OperandSize[] allowedSizes; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
270 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
271 private OpAssertion(RegisterCategory resultCategory, RegisterCategory inputCategory, OperandSize... allowedSizes) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
272 this.resultCategory = resultCategory; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
273 this.inputCategory = inputCategory; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
274 this.allowedSizes = allowedSizes; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
275 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
276 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
277 protected boolean checkOperands(AMD64Op op, OperandSize size, Register resultReg, Register inputReg) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
278 assert resultReg == null || resultCategory.equals(resultReg.getRegisterCategory()) : "invalid result register " + resultReg + " used in " + op; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
279 assert inputReg == null || inputCategory.equals(inputReg.getRegisterCategory()) : "invalid input register " + inputReg + " used in " + op; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
280 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
281 for (OperandSize s : allowedSizes) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
282 if (size == s) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
283 return true; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
284 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
285 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
286 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
287 assert false : "invalid operand size " + size + " used in " + op; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
288 return false; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
289 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
290 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
291 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
292 /** |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
293 * The register to which {@link Register#Frame} and {@link Register#CallerFrame} are bound. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
294 */ |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
295 public final Register frameRegister; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
296 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 * Constructs an assembler for the AMD64 architecture. |
14961
d87e4eae76c4
Cleanup of AMD64 assembler.
Roland Schatz <roland.schatz@oracle.com>
parents:
14754
diff
changeset
|
299 * |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
300 * @param registerConfig the register configuration used to bind {@link Register#Frame} and |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
301 * {@link Register#CallerFrame} to physical registers. This value can be null if this |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
302 * assembler instance will not be used to assemble instructions using these logical |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
303 * registers. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
304 */ |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
305 public AMD64Assembler(TargetDescription target, RegisterConfig registerConfig) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
306 super(target); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
307 this.frameRegister = registerConfig == null ? null : registerConfig.getFrameRegister(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
308 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
309 |
13350
2c3b59f34619
add CPUFeature EnumSet to target description with appropriate asserts
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13310
diff
changeset
|
310 private boolean supports(CPUFeature feature) { |
2c3b59f34619
add CPUFeature EnumSet to target description with appropriate asserts
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13310
diff
changeset
|
311 return ((AMD64) target.arch).getFeatures().contains(feature); |
2c3b59f34619
add CPUFeature EnumSet to target description with appropriate asserts
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13310
diff
changeset
|
312 } |
2c3b59f34619
add CPUFeature EnumSet to target description with appropriate asserts
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13310
diff
changeset
|
313 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
314 private static int encode(Register r) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 assert r.encoding < 16 && r.encoding >= 0 : "encoding out of range: " + r.encoding; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
316 return r.encoding & 0x7; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
319 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
320 * Get RXB bits for register-register instruction. In that encoding, ModRM.rm contains a |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
321 * register index. The R bit extends the ModRM.reg field and the B bit extends the ModRM.rm |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
322 * field. The X bit must be 0. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
323 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
324 protected static int getRXB(Register reg, Register rm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
325 int rxb = (reg == null ? 0 : reg.encoding & 0x08) >> 1; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
326 rxb |= (rm == null ? 0 : rm.encoding & 0x08) >> 3; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
327 return rxb; |
14961
d87e4eae76c4
Cleanup of AMD64 assembler.
Roland Schatz <roland.schatz@oracle.com>
parents:
14754
diff
changeset
|
328 } |
d87e4eae76c4
Cleanup of AMD64 assembler.
Roland Schatz <roland.schatz@oracle.com>
parents:
14754
diff
changeset
|
329 |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
330 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
331 * Get RXB bits for register-memory instruction. The R bit extends the ModRM.reg field. There |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
332 * are two cases for the memory operand:<br> |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
333 * ModRM.rm contains the base register: In that case, B extends the ModRM.rm field and X = 0.<br> |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
334 * There is an SIB byte: In that case, X extends SIB.index and B extends SIB.base. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
335 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
336 protected static int getRXB(Register reg, AMD64Address rm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
337 int rxb = (reg == null ? 0 : reg.encoding & 0x08) >> 1; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
338 if (!rm.getIndex().equals(Register.None)) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
339 rxb |= (rm.getIndex().encoding & 0x08) >> 2; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 } |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
341 if (!rm.getBase().equals(Register.None)) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
342 rxb |= (rm.getBase().encoding & 0x08) >> 3; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
343 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
344 return rxb; |
14962
e4a5b8904695
Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14961
diff
changeset
|
345 } |
e4a5b8904695
Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14961
diff
changeset
|
346 |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
347 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
348 * Emit the ModR/M byte for one register operand and an opcode extension in the R field. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
349 * <p> |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
350 * Format: [ 11 reg r/m ] |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
351 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
352 protected void emitModRM(int reg, Register rm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
353 assert (reg & 0x07) == reg; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
354 emitByte(0xC0 | (reg << 3) | (rm.encoding & 0x07)); |
14962
e4a5b8904695
Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14961
diff
changeset
|
355 } |
e4a5b8904695
Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14961
diff
changeset
|
356 |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
357 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
358 * Emit the ModR/M byte for two register operands. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
359 * <p> |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
360 * Format: [ 11 reg r/m ] |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
361 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
362 protected void emitModRM(Register reg, Register rm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
363 emitModRM(reg.encoding & 0x07, rm); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
364 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
365 |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
366 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
367 * Emits the ModR/M byte and optionally the SIB byte for one register and one memory operand. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
368 */ |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
369 protected void emitOperandHelper(Register reg, AMD64Address addr) { |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
370 assert !reg.equals(Register.None); |
8141
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
371 emitOperandHelper(encode(reg), addr); |
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
372 } |
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
373 |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
374 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
375 * Emits the ModR/M byte and optionally the SIB byte for one memory operand and an opcode |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
376 * extension in the R field. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
377 */ |
8141
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
378 protected void emitOperandHelper(int reg, AMD64Address addr) { |
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
379 assert (reg & 0x07) == reg; |
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
380 int regenc = reg << 3; |
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
381 |
8167
7f57c30575c8
Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents:
8141
diff
changeset
|
382 Register base = addr.getBase(); |
7f57c30575c8
Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents:
8141
diff
changeset
|
383 Register index = addr.getIndex(); |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
384 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
385 AMD64Address.Scale scale = addr.getScale(); |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
386 int disp = addr.getDisplacement(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
387 |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
388 if (base.equals(Register.Frame)) { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
389 assert frameRegister != null : "cannot use register " + Register.Frame + " in assembler with null register configuration"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
390 base = frameRegister; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
391 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
392 |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
393 if (base.equals(AMD64.rip)) { // also matches Placeholder |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
394 // [00 000 101] disp32 |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
395 assert index.equals(Register.None) : "cannot use RIP relative addressing with index register"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
396 emitByte(0x05 | regenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
397 emitInt(disp); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
398 } else if (base.isValid()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
399 int baseenc = base.isValid() ? encode(base) : 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 if (index.isValid()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
401 int indexenc = encode(index) << 3; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
402 // [base + indexscale + disp] |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
403 if (disp == 0 && !base.equals(rbp) && !base.equals(r13)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
404 // [base + indexscale] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
405 // [00 reg 100][ss index base] |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
406 assert !index.equals(rsp) : "illegal addressing mode"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
407 emitByte(0x04 | regenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
408 emitByte(scale.log2 << 6 | indexenc | baseenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
409 } else if (isByte(disp)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
410 // [base + indexscale + imm8] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
411 // [01 reg 100][ss index base] imm8 |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
412 assert !index.equals(rsp) : "illegal addressing mode"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
413 emitByte(0x44 | regenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
414 emitByte(scale.log2 << 6 | indexenc | baseenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 emitByte(disp & 0xFF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
416 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 // [base + indexscale + disp32] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
418 // [10 reg 100][ss index base] disp32 |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
419 assert !index.equals(rsp) : "illegal addressing mode"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
420 emitByte(0x84 | regenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
421 emitByte(scale.log2 << 6 | indexenc | baseenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 emitInt(disp); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
423 } |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
424 } else if (base.equals(rsp) || base.equals(r12)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
425 // [rsp + disp] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
426 if (disp == 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
427 // [rsp] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
428 // [00 reg 100][00 100 100] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
429 emitByte(0x04 | regenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
430 emitByte(0x24); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
431 } else if (isByte(disp)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
432 // [rsp + imm8] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
433 // [01 reg 100][00 100 100] disp8 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
434 emitByte(0x44 | regenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
435 emitByte(0x24); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
436 emitByte(disp & 0xFF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
437 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
438 // [rsp + imm32] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
439 // [10 reg 100][00 100 100] disp32 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
440 emitByte(0x84 | regenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
441 emitByte(0x24); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
442 emitInt(disp); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
443 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
444 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
445 // [base + disp] |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
446 assert !base.equals(rsp) && !base.equals(r12) : "illegal addressing mode"; |
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
447 if (disp == 0 && !base.equals(rbp) && !base.equals(r13)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
448 // [base] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
449 // [00 reg base] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
450 emitByte(0x00 | regenc | baseenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
451 } else if (isByte(disp)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
452 // [base + disp8] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
453 // [01 reg base] disp8 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
454 emitByte(0x40 | regenc | baseenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
455 emitByte(disp & 0xFF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
456 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
457 // [base + disp32] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
458 // [10 reg base] disp32 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
459 emitByte(0x80 | regenc | baseenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
460 emitInt(disp); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
461 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
462 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
463 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
464 if (index.isValid()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
465 int indexenc = encode(index) << 3; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
466 // [indexscale + disp] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
467 // [00 reg 100][ss index 101] disp32 |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9589
diff
changeset
|
468 assert !index.equals(rsp) : "illegal addressing mode"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
469 emitByte(0x04 | regenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
470 emitByte(scale.log2 << 6 | indexenc | 0x05); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
471 emitInt(disp); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
472 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
473 // [disp] ABSOLUTE |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
474 // [00 reg 100][00 100 101] disp32 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
475 emitByte(0x04 | regenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
476 emitByte(0x25); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
477 emitInt(disp); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
478 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
480 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
481 |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
482 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
483 * Base class for AMD64 opcodes. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
484 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
485 public static class AMD64Op { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
486 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
487 protected static final int P_0F = 0x0F; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
488 protected static final int P_0F38 = 0x380F; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
489 protected static final int P_0F3A = 0x3A0F; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
490 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
491 private final String opcode; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
492 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
493 private final int prefix1; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
494 private final int prefix2; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
495 private final int op; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
496 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
497 private final boolean dstIsByte; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
498 private final boolean srcIsByte; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
499 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
500 private final OpAssertion assertion; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
501 private final CPUFeature feature; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
502 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
503 protected AMD64Op(String opcode, int prefix1, int prefix2, int op, OpAssertion assertion, CPUFeature feature) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
504 this(opcode, prefix1, prefix2, op, assertion == OpAssertion.ByteAssertion, assertion == OpAssertion.ByteAssertion, assertion, feature); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
505 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
506 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
507 protected AMD64Op(String opcode, int prefix1, int prefix2, int op, boolean dstIsByte, boolean srcIsByte, OpAssertion assertion, CPUFeature feature) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
508 this.opcode = opcode; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
509 this.prefix1 = prefix1; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
510 this.prefix2 = prefix2; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
511 this.op = op; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
512 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
513 this.dstIsByte = dstIsByte; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
514 this.srcIsByte = srcIsByte; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
515 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
516 this.assertion = assertion; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
517 this.feature = feature; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
518 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
519 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
520 protected final void emitOpcode(AMD64Assembler asm, OperandSize size, int rxb, int dstEnc, int srcEnc) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
521 if (prefix1 != 0) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
522 asm.emitByte(prefix1); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
523 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
524 if (size.sizePrefix != 0) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
525 asm.emitByte(size.sizePrefix); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
526 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
527 int rexPrefix = 0x40 | rxb; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
528 if (size == QWORD) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
529 rexPrefix |= 0x08; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
530 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
531 if (rexPrefix != 0x40 || (dstIsByte && dstEnc >= 4) || (srcIsByte && srcEnc >= 4)) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
532 asm.emitByte(rexPrefix); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
533 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
534 if (prefix2 > 0xFF) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
535 asm.emitShort(prefix2); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
536 } else if (prefix2 > 0) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
537 asm.emitByte(prefix2); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
538 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
539 asm.emitByte(op); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
540 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
541 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
542 protected final boolean verify(AMD64Assembler asm, OperandSize size, Register resultReg, Register inputReg) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
543 assert feature == null || asm.supports(feature) : String.format("unsupported feature %s required for %s", feature, opcode); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
544 assert assertion.checkOperands(this, size, resultReg, inputReg); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
545 return true; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
546 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
547 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
548 @Override |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
549 public String toString() { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
550 return opcode; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
551 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
552 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
553 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
554 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
555 * Base class for AMD64 opcodes with immediate operands. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
556 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
557 public static class AMD64ImmOp extends AMD64Op { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
558 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
559 private final boolean immIsByte; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
560 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
561 protected AMD64ImmOp(String opcode, boolean immIsByte, int prefix, int op, OpAssertion assertion) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
562 super(opcode, 0, prefix, op, assertion, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
563 this.immIsByte = immIsByte; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
564 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
565 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
566 protected final void emitImmediate(AMD64Assembler asm, OperandSize size, int imm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
567 if (immIsByte) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
568 assert imm == (byte) imm; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
569 asm.emitByte(imm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
570 } else { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
571 size.emitImmediate(asm, imm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
572 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
573 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
574 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
575 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
576 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
577 * Opcode with operand order of either RM or MR. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
578 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
579 public abstract static class AMD64RROp extends AMD64Op { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
580 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
581 protected AMD64RROp(String opcode, int prefix1, int prefix2, int op, OpAssertion assertion, CPUFeature feature) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
582 super(opcode, prefix1, prefix2, op, assertion, feature); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
583 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
584 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
585 protected AMD64RROp(String opcode, int prefix1, int prefix2, int op, boolean dstIsByte, boolean srcIsByte, OpAssertion assertion, CPUFeature feature) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
586 super(opcode, prefix1, prefix2, op, dstIsByte, srcIsByte, assertion, feature); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
587 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
588 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
589 public abstract void emit(AMD64Assembler asm, OperandSize size, Register dst, Register src); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
590 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
591 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
592 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
593 * Opcode with operand order of RM. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
594 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
595 public static class AMD64RMOp extends AMD64RROp { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
596 // @formatter:off |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
597 public static final AMD64RMOp IMUL = new AMD64RMOp("IMUL", P_0F, 0xAF); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
598 public static final AMD64RMOp BSF = new AMD64RMOp("BSF", P_0F, 0xBC); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
599 public static final AMD64RMOp BSR = new AMD64RMOp("BSR", P_0F, 0xBD); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
600 public static final AMD64RMOp POPCNT = new AMD64RMOp("POPCNT", 0xF3, P_0F, 0xB8, CPUFeature.POPCNT); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
601 public static final AMD64RMOp TZCNT = new AMD64RMOp("TZCNT", 0xF3, P_0F, 0xBC, CPUFeature.BMI1); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
602 public static final AMD64RMOp LZCNT = new AMD64RMOp("LZCNT", 0xF3, P_0F, 0xBD, CPUFeature.LZCNT); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
603 public static final AMD64RMOp MOVZXB = new AMD64RMOp("MOVZXB", P_0F, 0xB6, false, true, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
604 public static final AMD64RMOp MOVZX = new AMD64RMOp("MOVZX", P_0F, 0xB7, OpAssertion.No16BitAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
605 public static final AMD64RMOp MOVSXB = new AMD64RMOp("MOVSXB", P_0F, 0xBE, false, true, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
606 public static final AMD64RMOp MOVSX = new AMD64RMOp("MOVSX", P_0F, 0xBF, OpAssertion.No16BitAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
607 public static final AMD64RMOp MOVSXD = new AMD64RMOp("MOVSXD", 0x63, OpAssertion.QwordOnlyAssertion); |
19972
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
608 public static final AMD64RMOp MOVB = new AMD64RMOp("MOVB", 0x8A, OpAssertion.ByteAssertion); |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
609 public static final AMD64RMOp MOV = new AMD64RMOp("MOV", 0x8B); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
610 |
19972
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
611 // MOVD/MOVQ and MOVSS/MOVSD are the same opcode, just with different operand size prefix |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
612 public static final AMD64RMOp MOVD = new AMD64RMOp("MOVD", 0x66, P_0F, 0x6E, OpAssertion.IntToFloatingAssertion, CPUFeature.SSE2); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
613 public static final AMD64RMOp MOVQ = new AMD64RMOp("MOVQ", 0x66, P_0F, 0x6E, OpAssertion.IntToFloatingAssertion, CPUFeature.SSE2); |
19972
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
614 public static final AMD64RMOp MOVSS = new AMD64RMOp("MOVSS", P_0F, 0x10, OpAssertion.FloatingAssertion, CPUFeature.SSE); |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
615 public static final AMD64RMOp MOVSD = new AMD64RMOp("MOVSD", P_0F, 0x10, OpAssertion.FloatingAssertion, CPUFeature.SSE); |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
616 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
617 // TEST is documented as MR operation, but it's symmetric, and using it as RM operation is more convenient. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
618 public static final AMD64RMOp TESTB = new AMD64RMOp("TEST", 0x84, OpAssertion.ByteAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
619 public static final AMD64RMOp TEST = new AMD64RMOp("TEST", 0x85); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
620 // @formatter:on |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
621 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
622 protected AMD64RMOp(String opcode, int op) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
623 this(opcode, 0, op); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
624 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
625 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
626 protected AMD64RMOp(String opcode, int op, OpAssertion assertion) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
627 this(opcode, 0, op, assertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
628 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
629 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
630 protected AMD64RMOp(String opcode, int prefix, int op) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
631 this(opcode, 0, prefix, op, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
632 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
633 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
634 protected AMD64RMOp(String opcode, int prefix, int op, OpAssertion assertion) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
635 this(opcode, 0, prefix, op, assertion, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
636 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
637 |
19972
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
638 protected AMD64RMOp(String opcode, int prefix, int op, OpAssertion assertion, CPUFeature feature) { |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
639 this(opcode, 0, prefix, op, assertion, feature); |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
640 } |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
641 |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
642 protected AMD64RMOp(String opcode, int prefix, int op, boolean dstIsByte, boolean srcIsByte, OpAssertion assertion) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
643 super(opcode, 0, prefix, op, dstIsByte, srcIsByte, assertion, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
644 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
645 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
646 protected AMD64RMOp(String opcode, int prefix1, int prefix2, int op, CPUFeature feature) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
647 this(opcode, prefix1, prefix2, op, OpAssertion.IntegerAssertion, feature); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
648 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
649 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
650 protected AMD64RMOp(String opcode, int prefix1, int prefix2, int op, OpAssertion assertion, CPUFeature feature) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
651 super(opcode, prefix1, prefix2, op, assertion, feature); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
652 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
653 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
654 @Override |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
655 public final void emit(AMD64Assembler asm, OperandSize size, Register dst, Register src) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
656 assert verify(asm, size, dst, src); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
657 emitOpcode(asm, size, getRXB(dst, src), dst.encoding, src.encoding); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
658 asm.emitModRM(dst, src); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
659 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
660 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
661 public final void emit(AMD64Assembler asm, OperandSize size, Register dst, AMD64Address src) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
662 assert verify(asm, size, dst, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
663 emitOpcode(asm, size, getRXB(dst, src), dst.encoding, 0); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
664 asm.emitOperandHelper(dst, src); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
665 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
666 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
667 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
668 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
669 * Opcode with operand order of MR. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
670 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
671 public static class AMD64MROp extends AMD64RROp { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
672 // @formatter:off |
19972
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
673 public static final AMD64MROp MOVB = new AMD64MROp("MOVB", 0x88, OpAssertion.ByteAssertion); |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
674 public static final AMD64MROp MOV = new AMD64MROp("MOV", 0x89); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
675 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
676 // MOVD and MOVQ are the same opcode, just with different operand size prefix |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
677 // Note that as MR opcodes, they have reverse operand order, so the IntToFloatingAssertion must be used. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
678 public static final AMD64MROp MOVD = new AMD64MROp("MOVD", 0x66, P_0F, 0x7E, OpAssertion.IntToFloatingAssertion, CPUFeature.SSE2); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
679 public static final AMD64MROp MOVQ = new AMD64MROp("MOVQ", 0x66, P_0F, 0x7E, OpAssertion.IntToFloatingAssertion, CPUFeature.SSE2); |
19972
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
680 |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
681 // MOVSS and MOVSD are the same opcode, just with different operand size prefix |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
682 public static final AMD64MROp MOVSS = new AMD64MROp("MOVSS", P_0F, 0x11, OpAssertion.FloatingAssertion, CPUFeature.SSE); |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
683 public static final AMD64MROp MOVSD = new AMD64MROp("MOVSD", P_0F, 0x11, OpAssertion.FloatingAssertion, CPUFeature.SSE); |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
684 // @formatter:on |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
685 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
686 protected AMD64MROp(String opcode, int op) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
687 this(opcode, 0, op); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
688 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
689 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
690 protected AMD64MROp(String opcode, int op, OpAssertion assertion) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
691 this(opcode, 0, op, assertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
692 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
693 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
694 protected AMD64MROp(String opcode, int prefix, int op) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
695 this(opcode, prefix, op, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
696 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
697 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
698 protected AMD64MROp(String opcode, int prefix, int op, OpAssertion assertion) { |
19972
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
699 this(opcode, prefix, op, assertion, null); |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
700 } |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
701 |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
702 protected AMD64MROp(String opcode, int prefix, int op, OpAssertion assertion, CPUFeature feature) { |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
703 this(opcode, 0, prefix, op, assertion, feature); |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
704 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
705 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
706 protected AMD64MROp(String opcode, int prefix1, int prefix2, int op, OpAssertion assertion, CPUFeature feature) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
707 super(opcode, prefix1, prefix2, op, assertion, feature); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
708 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
709 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
710 @Override |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
711 public final void emit(AMD64Assembler asm, OperandSize size, Register dst, Register src) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
712 assert verify(asm, size, src, dst); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
713 emitOpcode(asm, size, getRXB(src, dst), src.encoding, dst.encoding); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
714 asm.emitModRM(src, dst); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
715 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
716 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
717 public final void emit(AMD64Assembler asm, OperandSize size, AMD64Address dst, Register src) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
718 assert verify(asm, size, null, src); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
719 emitOpcode(asm, size, getRXB(src, dst), src.encoding, 0); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
720 asm.emitOperandHelper(src, dst); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
721 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
722 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
723 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
724 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
725 * Opcodes with operand order of M. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
726 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
727 public static class AMD64MOp extends AMD64Op { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
728 // @formatter:off |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
729 public static final AMD64MOp NOT = new AMD64MOp("NOT", 0xF7, 2); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
730 public static final AMD64MOp NEG = new AMD64MOp("NEG", 0xF7, 3); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
731 public static final AMD64MOp MUL = new AMD64MOp("MUL", 0xF7, 4); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
732 public static final AMD64MOp IMUL = new AMD64MOp("IMUL", 0xF7, 5); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
733 public static final AMD64MOp DIV = new AMD64MOp("DIV", 0xF7, 6); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
734 public static final AMD64MOp IDIV = new AMD64MOp("IDIV", 0xF7, 7); |
20021
4b6965a278cf
Fix allocation counter issue where the counters sometimes gives way too high values for allocated bytes
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19972
diff
changeset
|
735 public static final AMD64MOp INC = new AMD64MOp("INC", 0xFF, 0); |
20085
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
736 public static final AMD64MOp DEC = new AMD64MOp("DEC", 0xFF, 1); |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
737 // @formatter:on |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
738 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
739 private final int ext; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
740 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
741 protected AMD64MOp(String opcode, int op, int ext) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
742 this(opcode, 0, op, ext); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
743 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
744 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
745 protected AMD64MOp(String opcode, int prefix, int op, int ext) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
746 this(opcode, prefix, op, ext, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
747 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
748 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
749 protected AMD64MOp(String opcode, int prefix, int op, int ext, OpAssertion assertion) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
750 super(opcode, 0, prefix, op, assertion, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
751 this.ext = ext; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
752 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
753 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
754 public final void emit(AMD64Assembler asm, OperandSize size, Register dst) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
755 assert verify(asm, size, dst, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
756 emitOpcode(asm, size, getRXB(null, dst), 0, dst.encoding); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
757 asm.emitModRM(ext, dst); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
758 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
759 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
760 public final void emit(AMD64Assembler asm, OperandSize size, AMD64Address dst) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
761 assert verify(asm, size, null, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
762 emitOpcode(asm, size, getRXB(null, dst), 0, 0); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
763 asm.emitOperandHelper(ext, dst); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
764 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
765 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
766 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
767 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
768 * Opcodes with operand order of MI. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
769 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
770 public static class AMD64MIOp extends AMD64ImmOp { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
771 // @formatter:off |
19972
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
772 public static final AMD64MIOp MOVB = new AMD64MIOp("MOVB", true, 0xC6, 0, OpAssertion.ByteAssertion); |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
773 public static final AMD64MIOp MOV = new AMD64MIOp("MOV", false, 0xC7, 0); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
774 public static final AMD64MIOp TEST = new AMD64MIOp("TEST", false, 0xF7, 0); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
775 // @formatter:on |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
776 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
777 private final int ext; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
778 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
779 protected AMD64MIOp(String opcode, boolean immIsByte, int op, int ext) { |
19972
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
780 this(opcode, immIsByte, op, ext, OpAssertion.IntegerAssertion); |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
781 } |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
782 |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
783 protected AMD64MIOp(String opcode, boolean immIsByte, int op, int ext, OpAssertion assertion) { |
f259c81821ef
Simplify code generation for AMD64 memory access instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
19908
diff
changeset
|
784 this(opcode, immIsByte, 0, op, ext, assertion); |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
785 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
786 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
787 protected AMD64MIOp(String opcode, boolean immIsByte, int prefix, int op, int ext, OpAssertion assertion) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
788 super(opcode, immIsByte, prefix, op, assertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
789 this.ext = ext; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
790 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
791 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
792 public final void emit(AMD64Assembler asm, OperandSize size, Register dst, int imm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
793 assert verify(asm, size, dst, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
794 emitOpcode(asm, size, getRXB(null, dst), 0, dst.encoding); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
795 asm.emitModRM(ext, dst); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
796 emitImmediate(asm, size, imm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
797 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
798 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
799 public final void emit(AMD64Assembler asm, OperandSize size, AMD64Address dst, int imm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
800 assert verify(asm, size, null, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
801 emitOpcode(asm, size, getRXB(null, dst), 0, 0); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
802 asm.emitOperandHelper(ext, dst); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
803 emitImmediate(asm, size, imm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
804 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
805 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
806 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
807 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
808 * Opcodes with operand order of RMI. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
809 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
810 public static class AMD64RMIOp extends AMD64ImmOp { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
811 // @formatter:off |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
812 public static final AMD64RMIOp IMUL = new AMD64RMIOp("IMUL", false, 0x69); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
813 public static final AMD64RMIOp IMUL_SX = new AMD64RMIOp("IMUL", true, 0x6B); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
814 // @formatter:on |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
815 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
816 protected AMD64RMIOp(String opcode, boolean immIsByte, int op) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
817 this(opcode, immIsByte, 0, op, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
818 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
819 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
820 protected AMD64RMIOp(String opcode, boolean immIsByte, int prefix, int op, OpAssertion assertion) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
821 super(opcode, immIsByte, prefix, op, assertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
822 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
823 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
824 public final void emit(AMD64Assembler asm, OperandSize size, Register dst, Register src, int imm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
825 assert verify(asm, size, dst, src); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
826 emitOpcode(asm, size, getRXB(dst, src), dst.encoding, src.encoding); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
827 asm.emitModRM(dst, src); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
828 emitImmediate(asm, size, imm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
829 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
830 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
831 public final void emit(AMD64Assembler asm, OperandSize size, Register dst, AMD64Address src, int imm) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
832 assert verify(asm, size, dst, null); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
833 emitOpcode(asm, size, getRXB(dst, src), dst.encoding, 0); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
834 asm.emitOperandHelper(dst, src); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
835 emitImmediate(asm, size, imm); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
836 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
837 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
838 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
839 public static class SSEOp extends AMD64RMOp { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
840 // @formatter:off |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
841 public static final SSEOp CVTSI2SS = new SSEOp("CVTSI2SS", 0xF3, P_0F, 0x2A, OpAssertion.IntToFloatingAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
842 public static final SSEOp CVTSI2SD = new SSEOp("CVTSI2SS", 0xF2, P_0F, 0x2A, OpAssertion.IntToFloatingAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
843 public static final SSEOp CVTTSS2SI = new SSEOp("CVTTSS2SI", 0xF3, P_0F, 0x2C, OpAssertion.FloatingToIntAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
844 public static final SSEOp CVTTSD2SI = new SSEOp("CVTTSD2SI", 0xF2, P_0F, 0x2C, OpAssertion.FloatingToIntAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
845 public static final SSEOp UCOMIS = new SSEOp("UCOMIS", P_0F, 0x2E, OpAssertion.PackedFloatingAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
846 public static final SSEOp SQRT = new SSEOp("SQRT", P_0F, 0x51); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
847 public static final SSEOp AND = new SSEOp("AND", P_0F, 0x54, OpAssertion.PackedFloatingAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
848 public static final SSEOp ANDN = new SSEOp("ANDN", P_0F, 0x55, OpAssertion.PackedFloatingAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
849 public static final SSEOp OR = new SSEOp("OR", P_0F, 0x56, OpAssertion.PackedFloatingAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
850 public static final SSEOp XOR = new SSEOp("XOR", P_0F, 0x57, OpAssertion.PackedFloatingAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
851 public static final SSEOp ADD = new SSEOp("ADD", P_0F, 0x58); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
852 public static final SSEOp MUL = new SSEOp("MUL", P_0F, 0x59); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
853 public static final SSEOp CVTSS2SD = new SSEOp("CVTSS2SD", P_0F, 0x5A, OpAssertion.SingleAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
854 public static final SSEOp CVTSD2SS = new SSEOp("CVTSD2SS", P_0F, 0x5A, OpAssertion.DoubleAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
855 public static final SSEOp SUB = new SSEOp("SUB", P_0F, 0x5C); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
856 public static final SSEOp MIN = new SSEOp("MIN", P_0F, 0x5D); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
857 public static final SSEOp DIV = new SSEOp("DIV", P_0F, 0x5E); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
858 public static final SSEOp MAX = new SSEOp("MAX", P_0F, 0x5F); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
859 // @formatter:on |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
860 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
861 protected SSEOp(String opcode, int prefix, int op) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
862 this(opcode, prefix, op, OpAssertion.FloatingAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
863 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
864 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
865 protected SSEOp(String opcode, int prefix, int op, OpAssertion assertion) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
866 this(opcode, 0, prefix, op, assertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
867 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
868 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
869 protected SSEOp(String opcode, int mandatoryPrefix, int prefix, int op, OpAssertion assertion) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
870 super(opcode, mandatoryPrefix, prefix, op, assertion, CPUFeature.SSE2); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
871 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
872 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
873 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
874 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
875 * Arithmetic operation with operand order of RM, MR or MI. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
876 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
877 public static final class AMD64BinaryArithmetic { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
878 // @formatter:off |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
879 public static final AMD64BinaryArithmetic ADD = new AMD64BinaryArithmetic("ADD", 0); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
880 public static final AMD64BinaryArithmetic OR = new AMD64BinaryArithmetic("OR", 1); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
881 public static final AMD64BinaryArithmetic ADC = new AMD64BinaryArithmetic("ADC", 2); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
882 public static final AMD64BinaryArithmetic SBB = new AMD64BinaryArithmetic("SBB", 3); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
883 public static final AMD64BinaryArithmetic AND = new AMD64BinaryArithmetic("AND", 4); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
884 public static final AMD64BinaryArithmetic SUB = new AMD64BinaryArithmetic("SUB", 5); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
885 public static final AMD64BinaryArithmetic XOR = new AMD64BinaryArithmetic("XOR", 6); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
886 public static final AMD64BinaryArithmetic CMP = new AMD64BinaryArithmetic("CMP", 7); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
887 // @formatter:on |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
888 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
889 private final AMD64MIOp byteImmOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
890 private final AMD64MROp byteMrOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
891 private final AMD64RMOp byteRmOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
892 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
893 private final AMD64MIOp immOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
894 private final AMD64MIOp immSxOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
895 private final AMD64MROp mrOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
896 private final AMD64RMOp rmOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
897 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
898 private AMD64BinaryArithmetic(String opcode, int code) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
899 int baseOp = code << 3; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
900 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
901 byteImmOp = new AMD64MIOp(opcode, true, 0, 0x80, code, OpAssertion.ByteAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
902 byteMrOp = new AMD64MROp(opcode, 0, baseOp, OpAssertion.ByteAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
903 byteRmOp = new AMD64RMOp(opcode, 0, baseOp | 0x02, OpAssertion.ByteAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
904 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
905 immOp = new AMD64MIOp(opcode, false, 0, 0x81, code, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
906 immSxOp = new AMD64MIOp(opcode, true, 0, 0x83, code, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
907 mrOp = new AMD64MROp(opcode, 0, baseOp | 0x01, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
908 rmOp = new AMD64RMOp(opcode, 0, baseOp | 0x03, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
909 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
910 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
911 public AMD64MIOp getMIOpcode(OperandSize size, boolean sx) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
912 if (size == BYTE) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
913 return byteImmOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
914 } else if (sx) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
915 return immSxOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
916 } else { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
917 return immOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
918 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
919 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
920 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
921 public AMD64MROp getMROpcode(OperandSize size) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
922 if (size == BYTE) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
923 return byteMrOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
924 } else { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
925 return mrOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
926 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
927 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
928 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
929 public AMD64RMOp getRMOpcode(OperandSize size) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
930 if (size == BYTE) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
931 return byteRmOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
932 } else { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
933 return rmOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
934 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
935 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
936 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
937 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
938 /** |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
939 * Shift operation with operand order of M1, MC or MI. |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
940 */ |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
941 public static final class AMD64Shift { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
942 // @formatter:off |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
943 public static final AMD64Shift ROL = new AMD64Shift("ROL", 0); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
944 public static final AMD64Shift ROR = new AMD64Shift("ROR", 1); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
945 public static final AMD64Shift RCL = new AMD64Shift("RCL", 2); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
946 public static final AMD64Shift RCR = new AMD64Shift("RCR", 3); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
947 public static final AMD64Shift SHL = new AMD64Shift("SHL", 4); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
948 public static final AMD64Shift SHR = new AMD64Shift("SHR", 5); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
949 public static final AMD64Shift SAR = new AMD64Shift("SAR", 7); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
950 // @formatter:on |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
951 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
952 public final AMD64MOp m1Op; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
953 public final AMD64MOp mcOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
954 public final AMD64MIOp miOp; |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
955 |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
956 private AMD64Shift(String opcode, int code) { |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
957 m1Op = new AMD64MOp(opcode, 0, 0xD1, code, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
958 mcOp = new AMD64MOp(opcode, 0, 0xD3, code, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
959 miOp = new AMD64MIOp(opcode, true, 0, 0xC1, code, OpAssertion.IntegerAssertion); |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
960 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
961 } |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
962 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
963 public final void addl(AMD64Address dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
964 ADD.getMIOpcode(DWORD, isByte(imm32)).emit(this, DWORD, dst, imm32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
965 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
966 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
967 public final void addl(Register dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
968 ADD.getMIOpcode(DWORD, isByte(imm32)).emit(this, DWORD, dst, imm32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
969 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
970 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
971 private void addrNop4() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
972 // 4 bytes: NOP DWORD PTR [EAX+0] |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
973 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
974 emitByte(0x1F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
975 emitByte(0x40); // emitRm(cbuf, 0x1, EAXEnc, EAXEnc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
976 emitByte(0); // 8-bits offset (1 byte) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
977 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
978 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
979 private void addrNop5() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
980 // 5 bytes: NOP DWORD PTR [EAX+EAX*0+0] 8-bits offset |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
981 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
982 emitByte(0x1F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
983 emitByte(0x44); // emitRm(cbuf, 0x1, EAXEnc, 0x4); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
984 emitByte(0x00); // emitRm(cbuf, 0x0, EAXEnc, EAXEnc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
985 emitByte(0); // 8-bits offset (1 byte) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
986 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
987 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
988 private void addrNop7() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
989 // 7 bytes: NOP DWORD PTR [EAX+0] 32-bits offset |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
990 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
991 emitByte(0x1F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
992 emitByte(0x80); // emitRm(cbuf, 0x2, EAXEnc, EAXEnc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
993 emitInt(0); // 32-bits offset (4 bytes) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
994 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
995 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
996 private void addrNop8() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
997 // 8 bytes: NOP DWORD PTR [EAX+EAX*0+0] 32-bits offset |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
998 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
999 emitByte(0x1F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1000 emitByte(0x84); // emitRm(cbuf, 0x2, EAXEnc, 0x4); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1001 emitByte(0x00); // emitRm(cbuf, 0x0, EAXEnc, EAXEnc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1002 emitInt(0); // 32-bits offset (4 bytes) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1003 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1004 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1005 public final void andl(Register dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1006 AND.getMIOpcode(DWORD, isByte(imm32)).emit(this, DWORD, dst, imm32); |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5774
diff
changeset
|
1007 } |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5774
diff
changeset
|
1008 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1009 public final void bswapl(Register reg) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1010 int encode = prefixAndEncode(reg.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1011 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1012 emitByte(0xC8 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1013 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1014 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1015 public final void cdql() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1016 emitByte(0x99); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1017 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1018 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1019 public final void cmovl(ConditionFlag cc, Register dst, Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1020 int encode = prefixAndEncode(dst.encoding, src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1021 emitByte(0x0F); |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1022 emitByte(0x40 | cc.getValue()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1023 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1024 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1025 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1026 public final void cmovl(ConditionFlag cc, Register dst, AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1027 prefix(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1028 emitByte(0x0F); |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1029 emitByte(0x40 | cc.getValue()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1030 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1031 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1032 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1033 public final void cmpl(Register dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1034 CMP.getMIOpcode(DWORD, isByte(imm32)).emit(this, DWORD, dst, imm32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1035 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1036 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1037 public final void cmpl(Register dst, Register src) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1038 CMP.rmOp.emit(this, DWORD, dst, src); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1039 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1040 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1041 public final void cmpl(Register dst, AMD64Address src) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1042 CMP.rmOp.emit(this, DWORD, dst, src); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1043 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1044 |
9561
85595218dab0
added compare between address and 32-bit immediate
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
1045 public final void cmpl(AMD64Address dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1046 CMP.getMIOpcode(DWORD, isByte(imm32)).emit(this, DWORD, dst, imm32); |
9561
85595218dab0
added compare between address and 32-bit immediate
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
1047 } |
85595218dab0
added compare between address and 32-bit immediate
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
1048 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1049 // The 32-bit cmpxchg compares the value at adr with the contents of X86.rax, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1050 // and stores reg into adr if so; otherwise, the value at adr is loaded into X86.rax,. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1051 // The ZF is set if the compared values were equal, and cleared otherwise. |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1052 public final void cmpxchgl(Register reg, AMD64Address adr) { // cmpxchg |
12725
7b457ecd18c3
AMD64Assembler: remove useless option "Atomic" and make other options final
Bernhard Urban <bernhard.urban@jku.at>
parents:
11826
diff
changeset
|
1053 prefix(adr, reg); |
7b457ecd18c3
AMD64Assembler: remove useless option "Atomic" and make other options final
Bernhard Urban <bernhard.urban@jku.at>
parents:
11826
diff
changeset
|
1054 emitByte(0x0F); |
7b457ecd18c3
AMD64Assembler: remove useless option "Atomic" and make other options final
Bernhard Urban <bernhard.urban@jku.at>
parents:
11826
diff
changeset
|
1055 emitByte(0xB1); |
7b457ecd18c3
AMD64Assembler: remove useless option "Atomic" and make other options final
Bernhard Urban <bernhard.urban@jku.at>
parents:
11826
diff
changeset
|
1056 emitOperandHelper(reg, adr); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1057 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1058 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1059 protected final void decl(AMD64Address dst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1060 prefix(dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1061 emitByte(0xFF); |
8141
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
1062 emitOperandHelper(1, dst); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1063 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1064 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1065 public final void hlt() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1066 emitByte(0xF4); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1067 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1068 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1069 public final void imull(Register dst, Register src, int value) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1070 if (isByte(value)) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1071 AMD64RMIOp.IMUL_SX.emit(this, DWORD, dst, src, value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1072 } else { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1073 AMD64RMIOp.IMUL.emit(this, DWORD, dst, src, value); |
18841
f2f2897880c8
Avoid unnecessary register-register move before IMUL instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
18415
diff
changeset
|
1074 } |
f2f2897880c8
Avoid unnecessary register-register move before IMUL instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
18415
diff
changeset
|
1075 } |
f2f2897880c8
Avoid unnecessary register-register move before IMUL instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
18415
diff
changeset
|
1076 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1077 protected final void incl(AMD64Address dst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1078 prefix(dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1079 emitByte(0xFF); |
8141
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
1080 emitOperandHelper(0, dst); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1081 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1082 |
11826
2d3d3d36ab3c
AMD64HotSpot: use conditional jump for IC_MISS_HANDLER
Bernhard Urban <bernhard.urban@jku.at>
parents:
11355
diff
changeset
|
1083 public void jcc(ConditionFlag cc, int jumpTarget, boolean forceDisp32) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1084 int shortSize = 2; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1085 int longSize = 6; |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
1086 long disp = jumpTarget - position(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1087 if (!forceDisp32 && isByte(disp - shortSize)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1088 // 0111 tttn #8-bit disp |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1089 emitByte(0x70 | cc.getValue()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1090 emitByte((int) ((disp - shortSize) & 0xFF)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1091 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1092 // 0000 1111 1000 tttn #32-bit disp |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1093 assert isInt(disp - longSize) : "must be 32bit offset (call4)"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1094 emitByte(0x0F); |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1095 emitByte(0x80 | cc.getValue()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1096 emitInt((int) (disp - longSize)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1097 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1098 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1099 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1100 public final void jcc(ConditionFlag cc, Label l) { |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1101 assert (0 <= cc.getValue()) && (cc.getValue() < 16) : "illegal cc"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1102 if (l.isBound()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1103 jcc(cc, l.position(), false); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1104 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1105 // Note: could eliminate cond. jumps to this jump if condition |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1106 // is the same however, seems to be rather unlikely case. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1107 // Note: use jccb() if label to be bound is very close to get |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1108 // an 8-bit displacement |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
1109 l.addPatchAt(position()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1110 emitByte(0x0F); |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1111 emitByte(0x80 | cc.getValue()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1112 emitInt(0); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1113 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1114 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1115 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1116 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1117 public final void jccb(ConditionFlag cc, Label l) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1118 if (l.isBound()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1119 int shortSize = 2; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1120 int entry = l.position(); |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
1121 assert isByte(entry - (position() + shortSize)) : "Dispacement too large for a short jmp"; |
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
1122 long disp = entry - position(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1123 // 0111 tttn #8-bit disp |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1124 emitByte(0x70 | cc.getValue()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1125 emitByte((int) ((disp - shortSize) & 0xFF)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1126 } else { |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
1127 l.addPatchAt(position()); |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1128 emitByte(0x70 | cc.getValue()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1129 emitByte(0); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1130 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1131 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1132 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1133 public final void jmp(int jumpTarget, boolean forceDisp32) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1134 int shortSize = 2; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1135 int longSize = 5; |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
1136 long disp = jumpTarget - position(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1137 if (!forceDisp32 && isByte(disp - shortSize)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1138 emitByte(0xEB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1139 emitByte((int) ((disp - shortSize) & 0xFF)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1140 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1141 emitByte(0xE9); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1142 emitInt((int) (disp - longSize)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1143 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1144 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1145 |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4249
diff
changeset
|
1146 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1147 public final void jmp(Label l) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1148 if (l.isBound()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1149 jmp(l.position(), false); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1150 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1151 // By default, forward jumps are always 32-bit displacements, since |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1152 // we can't yet know where the label will be bound. If you're sure that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1153 // the forward jump will not run beyond 256 bytes, use jmpb to |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1154 // force an 8-bit displacement. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1155 |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
1156 l.addPatchAt(position()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1157 emitByte(0xE9); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1158 emitInt(0); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1159 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1160 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1161 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1162 public final void jmp(Register entry) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1163 int encode = prefixAndEncode(entry.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1164 emitByte(0xFF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1165 emitByte(0xE0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1166 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1167 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1168 public final void jmpb(Label l) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1169 if (l.isBound()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1170 int shortSize = 2; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1171 int entry = l.position(); |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
1172 assert isByte((entry - position()) + shortSize) : "Dispacement too large for a short jmp"; |
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
1173 long offs = entry - position(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1174 emitByte(0xEB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1175 emitByte((int) ((offs - shortSize) & 0xFF)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1176 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1177 |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
1178 l.addPatchAt(position()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1179 emitByte(0xEB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1180 emitByte(0); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1181 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1182 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1183 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1184 public final void leaq(Register dst, AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1185 prefixq(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1186 emitByte(0x8D); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1187 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1188 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1189 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1190 public final void leave() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1191 emitByte(0xC9); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1192 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1193 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1194 public final void lock() { |
12725
7b457ecd18c3
AMD64Assembler: remove useless option "Atomic" and make other options final
Bernhard Urban <bernhard.urban@jku.at>
parents:
11826
diff
changeset
|
1195 emitByte(0xF0); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1196 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1197 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1198 public final void movapd(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:
16064
diff
changeset
|
1199 assert dst.getRegisterCategory().equals(AMD64.XMM); |
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16064
diff
changeset
|
1200 assert src.getRegisterCategory().equals(AMD64.XMM); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1201 int dstenc = dst.encoding; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1202 int srcenc = src.encoding; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1203 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1204 if (dstenc < 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1205 if (srcenc >= 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1206 emitByte(Prefix.REXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1207 srcenc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1208 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1209 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1210 if (srcenc < 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1211 emitByte(Prefix.REXR); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1212 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1213 emitByte(Prefix.REXRB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1214 srcenc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1215 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1216 dstenc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1217 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1218 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1219 emitByte(0x28); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1220 emitByte(0xC0 | dstenc << 3 | srcenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1221 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1222 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1223 public final void movaps(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:
16064
diff
changeset
|
1224 assert dst.getRegisterCategory().equals(AMD64.XMM); |
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16064
diff
changeset
|
1225 assert src.getRegisterCategory().equals(AMD64.XMM); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1226 int dstenc = dst.encoding; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1227 int srcenc = src.encoding; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1228 if (dstenc < 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1229 if (srcenc >= 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1230 emitByte(Prefix.REXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1231 srcenc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1232 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1233 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1234 if (srcenc < 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1235 emitByte(Prefix.REXR); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1236 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1237 emitByte(Prefix.REXRB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1238 srcenc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1239 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1240 dstenc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1241 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1242 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1243 emitByte(0x28); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1244 emitByte(0xC0 | dstenc << 3 | srcenc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1245 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1246 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1247 public final void movb(AMD64Address dst, int imm8) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1248 prefix(dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1249 emitByte(0xC6); |
8141
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
1250 emitOperandHelper(0, dst); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1251 emitByte(imm8); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1252 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1253 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1254 public final void movb(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:
16064
diff
changeset
|
1255 assert src.getRegisterCategory().equals(AMD64.CPU) : "must have byte register"; |
13372
af10ee69a8ac
fixed JDK-7079626: x64 emits unnecessary REX prefix
twisti
parents:
13350
diff
changeset
|
1256 prefix(dst, src, true); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1257 emitByte(0x88); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1258 emitOperandHelper(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1259 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1260 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1261 public final void movl(Register dst, int imm32) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1262 int encode = prefixAndEncode(dst.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1263 emitByte(0xB8 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1264 emitInt(imm32); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1265 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1266 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1267 public final void movl(Register dst, Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1268 int encode = prefixAndEncode(dst.encoding, src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1269 emitByte(0x8B); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1270 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1271 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1272 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1273 public final void movl(Register dst, AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1274 prefix(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1275 emitByte(0x8B); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1276 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1277 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1278 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1279 public final void movl(AMD64Address dst, int imm32) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1280 prefix(dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1281 emitByte(0xC7); |
8141
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
1282 emitOperandHelper(0, dst); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1283 emitInt(imm32); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1284 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1285 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1286 public final void movl(AMD64Address dst, Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1287 prefix(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1288 emitByte(0x89); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1289 emitOperandHelper(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1290 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1291 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1292 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
1293 * New CPUs require use of movsd and movss to avoid partial register stall when loading from |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
1294 * memory. But for old Opteron use movlpd instead of movsd. The selection is done in |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1295 * {@link AMD64MacroAssembler#movdbl(Register, AMD64Address)} and |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
1296 * {@link AMD64MacroAssembler#movflt(Register, Register)}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1297 */ |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1298 public final void movlpd(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:
16064
diff
changeset
|
1299 assert dst.getRegisterCategory().equals(AMD64.XMM); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1300 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1301 prefix(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1302 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1303 emitByte(0x12); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1304 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1305 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1306 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1307 public final void movq(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:
16064
diff
changeset
|
1308 if (dst.getRegisterCategory().equals(AMD64.XMM)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1309 emitByte(0xF3); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1310 prefixq(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1311 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1312 emitByte(0x7E); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1313 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1314 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1315 prefixq(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1316 emitByte(0x8B); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1317 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1318 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1319 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1320 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1321 public final void movq(Register dst, Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1322 int encode = prefixqAndEncode(dst.encoding, src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1323 emitByte(0x8B); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1324 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1325 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1326 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1327 public final void movq(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:
16064
diff
changeset
|
1328 if (src.getRegisterCategory().equals(AMD64.XMM)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1329 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1330 prefixq(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1331 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1332 emitByte(0xD6); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1333 emitOperandHelper(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1334 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1335 prefixq(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1336 emitByte(0x89); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1337 emitOperandHelper(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1338 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1339 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1340 |
13587
40e81cba9e08
renamed movzx/movsx instructions; removed duplicate movswl; added movzbl
twisti
parents:
13586
diff
changeset
|
1341 public final void movsbl(Register dst, AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1342 prefix(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1343 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1344 emitByte(0xBE); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1345 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1346 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1347 |
13587
40e81cba9e08
renamed movzx/movsx instructions; removed duplicate movswl; added movzbl
twisti
parents:
13586
diff
changeset
|
1348 public final void movsbl(Register dst, Register src) { |
16064
03eda0a202e9
Better fix for prefix byte for AMD64 byte instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16047
diff
changeset
|
1349 int encode = prefixAndEncode(dst.encoding, false, src.encoding, true); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1350 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1351 emitByte(0xBE); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1352 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1353 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1354 |
14001
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1355 public final void movsbq(Register dst, AMD64Address src) { |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1356 prefixq(src, dst); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1357 emitByte(0x0F); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1358 emitByte(0xBE); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1359 emitOperandHelper(dst, src); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1360 } |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1361 |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1362 public final void movsbq(Register dst, Register src) { |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1363 int encode = prefixqAndEncode(dst.encoding, src.encoding); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1364 emitByte(0x0F); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1365 emitByte(0xBE); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1366 emitByte(0xC0 | encode); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1367 } |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
13587
diff
changeset
|
1368 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1369 public final void movsd(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:
16064
diff
changeset
|
1370 assert dst.getRegisterCategory().equals(AMD64.XMM); |
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16064
diff
changeset
|
1371 assert src.getRegisterCategory().equals(AMD64.XMM); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1372 emitByte(0xF2); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1373 int encode = prefixAndEncode(dst.encoding, src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1374 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1375 emitByte(0x10); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1376 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1377 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1378 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1379 public final void movsd(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:
16064
diff
changeset
|
1380 assert dst.getRegisterCategory().equals(AMD64.XMM); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1381 emitByte(0xF2); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1382 prefix(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1383 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1384 emitByte(0x10); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1385 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1386 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1387 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1388 public final void movsd(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:
16064
diff
changeset
|
1389 assert src.getRegisterCategory().equals(AMD64.XMM); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1390 emitByte(0xF2); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1391 prefix(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1392 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1393 emitByte(0x11); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1394 emitOperandHelper(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1395 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1396 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1397 public final void movss(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:
16064
diff
changeset
|
1398 assert dst.getRegisterCategory().equals(AMD64.XMM); |
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16064
diff
changeset
|
1399 assert src.getRegisterCategory().equals(AMD64.XMM); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1400 emitByte(0xF3); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1401 int encode = prefixAndEncode(dst.encoding, src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1402 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1403 emitByte(0x10); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1404 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1405 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1406 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1407 public final void movss(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:
16064
diff
changeset
|
1408 assert dst.getRegisterCategory().equals(AMD64.XMM); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1409 emitByte(0xF3); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1410 prefix(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1411 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1412 emitByte(0x10); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1413 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1414 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1415 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1416 public final void movss(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:
16064
diff
changeset
|
1417 assert src.getRegisterCategory().equals(AMD64.XMM); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1418 emitByte(0xF3); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1419 prefix(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1420 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1421 emitByte(0x11); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1422 emitOperandHelper(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1423 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1424 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1425 public final void movswl(Register dst, AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1426 prefix(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1427 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1428 emitByte(0xBF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1429 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1430 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1431 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1432 public final void movw(AMD64Address dst, int imm16) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1433 emitByte(0x66); // switch to 16-bit mode |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1434 prefix(dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1435 emitByte(0xC7); |
8141
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
1436 emitOperandHelper(0, dst); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1437 emitShort(imm16); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1438 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1439 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1440 public final void movw(AMD64Address dst, Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1441 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1442 prefix(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1443 emitByte(0x89); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1444 emitOperandHelper(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1445 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1446 |
13587
40e81cba9e08
renamed movzx/movsx instructions; removed duplicate movswl; added movzbl
twisti
parents:
13586
diff
changeset
|
1447 public final void movzbl(Register dst, AMD64Address src) { |
40e81cba9e08
renamed movzx/movsx instructions; removed duplicate movswl; added movzbl
twisti
parents:
13586
diff
changeset
|
1448 prefix(src, dst); |
40e81cba9e08
renamed movzx/movsx instructions; removed duplicate movswl; added movzbl
twisti
parents:
13586
diff
changeset
|
1449 emitByte(0x0F); |
40e81cba9e08
renamed movzx/movsx instructions; removed duplicate movswl; added movzbl
twisti
parents:
13586
diff
changeset
|
1450 emitByte(0xB6); |
40e81cba9e08
renamed movzx/movsx instructions; removed duplicate movswl; added movzbl
twisti
parents:
13586
diff
changeset
|
1451 emitOperandHelper(dst, src); |
40e81cba9e08
renamed movzx/movsx instructions; removed duplicate movswl; added movzbl
twisti
parents:
13586
diff
changeset
|
1452 } |
40e81cba9e08
renamed movzx/movsx instructions; removed duplicate movswl; added movzbl
twisti
parents:
13586
diff
changeset
|
1453 |
40e81cba9e08
renamed movzx/movsx instructions; removed duplicate movswl; added movzbl
twisti
parents:
13586
diff
changeset
|
1454 public final void movzwl(Register dst, AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1455 prefix(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1456 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1457 emitByte(0xB7); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1458 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1459 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1460 |
14754
164903a50a9a
make ensureUniquePC an abstract method of the base Assembler class
Erik Eckstein <erik.eckstein@oracle.com>
parents:
14707
diff
changeset
|
1461 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1462 public final void ensureUniquePC() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1463 nop(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1464 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1465 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1466 public final void nop() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1467 nop(1); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1468 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1469 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1470 public void nop(int count) { |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1471 int i = count; |
6493
85c1b84f8fd9
moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents:
5875
diff
changeset
|
1472 if (UseNormalNop) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1473 assert i > 0 : " "; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1474 // The fancy nops aren't currently recognized by debuggers making it a |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1475 // pain to disassemble code while debugging. If assert are on clearly |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1476 // speed is not an issue so simply use the single byte traditional nop |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1477 // to do alignment. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1478 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1479 for (; i > 0; i--) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1480 emitByte(0x90); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1481 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1482 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1483 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1484 |
6493
85c1b84f8fd9
moved ADM64-specific assembler code into separate project
Doug Simon <doug.simon@oracle.com>
parents:
5875
diff
changeset
|
1485 if (UseAddressNop) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1486 // |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1487 // Using multi-bytes nops "0x0F 0x1F [Address]" for AMD. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1488 // 1: 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1489 // 2: 0x66 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1490 // 3: 0x66 0x66 0x90 (don't use "0x0F 0x1F 0x00" - need patching safe padding) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1491 // 4: 0x0F 0x1F 0x40 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1492 // 5: 0x0F 0x1F 0x44 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1493 // 6: 0x66 0x0F 0x1F 0x44 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1494 // 7: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1495 // 8: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1496 // 9: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1497 // 10: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1498 // 11: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1499 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1500 // The rest coding is AMD specific - use consecutive Address nops |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1501 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1502 // 12: 0x66 0x0F 0x1F 0x44 0x00 0x00 0x66 0x0F 0x1F 0x44 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1503 // 13: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00 0x66 0x0F 0x1F 0x44 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1504 // 14: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1505 // 15: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1506 // 16: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1507 // Size prefixes (0x66) are added for larger sizes |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1508 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1509 while (i >= 22) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1510 i -= 11; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1511 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1512 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1513 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1514 addrNop8(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1515 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1516 // Generate first nop for size between 21-12 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1517 switch (i) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1518 case 21: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1519 i -= 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1520 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1521 // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1522 case 20: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1523 // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1524 case 19: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1525 i -= 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1526 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1527 // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1528 case 18: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1529 // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1530 case 17: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1531 i -= 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1532 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1533 // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1534 case 16: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1535 // fall through |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1536 case 15: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1537 i -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1538 addrNop8(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1539 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1540 case 14: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1541 case 13: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1542 i -= 7; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1543 addrNop7(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1544 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1545 case 12: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1546 i -= 6; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1547 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1548 addrNop5(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1549 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1550 default: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1551 assert i < 12; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1552 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1553 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1554 // Generate second nop for size between 11-1 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1555 switch (i) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1556 case 11: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1557 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1558 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1559 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1560 addrNop8(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1561 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1562 case 10: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1563 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1564 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1565 addrNop8(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1566 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1567 case 9: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1568 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1569 addrNop8(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1570 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1571 case 8: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1572 addrNop8(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1573 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1574 case 7: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1575 addrNop7(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1576 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1577 case 6: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1578 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1579 addrNop5(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1580 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1581 case 5: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1582 addrNop5(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1583 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1584 case 4: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1585 addrNop4(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1586 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1587 case 3: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1588 // Don't use "0x0F 0x1F 0x00" - need patching safe padding |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1589 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1590 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1591 emitByte(0x90); // nop |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1592 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1593 case 2: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1594 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1595 emitByte(0x90); // nop |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1596 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1597 case 1: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1598 emitByte(0x90); // nop |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1599 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1600 default: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1601 assert i == 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1602 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1603 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1604 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1605 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1606 // Using nops with size prefixes "0x66 0x90". |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1607 // From AMD Optimization Guide: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1608 // 1: 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1609 // 2: 0x66 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1610 // 3: 0x66 0x66 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1611 // 4: 0x66 0x66 0x66 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1612 // 5: 0x66 0x66 0x90 0x66 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1613 // 6: 0x66 0x66 0x90 0x66 0x66 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1614 // 7: 0x66 0x66 0x66 0x90 0x66 0x66 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1615 // 8: 0x66 0x66 0x66 0x90 0x66 0x66 0x66 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1616 // 9: 0x66 0x66 0x90 0x66 0x66 0x90 0x66 0x66 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1617 // 10: 0x66 0x66 0x66 0x90 0x66 0x66 0x90 0x66 0x66 0x90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1618 // |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1619 while (i > 12) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1620 i -= 4; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1621 emitByte(0x66); // size prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1622 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1623 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1624 emitByte(0x90); // nop |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1625 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1626 // 1 - 12 nops |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1627 if (i > 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1628 if (i > 9) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1629 i -= 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1630 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1631 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1632 i -= 3; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1633 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1634 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1635 emitByte(0x90); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1636 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1637 // 1 - 8 nops |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1638 if (i > 4) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1639 if (i > 6) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1640 i -= 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1641 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1642 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1643 i -= 3; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1644 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1645 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1646 emitByte(0x90); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1647 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1648 switch (i) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1649 case 4: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1650 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1651 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1652 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1653 emitByte(0x90); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1654 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1655 case 3: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1656 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1657 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1658 emitByte(0x90); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1659 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1660 case 2: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1661 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1662 emitByte(0x90); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1663 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1664 case 1: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1665 emitByte(0x90); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1666 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1667 default: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1668 assert i == 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1669 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1670 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1671 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1672 public final void pop(Register dst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1673 int encode = prefixAndEncode(dst.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1674 emitByte(0x58 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1675 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1676 |
13541 | 1677 public void popfq() { |
1678 emitByte(0x9D); | |
1679 } | |
1680 | |
1681 public final void ptest(Register dst, Register src) { | |
1682 assert supports(CPUFeature.SSE4_1); | |
1683 emitByte(0x66); | |
1684 int encode = prefixAndEncode(dst.encoding, src.encoding); | |
1685 emitByte(0x0F); | |
1686 emitByte(0x38); | |
1687 emitByte(0x17); | |
1688 emitByte(0xC0 | encode); | |
1689 } | |
1690 | |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1691 public final void push(Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1692 int encode = prefixAndEncode(src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1693 emitByte(0x50 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1694 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1695 |
13309
32d2b0de15a8
added instructions for pushing and popping CPU state flags
Doug Simon <doug.simon@oracle.com>
parents:
13255
diff
changeset
|
1696 public void pushfq() { |
32d2b0de15a8
added instructions for pushing and popping CPU state flags
Doug Simon <doug.simon@oracle.com>
parents:
13255
diff
changeset
|
1697 emitByte(0x9c); |
32d2b0de15a8
added instructions for pushing and popping CPU state flags
Doug Simon <doug.simon@oracle.com>
parents:
13255
diff
changeset
|
1698 } |
32d2b0de15a8
added instructions for pushing and popping CPU state flags
Doug Simon <doug.simon@oracle.com>
parents:
13255
diff
changeset
|
1699 |
13541 | 1700 public final void pxor(Register dst, Register src) { |
1701 emitByte(0x66); | |
1702 int encode = prefixAndEncode(dst.encoding, src.encoding); | |
1703 emitByte(0x0F); | |
1704 emitByte(0xEF); | |
1705 emitByte(0xC0 | encode); | |
13309
32d2b0de15a8
added instructions for pushing and popping CPU state flags
Doug Simon <doug.simon@oracle.com>
parents:
13255
diff
changeset
|
1706 } |
32d2b0de15a8
added instructions for pushing and popping CPU state flags
Doug Simon <doug.simon@oracle.com>
parents:
13255
diff
changeset
|
1707 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1708 public final void ret(int imm16) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1709 if (imm16 == 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1710 emitByte(0xC3); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1711 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1712 emitByte(0xC2); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1713 emitShort(imm16); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1714 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1715 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1716 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1717 public final void subl(AMD64Address dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1718 SUB.getMIOpcode(DWORD, isByte(imm32)).emit(this, DWORD, dst, imm32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1719 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1720 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1721 public final void subl(Register dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1722 SUB.getMIOpcode(DWORD, isByte(imm32)).emit(this, DWORD, dst, imm32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1723 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1724 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1725 public final void testl(Register dst, int imm32) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1726 // not using emitArith because test |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1727 // doesn't support sign-extension of |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1728 // 8bit operands |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1729 int encode = dst.encoding; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1730 if (encode == 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1731 emitByte(0xA9); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1732 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1733 encode = prefixAndEncode(encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1734 emitByte(0xF7); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1735 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1736 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1737 emitInt(imm32); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1738 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1739 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1740 public final void testl(Register dst, Register src) { |
14961
d87e4eae76c4
Cleanup of AMD64 assembler.
Roland Schatz <roland.schatz@oracle.com>
parents:
14754
diff
changeset
|
1741 int encode = prefixAndEncode(dst.encoding, src.encoding); |
d87e4eae76c4
Cleanup of AMD64 assembler.
Roland Schatz <roland.schatz@oracle.com>
parents:
14754
diff
changeset
|
1742 emitByte(0x85); |
d87e4eae76c4
Cleanup of AMD64 assembler.
Roland Schatz <roland.schatz@oracle.com>
parents:
14754
diff
changeset
|
1743 emitByte(0xC0 | encode); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1744 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1745 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1746 public final void testl(Register dst, AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1747 prefix(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1748 emitByte(0x85); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1749 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1750 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1751 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1752 public final void xorl(Register dst, Register src) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1753 XOR.rmOp.emit(this, DWORD, dst, src); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1754 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1755 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1756 public final void xorpd(Register dst, Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1757 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1758 xorps(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1759 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1760 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1761 public final void xorps(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:
16064
diff
changeset
|
1762 assert dst.getRegisterCategory().equals(AMD64.XMM) && src.getRegisterCategory().equals(AMD64.XMM); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1763 int encode = prefixAndEncode(dst.encoding, src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1764 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1765 emitByte(0x57); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1766 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1767 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1768 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1769 protected final void decl(Register dst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1770 // Use two-byte form (one-byte form is a REX prefix in 64-bit mode) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1771 int encode = prefixAndEncode(dst.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1772 emitByte(0xFF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1773 emitByte(0xC8 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1774 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1775 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1776 protected final void incl(Register dst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1777 // Use two-byte form (one-byte from is a REX prefix in 64-bit mode) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1778 int encode = prefixAndEncode(dst.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1779 emitByte(0xFF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1780 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1781 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1782 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1783 private int prefixAndEncode(int regEnc) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1784 return prefixAndEncode(regEnc, false); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1785 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1786 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1787 private int prefixAndEncode(int regEnc, boolean byteinst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1788 if (regEnc >= 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1789 emitByte(Prefix.REXB); |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1790 return regEnc - 8; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1791 } else if (byteinst && regEnc >= 4) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1792 emitByte(Prefix.REX); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1793 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1794 return regEnc; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1795 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1796 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1797 private int prefixqAndEncode(int regEnc) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1798 if (regEnc < 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1799 emitByte(Prefix.REXW); |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1800 return regEnc; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1801 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1802 emitByte(Prefix.REXWB); |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1803 return regEnc - 8; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1804 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1805 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1806 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1807 private int prefixAndEncode(int dstEnc, int srcEnc) { |
16064
03eda0a202e9
Better fix for prefix byte for AMD64 byte instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16047
diff
changeset
|
1808 return prefixAndEncode(dstEnc, false, srcEnc, false); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1809 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1810 |
16064
03eda0a202e9
Better fix for prefix byte for AMD64 byte instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16047
diff
changeset
|
1811 private int prefixAndEncode(int dstEncoding, boolean dstIsByte, int srcEncoding, boolean srcIsByte) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1812 int srcEnc = srcEncoding; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1813 int dstEnc = dstEncoding; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1814 if (dstEnc < 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1815 if (srcEnc >= 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1816 emitByte(Prefix.REXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1817 srcEnc -= 8; |
16064
03eda0a202e9
Better fix for prefix byte for AMD64 byte instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16047
diff
changeset
|
1818 } else if ((srcIsByte && srcEnc >= 4) || (dstIsByte && dstEnc >= 4)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1819 emitByte(Prefix.REX); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1820 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1821 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1822 if (srcEnc < 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1823 emitByte(Prefix.REXR); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1824 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1825 emitByte(Prefix.REXRB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1826 srcEnc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1827 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1828 dstEnc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1829 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1830 return dstEnc << 3 | srcEnc; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1831 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1832 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1833 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
1834 * Creates prefix and the encoding of the lower 6 bits of the ModRM-Byte. It emits an operand |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
1835 * prefix. If the given operands exceed 3 bits, the 4th bit is encoded in the prefix. |
14961
d87e4eae76c4
Cleanup of AMD64 assembler.
Roland Schatz <roland.schatz@oracle.com>
parents:
14754
diff
changeset
|
1836 * |
5711
4d7175cf3526
enabled Eclipse/JDT javadoc checking and fixed resulting warnings
Doug Simon <doug.simon@oracle.com>
parents:
5552
diff
changeset
|
1837 * @param regEncoding the encoding of the register part of the ModRM-Byte |
4d7175cf3526
enabled Eclipse/JDT javadoc checking and fixed resulting warnings
Doug Simon <doug.simon@oracle.com>
parents:
5552
diff
changeset
|
1838 * @param rmEncoding the encoding of the r/m part of the ModRM-Byte |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1839 * @return the lower 6 bits of the ModRM-Byte that should be emitted |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1840 */ |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1841 private int prefixqAndEncode(int regEncoding, int rmEncoding) { |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1842 int rmEnc = rmEncoding; |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
1843 int regEnc = regEncoding; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1844 if (regEnc < 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1845 if (rmEnc < 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1846 emitByte(Prefix.REXW); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1847 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1848 emitByte(Prefix.REXWB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1849 rmEnc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1850 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1851 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1852 if (rmEnc < 8) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1853 emitByte(Prefix.REXWR); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1854 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1855 emitByte(Prefix.REXWRB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1856 rmEnc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1857 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1858 regEnc -= 8; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1859 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1860 return regEnc << 3 | rmEnc; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1861 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1862 |
8167
7f57c30575c8
Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents:
8141
diff
changeset
|
1863 private static boolean needsRex(Register reg) { |
7f57c30575c8
Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents:
8141
diff
changeset
|
1864 return reg.encoding >= MinEncodingNeedsRex; |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
1865 } |
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
1866 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1867 private void prefix(AMD64Address adr) { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1868 if (needsRex(adr.getBase())) { |
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1869 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1870 emitByte(Prefix.REXXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1871 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1872 emitByte(Prefix.REXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1873 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1874 } else { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1875 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1876 emitByte(Prefix.REXX); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1877 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1878 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1879 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1880 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1881 private void prefixq(AMD64Address adr) { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1882 if (needsRex(adr.getBase())) { |
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1883 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1884 emitByte(Prefix.REXWXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1885 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1886 emitByte(Prefix.REXWB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1887 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1888 } else { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1889 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1890 emitByte(Prefix.REXWX); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1891 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1892 emitByte(Prefix.REXW); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1893 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1894 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1895 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1896 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1897 private void prefix(AMD64Address adr, Register reg) { |
13372
af10ee69a8ac
fixed JDK-7079626: x64 emits unnecessary REX prefix
twisti
parents:
13350
diff
changeset
|
1898 prefix(adr, reg, false); |
af10ee69a8ac
fixed JDK-7079626: x64 emits unnecessary REX prefix
twisti
parents:
13350
diff
changeset
|
1899 } |
af10ee69a8ac
fixed JDK-7079626: x64 emits unnecessary REX prefix
twisti
parents:
13350
diff
changeset
|
1900 |
af10ee69a8ac
fixed JDK-7079626: x64 emits unnecessary REX prefix
twisti
parents:
13350
diff
changeset
|
1901 private void prefix(AMD64Address adr, Register reg, boolean byteinst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1902 if (reg.encoding < 8) { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1903 if (needsRex(adr.getBase())) { |
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1904 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1905 emitByte(Prefix.REXXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1906 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1907 emitByte(Prefix.REXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1908 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1909 } else { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1910 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1911 emitByte(Prefix.REXX); |
13372
af10ee69a8ac
fixed JDK-7079626: x64 emits unnecessary REX prefix
twisti
parents:
13350
diff
changeset
|
1912 } else if (byteinst && reg.encoding >= 4) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1913 emitByte(Prefix.REX); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1914 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1915 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1916 } else { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1917 if (needsRex(adr.getBase())) { |
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1918 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1919 emitByte(Prefix.REXRXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1920 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1921 emitByte(Prefix.REXRB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1922 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1923 } else { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1924 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1925 emitByte(Prefix.REXRX); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1926 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1927 emitByte(Prefix.REXR); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1928 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1929 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1930 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1931 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1932 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
1933 private void prefixq(AMD64Address adr, Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1934 if (src.encoding < 8) { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1935 if (needsRex(adr.getBase())) { |
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1936 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1937 emitByte(Prefix.REXWXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1938 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1939 emitByte(Prefix.REXWB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1940 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1941 } else { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1942 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1943 emitByte(Prefix.REXWX); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1944 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1945 emitByte(Prefix.REXW); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1946 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1947 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1948 } else { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1949 if (needsRex(adr.getBase())) { |
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1950 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1951 emitByte(Prefix.REXWRXB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1952 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1953 emitByte(Prefix.REXWRB); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1954 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1955 } else { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1956 if (needsRex(adr.getIndex())) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1957 emitByte(Prefix.REXWRX); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1958 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1959 emitByte(Prefix.REXWR); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1960 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1961 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1962 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1963 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1964 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1965 public final void addq(Register dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1966 ADD.getMIOpcode(QWORD, isByte(imm32)).emit(this, QWORD, dst, imm32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1967 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1968 |
20085
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
1969 public final void addq(AMD64Address dst, int imm32) { |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
1970 ADD.getMIOpcode(QWORD, isByte(imm32)).emit(this, QWORD, dst, imm32); |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
1971 } |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
1972 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1973 public final void addq(Register dst, Register src) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1974 ADD.rmOp.emit(this, QWORD, dst, src); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1975 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1976 |
19908
d1b9c58e17ce
AMD64Assembler: introduce addq(AMD64Address, Register).
Josef Eisl <josef.eisl@jku.at>
parents:
19874
diff
changeset
|
1977 public final void addq(AMD64Address dst, Register src) { |
d1b9c58e17ce
AMD64Assembler: introduce addq(AMD64Address, Register).
Josef Eisl <josef.eisl@jku.at>
parents:
19874
diff
changeset
|
1978 ADD.mrOp.emit(this, QWORD, dst, src); |
d1b9c58e17ce
AMD64Assembler: introduce addq(AMD64Address, Register).
Josef Eisl <josef.eisl@jku.at>
parents:
19874
diff
changeset
|
1979 } |
d1b9c58e17ce
AMD64Assembler: introduce addq(AMD64Address, Register).
Josef Eisl <josef.eisl@jku.at>
parents:
19874
diff
changeset
|
1980 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1981 public final void andq(Register dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
1982 AND.getMIOpcode(QWORD, isByte(imm32)).emit(this, QWORD, dst, imm32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1983 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1984 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1985 public final void bswapq(Register reg) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1986 int encode = prefixqAndEncode(reg.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1987 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1988 emitByte(0xC8 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1989 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1990 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1991 public final void cdqq() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1992 emitByte(Prefix.REXW); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1993 emitByte(0x99); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1994 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1995 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
1996 public final void cmovq(ConditionFlag cc, Register dst, Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1997 int encode = prefixqAndEncode(dst.encoding, src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1998 emitByte(0x0F); |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
1999 emitByte(0x40 | cc.getValue()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2000 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2001 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2002 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2003 public final void cmovq(ConditionFlag cc, Register dst, AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2004 prefixq(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2005 emitByte(0x0F); |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
2006 emitByte(0x40 | cc.getValue()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2007 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2008 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2009 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2010 public final void cmpq(Register dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
2011 CMP.getMIOpcode(QWORD, isByte(imm32)).emit(this, QWORD, dst, imm32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2012 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2013 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2014 public final void cmpq(Register dst, Register src) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
2015 CMP.rmOp.emit(this, QWORD, dst, src); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2016 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2017 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2018 public final void cmpq(Register dst, AMD64Address src) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
2019 CMP.rmOp.emit(this, QWORD, dst, src); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2020 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2021 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2022 public final void cmpxchgq(Register reg, AMD64Address adr) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2023 prefixq(adr, reg); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2024 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2025 emitByte(0xB1); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2026 emitOperandHelper(reg, adr); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2027 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2028 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
2029 protected final void decq(Register dst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2030 // Use two-byte form (one-byte from is a REX prefix in 64-bit mode) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2031 int encode = prefixqAndEncode(dst.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2032 emitByte(0xFF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2033 emitByte(0xC8 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2034 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2035 |
20085
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2036 public final void decq(AMD64Address dst) { |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2037 DEC.emit(this, QWORD, dst); |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2038 } |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2039 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2040 public final void incq(Register dst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2041 // Don't use it directly. Use Macroincrementq() instead. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2042 // Use two-byte form (one-byte from is a REX prefix in 64-bit mode) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2043 int encode = prefixqAndEncode(dst.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2044 emitByte(0xFF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2045 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2046 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2047 |
20085
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2048 public final void incq(AMD64Address dst) { |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2049 INC.emit(this, QWORD, dst); |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2050 } |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2051 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2052 public final void movq(Register dst, long imm64) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2053 int encode = prefixqAndEncode(dst.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2054 emitByte(0xB8 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2055 emitLong(imm64); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2056 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2057 |
13520
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13372
diff
changeset
|
2058 public final void movslq(Register dst, int imm32) { |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13372
diff
changeset
|
2059 int encode = prefixqAndEncode(dst.encoding); |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13372
diff
changeset
|
2060 emitByte(0xC7); |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13372
diff
changeset
|
2061 emitByte(0xC0 | encode); |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13372
diff
changeset
|
2062 emitInt(imm32); |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13372
diff
changeset
|
2063 } |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13372
diff
changeset
|
2064 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2065 public final void movdq(Register dst, Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2066 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2067 // table D-1 says MMX/SSE2 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2068 emitByte(0x66); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2069 |
18253
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16064
diff
changeset
|
2070 if (dst.getRegisterCategory().equals(AMD64.XMM)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2071 int encode = prefixqAndEncode(dst.encoding, src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2072 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2073 emitByte(0x6E); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2074 emitByte(0xC0 | encode); |
18253
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16064
diff
changeset
|
2075 } else if (src.getRegisterCategory().equals(AMD64.XMM)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2076 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2077 // swap src/dst to get correct prefix |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2078 int encode = prefixqAndEncode(src.encoding, dst.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2079 emitByte(0x0F); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2080 emitByte(0x7E); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2081 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2082 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2083 throw new InternalError("should not reach here"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2084 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2085 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2086 |
13541 | 2087 public final void movdqu(Register dst, AMD64Address src) { |
2088 emitByte(0xF3); | |
2089 prefix(src, dst); | |
2090 emitByte(0x0F); | |
2091 emitByte(0x6F); | |
2092 emitOperandHelper(dst, src); | |
2093 } | |
2094 | |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2095 public final void movslq(AMD64Address dst, int imm32) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2096 prefixq(dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2097 emitByte(0xC7); |
8141
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
2098 emitOperandHelper(0, dst); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2099 emitInt(imm32); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2100 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2101 |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2102 public final void movslq(Register dst, AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2103 prefixq(src, dst); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2104 emitByte(0x63); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2105 emitOperandHelper(dst, src); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2106 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2107 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2108 public final void movslq(Register dst, Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2109 int encode = prefixqAndEncode(dst.encoding, src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2110 emitByte(0x63); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2111 emitByte(0xC0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2112 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2113 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2114 public final void negq(Register dst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2115 int encode = prefixqAndEncode(dst.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2116 emitByte(0xF7); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2117 emitByte(0xD8 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2118 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2119 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2120 public final void shlq(Register dst, int imm8) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2121 assert isShiftCount(imm8 >> 1) : "illegal shift count"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2122 int encode = prefixqAndEncode(dst.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2123 if (imm8 == 1) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2124 emitByte(0xD1); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2125 emitByte(0xE0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2126 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2127 emitByte(0xC1); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2128 emitByte(0xE0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2129 emitByte(imm8); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2130 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2131 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2132 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2133 public final void shrq(Register dst, int imm8) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2134 assert isShiftCount(imm8 >> 1) : "illegal shift count"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2135 int encode = prefixqAndEncode(dst.encoding); |
15277
87ce885d0b83
add rotate instructions and make the shift encodings more uniform
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15251
diff
changeset
|
2136 if (imm8 == 1) { |
87ce885d0b83
add rotate instructions and make the shift encodings more uniform
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15251
diff
changeset
|
2137 emitByte(0xD1); |
87ce885d0b83
add rotate instructions and make the shift encodings more uniform
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15251
diff
changeset
|
2138 emitByte(0xE8 | encode); |
87ce885d0b83
add rotate instructions and make the shift encodings more uniform
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15251
diff
changeset
|
2139 } else { |
87ce885d0b83
add rotate instructions and make the shift encodings more uniform
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15251
diff
changeset
|
2140 emitByte(0xC1); |
87ce885d0b83
add rotate instructions and make the shift encodings more uniform
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15251
diff
changeset
|
2141 emitByte(0xE8 | encode); |
87ce885d0b83
add rotate instructions and make the shift encodings more uniform
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15251
diff
changeset
|
2142 emitByte(imm8); |
87ce885d0b83
add rotate instructions and make the shift encodings more uniform
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15251
diff
changeset
|
2143 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2144 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2145 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2146 public final void subq(Register dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
2147 SUB.getMIOpcode(QWORD, isByte(imm32)).emit(this, QWORD, dst, imm32); |
13252
5d2bc83e9d22
force long encoding of frame push instruction in a method without a stack bang; removed -G:StackShadowPages option
Doug Simon <doug.simon@oracle.com>
parents:
12725
diff
changeset
|
2148 } |
5d2bc83e9d22
force long encoding of frame push instruction in a method without a stack bang; removed -G:StackShadowPages option
Doug Simon <doug.simon@oracle.com>
parents:
12725
diff
changeset
|
2149 |
20085
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2150 public final void subq(AMD64Address dst, int imm32) { |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2151 SUB.getMIOpcode(QWORD, isByte(imm32)).emit(this, QWORD, dst, imm32); |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2152 } |
5a42f9b582c6
AMD64Assembler: introduce DEC and incrementq/decrementq macros for AMD64Addresses.
Josef Eisl <josef.eisl@jku.at>
parents:
20021
diff
changeset
|
2153 |
13310
733cccc125ed
added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents:
13309
diff
changeset
|
2154 public final void subqWide(Register dst, int imm32) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
2155 // don't use the sign-extending version, forcing a 32-bit immediate |
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
2156 SUB.getMIOpcode(QWORD, false).emit(this, QWORD, dst, imm32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2157 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2158 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2159 public final void subq(Register dst, Register src) { |
19874
89c729e9e0a4
Refactoring of AMD64 code generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
18841
diff
changeset
|
2160 SUB.rmOp.emit(this, QWORD, dst, src); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2161 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2162 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2163 public final void testq(Register dst, Register src) { |
14961
d87e4eae76c4
Cleanup of AMD64 assembler.
Roland Schatz <roland.schatz@oracle.com>
parents:
14754
diff
changeset
|
2164 int encode = prefixqAndEncode(dst.encoding, src.encoding); |
d87e4eae76c4
Cleanup of AMD64 assembler.
Roland Schatz <roland.schatz@oracle.com>
parents:
14754
diff
changeset
|
2165 emitByte(0x85); |
d87e4eae76c4
Cleanup of AMD64 assembler.
Roland Schatz <roland.schatz@oracle.com>
parents:
14754
diff
changeset
|
2166 emitByte(0xC0 | encode); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2167 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2168 |
15251 | 2169 public final void xaddl(AMD64Address dst, Register src) { |
2170 prefix(dst, src); | |
2171 emitByte(0x0F); | |
2172 emitByte(0xC1); | |
2173 emitOperandHelper(src, dst); | |
2174 } | |
2175 | |
2176 public final void xaddq(AMD64Address dst, Register src) { | |
2177 prefixq(dst, src); | |
2178 emitByte(0x0F); | |
2179 emitByte(0xC1); | |
2180 emitOperandHelper(src, dst); | |
2181 } | |
2182 | |
2183 public final void xchgl(Register dst, AMD64Address src) { | |
2184 prefix(src, dst); | |
2185 emitByte(0x87); | |
2186 emitOperandHelper(dst, src); | |
2187 } | |
2188 | |
2189 public final void xchgq(Register dst, AMD64Address src) { | |
2190 prefixq(src, dst); | |
2191 emitByte(0x87); | |
2192 emitOperandHelper(dst, src); | |
2193 } | |
2194 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2195 public final void membar(int barriers) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2196 if (target.isMP) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2197 // We only have to handle StoreLoad |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2198 if ((barriers & STORE_LOAD) != 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2199 // All usable chips support "locked" instructions which suffice |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2200 // as barriers, and are much faster than the alternative of |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2201 // using cpuid instruction. We use here a locked add [rsp],0. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2202 // This is conveniently otherwise a no-op except for blowing |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2203 // flags. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2204 // Any change to this code may need to revisit other places in |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2205 // the code where this idiom is used, in particular the |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2206 // orderAccess code. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2207 lock(); |
8167
7f57c30575c8
Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents:
8141
diff
changeset
|
2208 addl(new AMD64Address(rsp, 0), 0); // Assert the lock# signal here |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2209 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2210 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2211 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2212 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2213 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2214 protected final void patchJumpTarget(int branch, int branchTarget) { |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
2215 int op = getByte(branch); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2216 assert op == 0xE8 // call |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
2217 || |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
2218 op == 0x00 // jump table entry |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
2219 || op == 0xE9 // jmp |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
2220 || op == 0xEB // short jmp |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
2221 || (op & 0xF0) == 0x70 // short jcc |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
2222 || op == 0x0F && (getByte(branch + 1) & 0xF0) == 0x80 // jcc |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2223 : "Invalid opcode at patch point branch=" + branch + ", branchTarget=" + branchTarget + ", op=" + op; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2224 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2225 if (op == 0x00) { |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
2226 int offsetToJumpTableBase = getShort(branch + 1); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2227 int jumpTableBase = branch - offsetToJumpTableBase; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2228 int imm32 = branchTarget - jumpTableBase; |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
2229 emitInt(imm32, branch); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2230 } else if (op == 0xEB || (op & 0xF0) == 0x70) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2231 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2232 // short offset operators (jmp and jcc) |
13586
7737fbb055b0
check branch displacement when patching short branches
twisti
parents:
13541
diff
changeset
|
2233 final int imm8 = branchTarget - (branch + 2); |
7737fbb055b0
check branch displacement when patching short branches
twisti
parents:
13541
diff
changeset
|
2234 /* |
7737fbb055b0
check branch displacement when patching short branches
twisti
parents:
13541
diff
changeset
|
2235 * Since a wrongly patched short branch can potentially lead to working but really bad |
7737fbb055b0
check branch displacement when patching short branches
twisti
parents:
13541
diff
changeset
|
2236 * behaving code we should always fail with an exception instead of having an assert. |
7737fbb055b0
check branch displacement when patching short branches
twisti
parents:
13541
diff
changeset
|
2237 */ |
7737fbb055b0
check branch displacement when patching short branches
twisti
parents:
13541
diff
changeset
|
2238 if (!NumUtil.isByte(imm8)) { |
7737fbb055b0
check branch displacement when patching short branches
twisti
parents:
13541
diff
changeset
|
2239 throw new InternalError("branch displacement out of range: " + imm8); |
7737fbb055b0
check branch displacement when patching short branches
twisti
parents:
13541
diff
changeset
|
2240 } |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
2241 emitByte(imm8, branch + 1); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2242 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2243 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2244 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2245 int off = 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2246 if (op == 0x0F) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2247 off = 2; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2248 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2249 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2250 int imm32 = branchTarget - (branch + 4 + off); |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
2251 emitInt(imm32, branch + off); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2252 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2253 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2254 |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
20085
diff
changeset
|
2255 public void nullCheck(AMD64Address address) { |
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
20085
diff
changeset
|
2256 testl(AMD64.rax, address); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2257 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2258 |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4249
diff
changeset
|
2259 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2260 public void align(int modulus) { |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
2261 if (position() % modulus != 0) { |
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
14001
diff
changeset
|
2262 nop(modulus - (position() % modulus)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2263 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2264 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2265 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2266 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
2267 * Emits a direct call instruction. Note that the actual call target is not specified, because |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
2268 * all calls need patching anyway. Therefore, 0 is emitted as the call target, and the user is |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7369
diff
changeset
|
2269 * responsible to add the call address to the appropriate patching tables. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2270 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2271 public final void call() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2272 emitByte(0xE8); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2273 emitInt(0); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2274 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2275 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
2276 public final void call(Register src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2277 int encode = prefixAndEncode(src.encoding); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2278 emitByte(0xFF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2279 emitByte(0xD0 | encode); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2280 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2281 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
2282 public final void int3() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2283 emitByte(0xCC); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2284 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2285 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2286 private void emitx87(int b1, int b2, int i) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2287 assert 0 <= i && i < 8 : "illegal stack offset"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2288 emitByte(b1); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2289 emitByte(b2 + i); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2290 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2291 |
10513
00b70a864d3b
updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents:
9791
diff
changeset
|
2292 public final void fldd(AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2293 emitByte(0xDD); |
8141
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
2294 emitOperandHelper(0, src); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2295 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2296 |
10513
00b70a864d3b
updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents:
9791
diff
changeset
|
2297 public final void flds(AMD64Address src) { |
9581
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2298 emitByte(0xD9); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2299 emitOperandHelper(0, src); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2300 } |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2301 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
2302 public final void fldln2() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2303 emitByte(0xD9); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2304 emitByte(0xED); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2305 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2306 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
2307 public final void fldlg2() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2308 emitByte(0xD9); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2309 emitByte(0xEC); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2310 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2311 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
2312 public final void fyl2x() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2313 emitByte(0xD9); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2314 emitByte(0xF1); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2315 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2316 |
10513
00b70a864d3b
updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents:
9791
diff
changeset
|
2317 public final void fstps(AMD64Address src) { |
9581
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2318 emitByte(0xD9); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2319 emitOperandHelper(3, src); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2320 } |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2321 |
10513
00b70a864d3b
updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents:
9791
diff
changeset
|
2322 public final void fstpd(AMD64Address src) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2323 emitByte(0xDD); |
8141
73536049fa29
Use int instead of Register for opcode extensions that are encoded in the ModR/M byte.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
2324 emitOperandHelper(3, src); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2325 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2326 |
9581
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2327 private void emitFPUArith(int b1, int b2, int i) { |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2328 assert 0 <= i && i < 8 : "illegal FPU register: " + i; |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2329 emitByte(b1); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2330 emitByte(b2 + i); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2331 } |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2332 |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2333 public void ffree(int i) { |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2334 emitFPUArith(0xDD, 0xC0, i); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2335 } |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2336 |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2337 public void fincstp() { |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2338 emitByte(0xD9); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2339 emitByte(0xF7); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2340 } |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2341 |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2342 public void fxch(int i) { |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2343 emitFPUArith(0xD9, 0xC8, i); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2344 } |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2345 |
10513
00b70a864d3b
updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents:
9791
diff
changeset
|
2346 public void fnstswAX() { |
9581
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2347 emitByte(0xDF); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2348 emitByte(0xE0); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2349 } |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2350 |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2351 public void fwait() { |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2352 emitByte(0x9B); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2353 } |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2354 |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2355 public void fprem() { |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2356 emitByte(0xD9); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2357 emitByte(0xF8); |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2358 } |
d84ea522800e
replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9561
diff
changeset
|
2359 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
2360 public final void fsin() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2361 emitByte(0xD9); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2362 emitByte(0xFE); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2363 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2364 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
2365 public final void fcos() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2366 emitByte(0xD9); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2367 emitByte(0xFF); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2368 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2369 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
2370 public final void fptan() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2371 emitByte(0xD9); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2372 emitByte(0xF2); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2373 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2374 |
7823
287ef060b7c0
Clean up of AMD64Assembler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7808
diff
changeset
|
2375 public final void fstp(int i) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2376 emitx87(0xDD, 0xD8, i); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2377 } |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2378 |
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2379 @Override |
8170
537f03d2bdf7
Removed unused parameter from AbstractAssembler.makeAddress().
Roland Schatz <roland.schatz@oracle.com>
parents:
8167
diff
changeset
|
2380 public AMD64Address makeAddress(Register base, int displacement) { |
537f03d2bdf7
Removed unused parameter from AbstractAssembler.makeAddress().
Roland Schatz <roland.schatz@oracle.com>
parents:
8167
diff
changeset
|
2381 return new AMD64Address(base, displacement); |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2382 } |
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2383 |
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2384 @Override |
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2385 public AMD64Address getPlaceholder() { |
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2386 return Placeholder; |
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7832
diff
changeset
|
2387 } |
13255
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2388 |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2389 private void prefetchPrefix(AMD64Address src) { |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2390 prefix(src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2391 emitByte(0x0F); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2392 } |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2393 |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2394 public void prefetchnta(AMD64Address src) { |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2395 prefetchPrefix(src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2396 emitByte(0x18); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2397 emitOperandHelper(0, src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2398 } |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2399 |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2400 void prefetchr(AMD64Address src) { |
13350
2c3b59f34619
add CPUFeature EnumSet to target description with appropriate asserts
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13310
diff
changeset
|
2401 assert supports(CPUFeature.AMD_3DNOW_PREFETCH); |
13255
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2402 prefetchPrefix(src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2403 emitByte(0x0D); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2404 emitOperandHelper(0, src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2405 } |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2406 |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2407 public void prefetcht0(AMD64Address src) { |
13350
2c3b59f34619
add CPUFeature EnumSet to target description with appropriate asserts
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13310
diff
changeset
|
2408 assert supports(CPUFeature.SSE); |
13255
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2409 prefetchPrefix(src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2410 emitByte(0x18); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2411 emitOperandHelper(1, src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2412 } |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2413 |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2414 public void prefetcht1(AMD64Address src) { |
13350
2c3b59f34619
add CPUFeature EnumSet to target description with appropriate asserts
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13310
diff
changeset
|
2415 assert supports(CPUFeature.SSE); |
13255
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2416 prefetchPrefix(src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2417 emitByte(0x18); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2418 emitOperandHelper(2, src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2419 } |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2420 |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2421 public void prefetcht2(AMD64Address src) { |
13350
2c3b59f34619
add CPUFeature EnumSet to target description with appropriate asserts
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13310
diff
changeset
|
2422 assert supports(CPUFeature.SSE); |
13255
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2423 prefix(src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2424 emitByte(0x0f); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2425 emitByte(0x18); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2426 emitOperandHelper(3, src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2427 } |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2428 |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2429 public void prefetchw(AMD64Address src) { |
13350
2c3b59f34619
add CPUFeature EnumSet to target description with appropriate asserts
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13310
diff
changeset
|
2430 assert supports(CPUFeature.AMD_3DNOW_PREFETCH); |
13255
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2431 prefix(src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2432 emitByte(0x0f); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2433 emitByte(0x0D); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2434 emitOperandHelper(1, src); |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2435 } |
785bbb619238
Basic allocation prefetching support
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13252
diff
changeset
|
2436 |
20021
4b6965a278cf
Fix allocation counter issue where the counters sometimes gives way too high values for allocated bytes
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19972
diff
changeset
|
2437 /** |
4b6965a278cf
Fix allocation counter issue where the counters sometimes gives way too high values for allocated bytes
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19972
diff
changeset
|
2438 * Emits an instruction which is considered to be illegal. This is used if we deliberately want |
4b6965a278cf
Fix allocation counter issue where the counters sometimes gives way too high values for allocated bytes
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19972
diff
changeset
|
2439 * to crash the program (debugging etc.). |
4b6965a278cf
Fix allocation counter issue where the counters sometimes gives way too high values for allocated bytes
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19972
diff
changeset
|
2440 */ |
4b6965a278cf
Fix allocation counter issue where the counters sometimes gives way too high values for allocated bytes
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19972
diff
changeset
|
2441 public void illegal() { |
4b6965a278cf
Fix allocation counter issue where the counters sometimes gives way too high values for allocated bytes
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19972
diff
changeset
|
2442 emitByte(0x0f); |
4b6965a278cf
Fix allocation counter issue where the counters sometimes gives way too high values for allocated bytes
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19972
diff
changeset
|
2443 emitByte(0x0b); |
4b6965a278cf
Fix allocation counter issue where the counters sometimes gives way too high values for allocated bytes
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
19972
diff
changeset
|
2444 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2445 } |