< prev index next >

test/hotspot/jtreg/compiler/vectorapi/reshape/tests/TestVectorExpandShrink.java

Print this page

  1 /*
  2  * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 
 24 package compiler.vectorapi.reshape.tests;
 25 
 26 import compiler.lib.ir_framework.IR;
 27 import compiler.lib.ir_framework.Run;
 28 import compiler.lib.ir_framework.Test;

 29 
 30 import static compiler.vectorapi.reshape.utils.VectorReshapeHelper.*;
 31 
 32 /**
 33  *  This class contains method to ensure a resizing reinterpretation operations work as
 34  *  intended.
 35  *
 36  *  In each test, the ReinterpretNode is expected to appear exactly once.
 37  */
 38 public class TestVectorExpandShrink {
 39     @Test
 40     @IR(counts = {REINTERPRET_NODE, "1"})
 41     public static void testB64toB128(byte[] input, byte[] output) {
 42         vectorExpandShrink(BSPEC64, BSPEC128, input, output);
 43     }
 44 
 45     @Run(test = "testB64toB128")
 46     public static void runB64toB128() throws Throwable {
 47         runExpandShrinkHelper(BSPEC64, BSPEC128);
 48     }
 49 
 50     @Test
 51     @IR(counts = {REINTERPRET_NODE, "1"})
 52     public static void testB64toB256(byte[] input, byte[] output) {
 53         vectorExpandShrink(BSPEC64, BSPEC256, input, output);
 54     }
 55 
 56     @Run(test = "testB64toB256")
 57     public static void runB64toB256() throws Throwable {
 58         runExpandShrinkHelper(BSPEC64, BSPEC256);
 59     }
 60 
 61     @Test
 62     @IR(counts = {REINTERPRET_NODE, "1"})
 63     public static void testB64toB512(byte[] input, byte[] output) {
 64         vectorExpandShrink(BSPEC64, BSPEC512, input, output);
 65     }
 66 
 67     @Run(test = "testB64toB512")
 68     public static void runB64toB512() throws Throwable {
 69         runExpandShrinkHelper(BSPEC64, BSPEC512);
 70     }
 71 
 72     @Test
 73     @IR(counts = {REINTERPRET_NODE, "1"})
 74     public static void testB128toB64(byte[] input, byte[] output) {
 75         vectorExpandShrink(BSPEC128, BSPEC64, input, output);
 76     }
 77 
 78     @Run(test = "testB128toB64")
 79     public static void runB128toB64() throws Throwable {
 80         runExpandShrinkHelper(BSPEC128, BSPEC64);
 81     }
 82 
 83     @Test
 84     @IR(counts = {REINTERPRET_NODE, "1"})
 85     public static void testB128toB256(byte[] input, byte[] output) {
 86         vectorExpandShrink(BSPEC128, BSPEC256, input, output);
 87     }
 88 
 89     @Run(test = "testB128toB256")
 90     public static void runB128toB256() throws Throwable {
 91         runExpandShrinkHelper(BSPEC128, BSPEC256);
 92     }
 93 
 94     @Test
 95     @IR(counts = {REINTERPRET_NODE, "1"})
 96     public static void testB128toB512(byte[] input, byte[] output) {
 97         vectorExpandShrink(BSPEC128, BSPEC512, input, output);
 98     }
 99 
100     @Run(test = "testB128toB512")
101     public static void runB128toB512() throws Throwable {
102         runExpandShrinkHelper(BSPEC128, BSPEC512);
103     }
104 
105     @Test
106     @IR(counts = {REINTERPRET_NODE, "1"})
107     public static void testB256toB64(byte[] input, byte[] output) {
108         vectorExpandShrink(BSPEC256, BSPEC64, input, output);
109     }
110 
111     @Run(test = "testB256toB64")
112     public static void runB256toB64() throws Throwable {
113         runExpandShrinkHelper(BSPEC256, BSPEC64);
114     }
115 
116     @Test
117     @IR(counts = {REINTERPRET_NODE, "1"})
118     public static void testB256toB128(byte[] input, byte[] output) {
119         vectorExpandShrink(BSPEC256, BSPEC128, input, output);
120     }
121 
122     @Run(test = "testB256toB128")
123     public static void runB256toB128() throws Throwable {
124         runExpandShrinkHelper(BSPEC256, BSPEC128);
125     }
126 
127     @Test
128     @IR(counts = {REINTERPRET_NODE, "1"})
129     public static void testB256toB512(byte[] input, byte[] output) {
130         vectorExpandShrink(BSPEC256, BSPEC512, input, output);
131     }
132 
133     @Run(test = "testB256toB512")
134     public static void runB256toB512() throws Throwable {
135         runExpandShrinkHelper(BSPEC256, BSPEC512);
136     }
137 
138     @Test
139     @IR(counts = {REINTERPRET_NODE, "1"})
140     public static void testB512toB64(byte[] input, byte[] output) {
141         vectorExpandShrink(BSPEC512, BSPEC64, input, output);
142     }
143 
144     @Run(test = "testB512toB64")
145     public static void runB512toB64() throws Throwable {
146         runExpandShrinkHelper(BSPEC512, BSPEC64);
147     }
148 
149     @Test
150     @IR(counts = {REINTERPRET_NODE, "1"})
151     public static void testB512toB128(byte[] input, byte[] output) {
152         vectorExpandShrink(BSPEC512, BSPEC128, input, output);
153     }
154 
155     @Run(test = "testB512toB128")
156     public static void runB512toB128() throws Throwable {
157         runExpandShrinkHelper(BSPEC512, BSPEC128);
158     }
159 
160     @Test
161     @IR(counts = {REINTERPRET_NODE, "1"})
162     public static void testB512toB256(byte[] input, byte[] output) {
163         vectorExpandShrink(BSPEC512, BSPEC256, input, output);
164     }
165 
166     @Run(test = "testB512toB256")
167     public static void runB512toB256() throws Throwable {
168         runExpandShrinkHelper(BSPEC512, BSPEC256);
169     }
170 }

  1 /*
  2  * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 
 24 package compiler.vectorapi.reshape.tests;
 25 
 26 import compiler.lib.ir_framework.IR;
 27 import compiler.lib.ir_framework.Run;
 28 import compiler.lib.ir_framework.Test;
 29 import jdk.incubator.foreign.MemorySegment;
 30 
 31 import static compiler.vectorapi.reshape.utils.VectorReshapeHelper.*;
 32 
 33 /**
 34  *  This class contains method to ensure a resizing reinterpretation operations work as
 35  *  intended.
 36  *
 37  *  In each test, the ReinterpretNode is expected to appear exactly once.
 38  */
 39 public class TestVectorExpandShrink {
 40     @Test
 41     @IR(counts = {REINTERPRET_NODE, "1"})
 42     public static void testB64toB128(MemorySegment input, MemorySegment output) {
 43         vectorExpandShrink(BSPEC64, BSPEC128, input, output);
 44     }
 45 
 46     @Run(test = "testB64toB128")
 47     public static void runB64toB128() throws Throwable {
 48         runExpandShrinkHelper(BSPEC64, BSPEC128);
 49     }
 50 
 51     @Test
 52     @IR(counts = {REINTERPRET_NODE, "1"})
 53     public static void testB64toB256(MemorySegment input, MemorySegment output) {
 54         vectorExpandShrink(BSPEC64, BSPEC256, input, output);
 55     }
 56 
 57     @Run(test = "testB64toB256")
 58     public static void runB64toB256() throws Throwable {
 59         runExpandShrinkHelper(BSPEC64, BSPEC256);
 60     }
 61 
 62     @Test
 63     @IR(counts = {REINTERPRET_NODE, "1"})
 64     public static void testB64toB512(MemorySegment input, MemorySegment output) {
 65         vectorExpandShrink(BSPEC64, BSPEC512, input, output);
 66     }
 67 
 68     @Run(test = "testB64toB512")
 69     public static void runB64toB512() throws Throwable {
 70         runExpandShrinkHelper(BSPEC64, BSPEC512);
 71     }
 72 
 73     @Test
 74     @IR(counts = {REINTERPRET_NODE, "1"})
 75     public static void testB128toB64(MemorySegment input, MemorySegment output) {
 76         vectorExpandShrink(BSPEC128, BSPEC64, input, output);
 77     }
 78 
 79     @Run(test = "testB128toB64")
 80     public static void runB128toB64() throws Throwable {
 81         runExpandShrinkHelper(BSPEC128, BSPEC64);
 82     }
 83 
 84     @Test
 85     @IR(counts = {REINTERPRET_NODE, "1"})
 86     public static void testB128toB256(MemorySegment input, MemorySegment output) {
 87         vectorExpandShrink(BSPEC128, BSPEC256, input, output);
 88     }
 89 
 90     @Run(test = "testB128toB256")
 91     public static void runB128toB256() throws Throwable {
 92         runExpandShrinkHelper(BSPEC128, BSPEC256);
 93     }
 94 
 95     @Test
 96     @IR(counts = {REINTERPRET_NODE, "1"})
 97     public static void testB128toB512(MemorySegment input, MemorySegment output) {
 98         vectorExpandShrink(BSPEC128, BSPEC512, input, output);
 99     }
100 
101     @Run(test = "testB128toB512")
102     public static void runB128toB512() throws Throwable {
103         runExpandShrinkHelper(BSPEC128, BSPEC512);
104     }
105 
106     @Test
107     @IR(counts = {REINTERPRET_NODE, "1"})
108     public static void testB256toB64(MemorySegment input, MemorySegment output) {
109         vectorExpandShrink(BSPEC256, BSPEC64, input, output);
110     }
111 
112     @Run(test = "testB256toB64")
113     public static void runB256toB64() throws Throwable {
114         runExpandShrinkHelper(BSPEC256, BSPEC64);
115     }
116 
117     @Test
118     @IR(counts = {REINTERPRET_NODE, "1"})
119     public static void testB256toB128(MemorySegment input, MemorySegment output) {
120         vectorExpandShrink(BSPEC256, BSPEC128, input, output);
121     }
122 
123     @Run(test = "testB256toB128")
124     public static void runB256toB128() throws Throwable {
125         runExpandShrinkHelper(BSPEC256, BSPEC128);
126     }
127 
128     @Test
129     @IR(counts = {REINTERPRET_NODE, "1"})
130     public static void testB256toB512(MemorySegment input, MemorySegment output) {
131         vectorExpandShrink(BSPEC256, BSPEC512, input, output);
132     }
133 
134     @Run(test = "testB256toB512")
135     public static void runB256toB512() throws Throwable {
136         runExpandShrinkHelper(BSPEC256, BSPEC512);
137     }
138 
139     @Test
140     @IR(counts = {REINTERPRET_NODE, "1"})
141     public static void testB512toB64(MemorySegment input, MemorySegment output) {
142         vectorExpandShrink(BSPEC512, BSPEC64, input, output);
143     }
144 
145     @Run(test = "testB512toB64")
146     public static void runB512toB64() throws Throwable {
147         runExpandShrinkHelper(BSPEC512, BSPEC64);
148     }
149 
150     @Test
151     @IR(counts = {REINTERPRET_NODE, "1"})
152     public static void testB512toB128(MemorySegment input, MemorySegment output) {
153         vectorExpandShrink(BSPEC512, BSPEC128, input, output);
154     }
155 
156     @Run(test = "testB512toB128")
157     public static void runB512toB128() throws Throwable {
158         runExpandShrinkHelper(BSPEC512, BSPEC128);
159     }
160 
161     @Test
162     @IR(counts = {REINTERPRET_NODE, "1"})
163     public static void testB512toB256(MemorySegment input, MemorySegment output) {
164         vectorExpandShrink(BSPEC512, BSPEC256, input, output);
165     }
166 
167     @Run(test = "testB512toB256")
168     public static void runB512toB256() throws Throwable {
169         runExpandShrinkHelper(BSPEC512, BSPEC256);
170     }
171 }
< prev index next >