Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/codegen/TestMultiMemInstructionMatching.java
41149 views
1
/*
2
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 8240905
27
* @summary Test matching of instructions that have multiple memory inputs.
28
* @run main/othervm -Xbatch -XX:-TieredCompilation
29
* compiler.codegen.TestMultiMemInstructionMatching
30
*/
31
32
package compiler.codegen;
33
34
public class TestMultiMemInstructionMatching {
35
36
static volatile int iFldV = 42;
37
static volatile long lFldV = 42;
38
static int iFld = 42;
39
static long lFld = 42;
40
41
// Integer versions
42
43
static int test_blsiI_rReg_mem_1() {
44
return (0 - iFldV) & iFldV;
45
}
46
47
static int test_blsiI_rReg_mem_2() {
48
int sub = (0 - iFld);
49
iFldV++;
50
return sub & iFld;
51
}
52
53
static int test_blsrI_rReg_mem_1() {
54
return (iFldV - 1) & iFldV;
55
}
56
57
static int test_blsrI_rReg_mem_2() {
58
int sub = (iFld - 1);
59
iFldV++;
60
return sub & iFld;
61
}
62
63
static int test_blsmskI_rReg_mem_1() {
64
return (iFldV - 1) ^ iFldV;
65
}
66
67
static int test_blsmskI_rReg_mem_2() {
68
int sub = (iFld - 1);
69
iFldV++;
70
return sub ^ iFld;
71
}
72
73
// Long versions
74
75
static long test_blsiL_rReg_mem_1() {
76
return (0 - lFldV) & lFldV;
77
}
78
79
static long test_blsiL_rReg_mem_2() {
80
long sub = (0 - lFld);
81
lFldV++;
82
return sub & lFld;
83
}
84
85
static long test_blsrL_rReg_mem_1() {
86
return (lFldV - 1) & lFldV;
87
}
88
89
static long test_blsrL_rReg_mem_2() {
90
long sub = (lFld - 1);
91
lFldV++;
92
return sub & lFld;
93
}
94
95
static long test_blsmskL_rReg_mem_1() {
96
return (lFldV - 1) ^ lFldV;
97
}
98
99
static long test_blsmskL_rReg_mem_2() {
100
long sub = (lFld - 1);
101
lFldV++;
102
return sub ^ lFld;
103
}
104
105
public static void main(String[] args) {
106
for (int i = 0;i < 100_000;++i) {
107
test_blsiI_rReg_mem_1();
108
test_blsiI_rReg_mem_2();
109
test_blsrI_rReg_mem_1();
110
test_blsrI_rReg_mem_2();
111
test_blsmskI_rReg_mem_1();
112
test_blsmskI_rReg_mem_2();
113
114
test_blsiL_rReg_mem_1();
115
test_blsiL_rReg_mem_2();
116
test_blsrL_rReg_mem_1();
117
test_blsrL_rReg_mem_2();
118
test_blsmskL_rReg_mem_1();
119
test_blsmskL_rReg_mem_2();
120
}
121
}
122
}
123
124