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