Skip to content

Commit

Permalink
8264054: Bad XMM performance on java.lang.MathBench.sqrtDouble
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Caspole <ecaspole@openjdk.org>
Co-authored-by: Charlie Hunt <huntch@openjdk.org>
Reviewed-by: neliasso, kvn, vlivanov
  • Loading branch information
3 people committed Apr 1, 2021
1 parent 16acfaf commit 52d8a22
Show file tree
Hide file tree
Showing 3 changed files with 896 additions and 68 deletions.
71 changes: 12 additions & 59 deletions src/hotspot/cpu/x86/x86.ad
Expand Up @@ -3232,73 +3232,26 @@ instruct negD_reg_reg(vlRegD dst, vlRegD src) %{
ins_pipe(pipe_slow);
%}

instruct sqrtF_reg(regF dst, regF src) %{
// sqrtss instruction needs destination register to be pre initialized for best performance
// Therefore only the instruct rule where the input is pre-loaded into dst register is defined below
instruct sqrtF_reg(regF dst) %{
predicate(UseSSE>=1);
match(Set dst (SqrtF src));

format %{ "sqrtss $dst, $src" %}
ins_cost(150);
ins_encode %{
__ sqrtss($dst$$XMMRegister, $src$$XMMRegister);
%}
ins_pipe(pipe_slow);
%}

instruct sqrtF_mem(regF dst, memory src) %{
predicate(UseSSE>=1);
match(Set dst (SqrtF (LoadF src)));

format %{ "sqrtss $dst, $src" %}
ins_cost(150);
ins_encode %{
__ sqrtss($dst$$XMMRegister, $src$$Address);
%}
ins_pipe(pipe_slow);
%}

instruct sqrtF_imm(regF dst, immF con) %{
predicate(UseSSE>=1);
match(Set dst (SqrtF con));

format %{ "sqrtss $dst, [$constantaddress]\t# load from constant table: float=$con" %}
ins_cost(150);
match(Set dst (SqrtF dst));
format %{ "sqrtss $dst, $dst" %}
ins_encode %{
__ sqrtss($dst$$XMMRegister, $constantaddress($con));
__ sqrtss($dst$$XMMRegister, $dst$$XMMRegister);
%}
ins_pipe(pipe_slow);
%}

instruct sqrtD_reg(regD dst, regD src) %{
// sqrtsd instruction needs destination register to be pre initialized for best performance
// Therefore only the instruct rule where the input is pre-loaded into dst register is defined below
instruct sqrtD_reg(regD dst) %{
predicate(UseSSE>=2);
match(Set dst (SqrtD src));

format %{ "sqrtsd $dst, $src" %}
ins_cost(150);
ins_encode %{
__ sqrtsd($dst$$XMMRegister, $src$$XMMRegister);
%}
ins_pipe(pipe_slow);
%}

instruct sqrtD_mem(regD dst, memory src) %{
predicate(UseSSE>=2);
match(Set dst (SqrtD (LoadD src)));

format %{ "sqrtsd $dst, $src" %}
ins_cost(150);
ins_encode %{
__ sqrtsd($dst$$XMMRegister, $src$$Address);
%}
ins_pipe(pipe_slow);
%}

instruct sqrtD_imm(regD dst, immD con) %{
predicate(UseSSE>=2);
match(Set dst (SqrtD con));
format %{ "sqrtsd $dst, [$constantaddress]\t# load from constant table: double=$con" %}
ins_cost(150);
match(Set dst (SqrtD dst));
format %{ "sqrtsd $dst, $dst" %}
ins_encode %{
__ sqrtsd($dst$$XMMRegister, $constantaddress($con));
__ sqrtsd($dst$$XMMRegister, $dst$$XMMRegister);
%}
ins_pipe(pipe_slow);
%}
Expand Down

1 comment on commit 52d8a22

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.