8327147: Improve performance of Math ceil, floor, and rint for x86
Reviewed-by: jbhateja, sviswanathan, dlong
This commit is contained in:
parent
972e81d1ad
commit
7c5e6e74c8
@ -6135,7 +6135,7 @@ void Assembler::smovl() {
|
|||||||
void Assembler::roundsd(XMMRegister dst, XMMRegister src, int32_t rmode) {
|
void Assembler::roundsd(XMMRegister dst, XMMRegister src, int32_t rmode) {
|
||||||
assert(VM_Version::supports_sse4_1(), "");
|
assert(VM_Version::supports_sse4_1(), "");
|
||||||
InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
|
InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
|
||||||
int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
|
int encode = simd_prefix_and_encode(dst, src, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes);
|
||||||
emit_int24(0x0B, (0xC0 | encode), (unsigned char)rmode);
|
emit_int24(0x0B, (0xC0 | encode), (unsigned char)rmode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3874,22 +3874,14 @@ instruct roundD_reg(legRegD dst, legRegD src, immU8 rmode) %{
|
|||||||
ins_cost(150);
|
ins_cost(150);
|
||||||
ins_encode %{
|
ins_encode %{
|
||||||
assert(UseSSE >= 4, "required");
|
assert(UseSSE >= 4, "required");
|
||||||
|
if ((UseAVX == 0) && ($dst$$XMMRegister != $src$$XMMRegister)) {
|
||||||
|
__ pxor($dst$$XMMRegister, $dst$$XMMRegister);
|
||||||
|
}
|
||||||
__ roundsd($dst$$XMMRegister, $src$$XMMRegister, $rmode$$constant);
|
__ roundsd($dst$$XMMRegister, $src$$XMMRegister, $rmode$$constant);
|
||||||
%}
|
%}
|
||||||
ins_pipe(pipe_slow);
|
ins_pipe(pipe_slow);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
instruct roundD_mem(legRegD dst, memory src, immU8 rmode) %{
|
|
||||||
match(Set dst (RoundDoubleMode (LoadD src) rmode));
|
|
||||||
format %{ "roundsd $dst,$src" %}
|
|
||||||
ins_cost(150);
|
|
||||||
ins_encode %{
|
|
||||||
assert(UseSSE >= 4, "required");
|
|
||||||
__ roundsd($dst$$XMMRegister, $src$$Address, $rmode$$constant);
|
|
||||||
%}
|
|
||||||
ins_pipe(pipe_slow);
|
|
||||||
%}
|
|
||||||
|
|
||||||
instruct roundD_imm(legRegD dst, immD con, immU8 rmode) %{
|
instruct roundD_imm(legRegD dst, immD con, immU8 rmode) %{
|
||||||
match(Set dst (RoundDoubleMode con rmode));
|
match(Set dst (RoundDoubleMode con rmode));
|
||||||
format %{ "roundsd $dst,[$constantaddress]\t# load from constant table: double=$con" %}
|
format %{ "roundsd $dst,[$constantaddress]\t# load from constant table: double=$con" %}
|
||||||
|
@ -141,6 +141,11 @@ public class MathBench {
|
|||||||
return Math.ceil(double4Dot1);
|
return Math.ceil(double4Dot1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Benchmark
|
||||||
|
public double addCeilFloorDouble() {
|
||||||
|
return Math.ceil(double4Dot1) + Math.floor(double4Dot1);
|
||||||
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
public double copySignDouble() {
|
public double copySignDouble() {
|
||||||
return Math.copySign(double81, doubleNegative12);
|
return Math.copySign(double81, doubleNegative12);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user