mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8283726: x86_64 intrinsics for compareUnsigned method in Integer and Long
Reviewed-by: kvn, jbhateja
This commit is contained in:
parent
b96ba19807
commit
108cd69516
15 changed files with 271 additions and 11 deletions
|
@ -49,6 +49,7 @@ public class Longs {
|
|||
@Param("500")
|
||||
private int size;
|
||||
|
||||
private long bound;
|
||||
private String[] strings;
|
||||
private long[] longArraySmall;
|
||||
private long[] longArrayBig;
|
||||
|
@ -56,6 +57,7 @@ public class Longs {
|
|||
@Setup
|
||||
public void setup() {
|
||||
var random = ThreadLocalRandom.current();
|
||||
bound = 20000L;
|
||||
strings = new String[size];
|
||||
longArraySmall = new long[size];
|
||||
longArrayBig = new long[size];
|
||||
|
@ -141,4 +143,20 @@ public class Longs {
|
|||
bh.consume(longArrayBig[i] << longArraySmall[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void compareUnsignedIndirect(Blackhole bh) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
int r = (Long.compareUnsigned(longArraySmall[i], bound - 16) < 0) ? 1 : 0;
|
||||
bh.consume(r);
|
||||
}
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void compareUnsignedDirect(Blackhole bh) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
int r = Long.compareUnsigned(longArraySmall[i], bound - 16);
|
||||
bh.consume(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue