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 * As spot in 8259353. We need to do a shrink and an expand together to not accidentally 34 * zero out elements in the physical registers that may not be zero in general cases. 35 * 36 * In some methods, 2 consecutive ReinterpretNodes may be optimized out. 37 */ 38 public class TestVectorDoubleExpandShrink { 39 @Test 40 @IR(failOn = REINTERPRET_NODE) 41 public static void testB64toB128(byte[] input, byte[] output) { 42 vectorDoubleExpandShrink(BSPEC64, BSPEC128, input, output); 43 } 44 45 @Run(test = "testB64toB128") 46 public static void runB64toB128() throws Throwable { 47 runDoubleExpandShrinkHelper(BSPEC64, BSPEC128); 48 } 49 50 @Test 51 @IR(failOn = REINTERPRET_NODE) 52 public static void testB64toB256(byte[] input, byte[] output) { 53 vectorDoubleExpandShrink(BSPEC64, BSPEC256, input, output); 54 } 55 56 @Run(test = "testB64toB256") 57 public static void runB64toB256() throws Throwable { 58 runDoubleExpandShrinkHelper(BSPEC64, BSPEC256); 59 } 60 61 @Test 62 @IR(failOn = REINTERPRET_NODE) 63 public static void testB64toB512(byte[] input, byte[] output) { 64 vectorDoubleExpandShrink(BSPEC64, BSPEC512, input, output); 65 } 66 67 @Run(test = "testB64toB512") 68 public static void runB64toB512() throws Throwable { 69 runDoubleExpandShrinkHelper(BSPEC64, BSPEC512); 70 } 71 72 @Test 73 @IR(counts = {REINTERPRET_NODE, "2"}) 74 public static void testB128toB64(byte[] input, byte[] output) { 75 vectorDoubleExpandShrink(BSPEC128, BSPEC64, input, output); 76 } 77 78 @Run(test = "testB128toB64") 79 public static void runB128toB64() throws Throwable { 80 runDoubleExpandShrinkHelper(BSPEC128, BSPEC64); 81 } 82 83 @Test 84 @IR(failOn = REINTERPRET_NODE) 85 public static void testB128toB256(byte[] input, byte[] output) { 86 vectorDoubleExpandShrink(BSPEC128, BSPEC256, input, output); 87 } 88 89 @Run(test = "testB128toB256") 90 public static void runB128toB256() throws Throwable { 91 runDoubleExpandShrinkHelper(BSPEC128, BSPEC256); 92 } 93 94 @Test 95 @IR(failOn = REINTERPRET_NODE) 96 public static void testB128toB512(byte[] input, byte[] output) { 97 vectorDoubleExpandShrink(BSPEC128, BSPEC512, input, output); 98 } 99 100 @Run(test = "testB128toB512") 101 public static void runB128toB512() throws Throwable { 102 runDoubleExpandShrinkHelper(BSPEC128, BSPEC512); 103 } 104 105 @Test 106 @IR(counts = {REINTERPRET_NODE, "2"}) 107 public static void testB256toB64(byte[] input, byte[] output) { 108 vectorDoubleExpandShrink(BSPEC256, BSPEC64, input, output); 109 } 110 111 @Run(test = "testB256toB64") 112 public static void runB256toB64() throws Throwable { 113 runDoubleExpandShrinkHelper(BSPEC256, BSPEC64); 114 } 115 116 @Test 117 @IR(counts = {REINTERPRET_NODE, "2"}) 118 public static void testB256toB128(byte[] input, byte[] output) { 119 vectorDoubleExpandShrink(BSPEC256, BSPEC128, input, output); 120 } 121 122 @Run(test = "testB256toB128") 123 public static void runB256toB128() throws Throwable { 124 runDoubleExpandShrinkHelper(BSPEC256, BSPEC128); 125 } 126 127 @Test 128 @IR(failOn = REINTERPRET_NODE) 129 public static void testB256toB512(byte[] input, byte[] output) { 130 vectorDoubleExpandShrink(BSPEC256, BSPEC512, input, output); 131 } 132 133 @Run(test = "testB256toB512") 134 public static void runB256toB512() throws Throwable { 135 runDoubleExpandShrinkHelper(BSPEC256, BSPEC512); 136 } 137 138 @Test 139 @IR(counts = {REINTERPRET_NODE, "2"}) 140 public static void testB512toB64(byte[] input, byte[] output) { 141 vectorDoubleExpandShrink(BSPEC512, BSPEC64, input, output); 142 } 143 144 @Run(test = "testB512toB64") 145 public static void runB512toB64() throws Throwable { 146 runDoubleExpandShrinkHelper(BSPEC512, BSPEC64); 147 } 148 149 @Test 150 @IR(counts = {REINTERPRET_NODE, "2"}) 151 public static void testB512toB128(byte[] input, byte[] output) { 152 vectorDoubleExpandShrink(BSPEC512, BSPEC128, input, output); 153 } 154 155 @Run(test = "testB512toB128") 156 public static void runB512toB128() throws Throwable { 157 runDoubleExpandShrinkHelper(BSPEC512, BSPEC128); 158 } 159 160 @Test 161 @IR(counts = {REINTERPRET_NODE, "2"}) 162 public static void testB512toB256(byte[] input, byte[] output) { 163 vectorDoubleExpandShrink(BSPEC512, BSPEC256, input, output); 164 } 165 166 @Run(test = "testB512toB256") 167 public static void runB512toB256() throws Throwable { 168 runDoubleExpandShrinkHelper(BSPEC512, BSPEC256); 169 } 170 } --- EOF ---