23
23
24
24
/*
25
25
* @test
26
+ * @bug 8183390 8332905
26
27
* @summary Vectorization test on bug-prone shift operation
27
28
* @library /test/lib /
28
29
*
48
49
public class ArrayShiftOpTest extends VectorizationTestRunner {
49
50
50
51
private static final int SIZE = 543 ;
52
+ private static int size = 543 ;
51
53
52
54
private int [] ints ;
53
55
private long [] longs ;
@@ -71,7 +73,7 @@ public ArrayShiftOpTest() {
71
73
}
72
74
73
75
@ Test
74
- @ IR (applyIfCPUFeatureOr = {"asimd" , "true" , "avx512f " , "true" },
76
+ @ IR (applyIfCPUFeatureOr = {"asimd" , "true" , "avx2 " , "true" },
75
77
counts = {IRNode .STORE_VECTOR , ">0" })
76
78
@ IR (applyIfCPUFeature = {"avx512f" , "true" },
77
79
counts = {IRNode .ROTATE_RIGHT_V , ">0" })
@@ -87,7 +89,23 @@ public int[] intCombinedRotateShift() {
87
89
}
88
90
89
91
@ Test
90
- @ IR (applyIfCPUFeatureOr = {"asimd" , "true" , "avx512f" , "true" },
92
+ @ IR (applyIfCPUFeatureOr = {"sve" , "true" , "avx2" , "true" },
93
+ counts = {IRNode .STORE_VECTOR , ">0" })
94
+ @ IR (applyIfCPUFeature = {"avx512f" , "true" },
95
+ counts = {IRNode .ROTATE_RIGHT_V , ">0" })
96
+ // Requires size to not be known at compile time, otherwise the shift
97
+ // can get constant folded with the (iv + const) pattern from the
98
+ // PopulateIndex.
99
+ public int [] intCombinedRotateShiftWithPopulateIndex () {
100
+ int [] res = new int [size ];
101
+ for (int i = 0 ; i < size ; i ++) {
102
+ res [i ] = (i << 14 ) | (i >>> 18 );
103
+ }
104
+ return res ;
105
+ }
106
+
107
+ @ Test
108
+ @ IR (applyIfCPUFeatureOr = {"asimd" , "true" , "avx2" , "true" },
91
109
counts = {IRNode .STORE_VECTOR , ">0" })
92
110
@ IR (applyIfCPUFeature = {"avx512f" , "true" },
93
111
counts = {IRNode .ROTATE_RIGHT_V , ">0" })
0 commit comments