Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/aarch64/LongLogicTests.java
32282 views
1
public class LongLogicTests {
2
3
private static final long IMM = 0xf0f0f0f0f0f0f0f0L;
4
private static final long NO_IMM = 0x123456d5123456d5L;
5
private static long test_and(long a, long b) {
6
return a & b;
7
}
8
9
private static long test_andc1(long a) {
10
// Generates immediate instruction.
11
return a & IMM;
12
}
13
14
private static long test_andc2(long a) {
15
// Generates non-immediate instruction.
16
return a & NO_IMM;
17
}
18
19
private static long test_or(long a, long b) {
20
return a | b;
21
}
22
23
private static long test_orc1(long a) {
24
// Generates immediate instruction.
25
return a | IMM;
26
}
27
28
private static long test_orc2(long a) {
29
// Generates non-immediate instruction.
30
return a | NO_IMM;
31
}
32
33
private static long test_xor(long a, long b) {
34
return a ^ b;
35
}
36
37
private static long test_xorc1(long a) {
38
// Generates immediate instruction.
39
return a ^ IMM;
40
}
41
42
private static long test_xorc2(long a) {
43
// Generates non-immediate instruction.
44
return a ^ NO_IMM;
45
}
46
47
private static void assertThat(boolean assertion) {
48
if (! assertion) {
49
throw new AssertionError();
50
}
51
}
52
53
public static void main(String[] args) {
54
55
assertThat(test_and(0x21, 0x31) == 0x21);
56
assertThat(test_andc1(0xaaaaaaaaaaaaaaaaL) == 0xa0a0a0a0a0a0a0a0L);
57
assertThat(test_andc2(0xaaaaaaaaaaaaaaaaL) == 0x0220028002200280L);
58
59
assertThat(test_or(0x21, 0x31) == 0x31);
60
assertThat(test_orc1(0xaaaaaaaaaaaaaaaaL) == 0xfafafafafafafafaL);
61
assertThat(test_orc2(0xaaaaaaaaaaaaaaaaL) == 0xbabefeffbabefeffL);
62
63
assertThat(test_xor(0x21, 0x31) == 16);
64
assertThat(test_xorc1(0xaaaaaaaaaaaaaaaaL) == 0x5a5a5a5a5a5a5a5aL);
65
assertThat(test_xorc2(0xaaaaaaaaaaaaaaaaL) == 0xb89efc7fb89efc7fL);
66
}
67
}
68
69