8309660: C2: failed: XMM register should be 0-15 (UseKNLSetting and ConvF2HF)

Co-authored-by: Sandhya Viswanathan <sviswanathan@openjdk.org>
Reviewed-by: sviswanathan, jbhateja
This commit is contained in:
Emanuel Peter 2023-07-03 06:50:16 +00:00
parent 52ee570025
commit 2c29705d7b
2 changed files with 36 additions and 4 deletions

View File

@ -3625,7 +3625,7 @@ instruct sqrtD_reg(regD dst) %{
ins_pipe(pipe_slow); ins_pipe(pipe_slow);
%} %}
instruct convF2HF_reg_reg(rRegI dst, regF src, regF tmp) %{ instruct convF2HF_reg_reg(rRegI dst, vlRegF src, vlRegF tmp) %{
effect(TEMP tmp); effect(TEMP tmp);
match(Set dst (ConvF2HF src)); match(Set dst (ConvF2HF src));
ins_cost(125); ins_cost(125);
@ -3669,7 +3669,7 @@ instruct vconvF2HF_mem_reg(memory mem, vec src) %{
ins_pipe( pipe_slow ); ins_pipe( pipe_slow );
%} %}
instruct convHF2F_reg_reg(regF dst, rRegI src) %{ instruct convHF2F_reg_reg(vlRegF dst, rRegI src) %{
match(Set dst (ConvHF2F src)); match(Set dst (ConvHF2F src));
format %{ "vcvtph2ps $dst,$src" %} format %{ "vcvtph2ps $dst,$src" %}
ins_encode %{ ins_encode %{

View File

@ -58,7 +58,14 @@ public class TestFloatConversionsVector {
} }
} }
@Run(test = {"test_float_float16"}, mode = RunMode.STANDALONE) @Test
public void test_float_float16_strided(short[] sout, float[] finp) {
for (int i = 0; i < finp.length/2; i++) {
sout[i*2] = Float.floatToFloat16(finp[i*2]);
}
}
@Run(test = {"test_float_float16", "test_float_float16_strided"}, mode = RunMode.STANDALONE)
public void kernel_test_float_float16() { public void kernel_test_float_float16() {
finp = new float[ARRLEN]; finp = new float[ARRLEN];
sout = new short[ARRLEN]; sout = new short[ARRLEN];
@ -75,6 +82,15 @@ public class TestFloatConversionsVector {
for (int i = 0; i < ARRLEN; i++) { for (int i = 0; i < ARRLEN; i++) {
Asserts.assertEquals(Float.floatToFloat16(finp[i]), sout[i]); Asserts.assertEquals(Float.floatToFloat16(finp[i]), sout[i]);
} }
for (int i = 0; i < ITERS; i++) {
test_float_float16_strided(sout, finp);
}
// Verifying the result
for (int i = 0; i < ARRLEN/2; i++) {
Asserts.assertEquals(Float.floatToFloat16(finp[i*2]), sout[i*2]);
}
} }
@Test @Test
@ -85,7 +101,14 @@ public class TestFloatConversionsVector {
} }
} }
@Run(test = {"test_float16_float"}, mode = RunMode.STANDALONE) @Test
public void test_float16_float_strided(float[] fout, short[] sinp) {
for (int i = 0; i < sinp.length/2; i++) {
fout[i*2] = Float.float16ToFloat(sinp[i*2]);
}
}
@Run(test = {"test_float16_float", "test_float16_float_strided"}, mode = RunMode.STANDALONE)
public void kernel_test_float16_float() { public void kernel_test_float16_float() {
sinp = new short[ARRLEN]; sinp = new short[ARRLEN];
fout = new float[ARRLEN]; fout = new float[ARRLEN];
@ -102,5 +125,14 @@ public class TestFloatConversionsVector {
for (int i = 0; i < ARRLEN; i++) { for (int i = 0; i < ARRLEN; i++) {
Asserts.assertEquals(Float.float16ToFloat(sinp[i]), fout[i]); Asserts.assertEquals(Float.float16ToFloat(sinp[i]), fout[i]);
} }
for (int i = 0; i < ITERS; i++) {
test_float16_float_strided(fout, sinp);
}
// Verifying the result
for (int i = 0; i < ARRLEN/2; i++) {
Asserts.assertEquals(Float.float16ToFloat(sinp[i*2]), fout[i*2]);
}
} }
} }