Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -93,6 +93,9 @@ public static void ReductionInit(int[] a, int[] b) {
@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]);
Expand All @@ -104,6 +107,9 @@ public static int minReductionImplement(int[] a, int[] b, int res) {
@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]);
Expand Down
18 changes: 17 additions & 1 deletion test/hotspot/jtreg/compiler/loopopts/superword/RedTest_int.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -135,6 +135,10 @@ public static void reductionInit2(
@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,
Expand All @@ -152,6 +156,10 @@ public static int sumReductionImplement(
@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,
Expand All @@ -169,6 +177,10 @@ public static int orReductionImplement(
@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,
Expand All @@ -186,6 +198,10 @@ public static int andReductionImplement(
@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,
Expand Down
18 changes: 17 additions & 1 deletion test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -138,6 +138,10 @@ public static void reductionInit2(
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,
Expand All @@ -156,6 +160,10 @@ public static long sumReductionImplement(
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,
Expand All @@ -174,6 +182,10 @@ public static long orReductionImplement(
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,
Expand All @@ -192,6 +204,10 @@ public static long andReductionImplement(
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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -96,6 +96,12 @@ public static void sumReductionInit(
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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -91,6 +91,10 @@ public static void sumReductionInit(
@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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -109,6 +109,10 @@ public static double sumReductionImplement(
@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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -92,6 +92,10 @@ public static void sumReductionInit(
@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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -92,6 +92,10 @@ public static void sumReductionInit(
@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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -96,6 +96,10 @@ public static void sumReductionInit(
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,
Expand Down