mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8349666: RISC-V: enable superwords tests for vector reductions
Reviewed-by: fyang, luhenry
This commit is contained in:
parent
8f6ccde982
commit
4a83ca1202
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -93,6 +93,9 @@ public class MinMaxRed_Int {
|
||||
@IR(applyIf = {"SuperWordReductions", "true"},
|
||||
applyIfCPUFeatureOr = { "sse4.1", "true" , "asimd" , "true"},
|
||||
counts = {IRNode.MIN_REDUCTION_V, " > 0"})
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
counts = {IRNode.MIN_REDUCTION_V, " > 0"})
|
||||
public static int minReductionImplement(int[] a, int[] b, int res) {
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
res = Math.min(res, a[i] * b[i]);
|
||||
@ -104,6 +107,9 @@ public class MinMaxRed_Int {
|
||||
@IR(applyIf = {"SuperWordReductions", "true"},
|
||||
applyIfCPUFeatureOr = { "sse4.1", "true" , "asimd" , "true"},
|
||||
counts = {IRNode.MAX_REDUCTION_V, " > 0"})
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
counts = {IRNode.MAX_REDUCTION_V, " > 0"})
|
||||
public static int maxReductionImplement(int[] a, int[] b, int res) {
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
res = Math.max(res, a[i] * b[i]);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -135,6 +135,10 @@ public class RedTest_int {
|
||||
@IR(applyIfCPUFeature = {"sse4.1", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VI, ">= 1", IRNode.ADD_REDUCTION_VI, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VI, ">= 1", IRNode.ADD_REDUCTION_VI, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
public static int sumReductionImplement(
|
||||
int[] a,
|
||||
int[] b,
|
||||
@ -152,6 +156,10 @@ public class RedTest_int {
|
||||
@IR(applyIfCPUFeature = {"sse4.1", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.OR_REDUCTION_V, ">= 1", IRNode.OR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.OR_REDUCTION_V, ">= 1", IRNode.OR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
public static int orReductionImplement(
|
||||
int[] a,
|
||||
int[] b,
|
||||
@ -169,6 +177,10 @@ public class RedTest_int {
|
||||
@IR(applyIfCPUFeature = {"sse4.1", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.AND_REDUCTION_V, ">= 1", IRNode.AND_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.AND_REDUCTION_V, ">= 1", IRNode.AND_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
public static int andReductionImplement(
|
||||
int[] a,
|
||||
int[] b,
|
||||
@ -186,6 +198,10 @@ public class RedTest_int {
|
||||
@IR(applyIfCPUFeature = {"sse4.1", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.XOR_REDUCTION_V, ">= 1", IRNode.XOR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.XOR_REDUCTION_V, ">= 1", IRNode.XOR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
public static int xorReductionImplement(
|
||||
int[] a,
|
||||
int[] b,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -138,6 +138,10 @@ public class RedTest_long {
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
applyIfPlatform = {"64-bit", "true"},
|
||||
counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
public static long sumReductionImplement(
|
||||
long[] a,
|
||||
long[] b,
|
||||
@ -156,6 +160,10 @@ public class RedTest_long {
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
applyIfPlatform = {"64-bit", "true"},
|
||||
counts = {IRNode.OR_REDUCTION_V, ">= 1", IRNode.OR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.OR_REDUCTION_V, ">= 1", IRNode.OR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
public static long orReductionImplement(
|
||||
long[] a,
|
||||
long[] b,
|
||||
@ -174,6 +182,10 @@ public class RedTest_long {
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
applyIfPlatform = {"64-bit", "true"},
|
||||
counts = {IRNode.AND_REDUCTION_V, ">= 1", IRNode.AND_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.AND_REDUCTION_V, ">= 1", IRNode.AND_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
public static long andReductionImplement(
|
||||
long[] a,
|
||||
long[] b,
|
||||
@ -192,6 +204,10 @@ public class RedTest_long {
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
applyIfPlatform = {"64-bit", "true"},
|
||||
counts = {IRNode.XOR_REDUCTION_V, ">= 1", IRNode.XOR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.XOR_REDUCTION_V, ">= 1", IRNode.XOR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
public static long xorReductionImplement(
|
||||
long[] a,
|
||||
long[] b,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -96,6 +96,12 @@ public class SumRedAbsNeg_Float {
|
||||
counts = {IRNode.ADD_REDUCTION_VF, ">= 1",
|
||||
IRNode.ABS_VF, IRNode.VECTOR_SIZE + "min(LoopMaxUnroll, max_float)", ">= 1",
|
||||
IRNode.NEG_VF, IRNode.VECTOR_SIZE + "min(LoopMaxUnroll, max_float)", ">= 1"})
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VF, ">= 1",
|
||||
IRNode.ABS_VF, IRNode.VECTOR_SIZE + "min(LoopMaxUnroll, max_float)", ">= 1",
|
||||
IRNode.NEG_VF, IRNode.VECTOR_SIZE + "min(LoopMaxUnroll, max_float)", ">= 1"})
|
||||
public static float sumReductionImplement(
|
||||
float[] a,
|
||||
float[] b,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -91,6 +91,10 @@ public class SumRedSqrt_Double {
|
||||
@IR(applyIfCPUFeature = {"avx", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VD, ">= 1", IRNode.SQRT_VD, ">= 1"})
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VD, ">= 1", IRNode.SQRT_VD, ">= 1"})
|
||||
public static double sumReductionWithStoreImplement(
|
||||
double[] a,
|
||||
double[] b,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -109,6 +109,10 @@ public class SumRed_Double {
|
||||
@IR(applyIfCPUFeature = {"sse2", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VD, ">= 1"})
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VD, ">= 1"})
|
||||
public static double sumReductionWithStoreImplement(
|
||||
double[] a,
|
||||
double[] b,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,6 +92,10 @@ public class SumRed_Float {
|
||||
@IR(applyIfCPUFeature = {"sse2", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VF, ">= 1"})
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VF, ">= 1"})
|
||||
public static float sumReductionImplement(
|
||||
float[] a,
|
||||
float[] b,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,6 +92,10 @@ public class SumRed_Int {
|
||||
@IR(applyIfCPUFeature = {"sse4.1", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VI, ">= 1", IRNode.ADD_REDUCTION_VI, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VI, ">= 1", IRNode.ADD_REDUCTION_VI, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
public static int sumReductionImplement(
|
||||
int[] a,
|
||||
int[] b,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -96,6 +96,10 @@ public class SumRed_Long {
|
||||
applyIfCPUFeature = {"avx2", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
@IR(applyIfPlatform = {"riscv64", "true"},
|
||||
applyIfCPUFeature = {"rvv", "true"},
|
||||
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
|
||||
counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
|
||||
public static long sumReductionImplement(
|
||||
long[] a,
|
||||
long[] b,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user