Skip to content

Commit 97c9682

Browse files
committed
Update Helpers.cs
1 parent 29c440c commit 97c9682

File tree

1 file changed

+72
-120
lines changed
  • src/tests/JIT/HardwareIntrinsics/Arm/Shared

1 file changed

+72
-120
lines changed

src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs

Lines changed: 72 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,30 @@ public static int LastActiveElement(byte[] v)
168168
return -1;
169169
}
170170

171+
public static int LastActiveElement(sbyte[] v)
172+
{
173+
for (var i = v.Length - 1; i >= 0; i--)
174+
{
175+
if (v[i] != 0)
176+
{
177+
return i;
178+
}
179+
}
180+
return -1;
181+
}
182+
183+
public static int LastActiveElement(short[] v)
184+
{
185+
for (var i = v.Length - 1; i >= 0; i--)
186+
{
187+
if (v[i] != 0)
188+
{
189+
return i;
190+
}
191+
}
192+
return -1;
193+
}
194+
171195
public static int LastActiveElement(ushort[] v)
172196
{
173197
for (var i = v.Length - 1; i >= 0; i--)
@@ -180,6 +204,18 @@ public static int LastActiveElement(ushort[] v)
180204
return -1;
181205
}
182206

207+
public static int LastActiveElement(int[] v)
208+
{
209+
for (var i = v.Length - 1; i >= 0; i--)
210+
{
211+
if (v[i] != 0)
212+
{
213+
return i;
214+
}
215+
}
216+
return -1;
217+
}
218+
183219
public static int LastActiveElement(uint[] v)
184220
{
185221
for (var i = v.Length - 1; i >= 0; i--)
@@ -192,6 +228,18 @@ public static int LastActiveElement(uint[] v)
192228
return -1;
193229
}
194230

231+
public static int LastActiveElement(long[] v)
232+
{
233+
for (var i = v.Length - 1; i >= 0; i--)
234+
{
235+
if (v[i] != 0)
236+
{
237+
return i;
238+
}
239+
}
240+
return -1;
241+
}
242+
195243
public static int LastActiveElement(ulong[] v)
196244
{
197245
for (var i = v.Length - 1; i >= 0; i--)
@@ -204,6 +252,30 @@ public static int LastActiveElement(ulong[] v)
204252
return -1;
205253
}
206254

255+
private static int LastActiveElement(float[] v)
256+
{
257+
for (int i = v.Length - 1; i >= 0; i--)
258+
{
259+
if (Unsafe.BitCast<float, int>(v[i]) != 0)
260+
{
261+
return i;
262+
}
263+
}
264+
return -1;
265+
}
266+
267+
private static int LastActiveElement(double[] v)
268+
{
269+
for (int i = v.Length - 1; i >= 0; i--)
270+
{
271+
if (Unsafe.BitCast<double, long>(v[i]) != 0)
272+
{
273+
return i;
274+
}
275+
}
276+
return -1;
277+
}
278+
207279
public static byte[] CreateMaskForNextActiveElement(byte[] mask, byte[] srcMask)
208280
{
209281
var count = srcMask.Length;
@@ -7578,18 +7650,6 @@ public static ulong Splice(ulong[] first, ulong[] second, ulong[] maskArray, int
75787650
return (index < rangeSize) ? first[start + index] : second[index - rangeSize];
75797651
}
75807652

7581-
private static int LastActiveElement(byte[] mask) {
7582-
for (int i = mask.Length - 1; i >= 0; i--)
7583-
{
7584-
if (mask[i] != 0)
7585-
{
7586-
return i;
7587-
}
7588-
}
7589-
7590-
return -1;
7591-
}
7592-
75937653
private static byte ConditionalExtract(byte[] op1, byte op2, byte[] op3, bool after)
75947654
{
75957655
int last = LastActiveElement(op1);
@@ -7671,18 +7731,6 @@ public static byte[] ConditionalExtractLastActiveElementAndReplicate(byte[] op1,
76717731
return ConditionalExtract(op1, op2, op3, /* after = */ false, /* replicate = */ true);
76727732
}
76737733

7674-
private static int LastActiveElement(sbyte[] mask) {
7675-
for (int i = mask.Length - 1; i >= 0; i--)
7676-
{
7677-
if (mask[i] != 0)
7678-
{
7679-
return i;
7680-
}
7681-
}
7682-
7683-
return -1;
7684-
}
7685-
76867734
private static sbyte ConditionalExtract(sbyte[] op1, sbyte op2, sbyte[] op3, bool after)
76877735
{
76887736
int last = LastActiveElement(op1);
@@ -7764,18 +7812,6 @@ public static sbyte[] ConditionalExtractLastActiveElementAndReplicate(sbyte[] op
77647812
return ConditionalExtract(op1, op2, op3, /* after = */ false, /* replicate = */ true);
77657813
}
77667814

7767-
private static int LastActiveElement(short[] mask) {
7768-
for (int i = mask.Length - 1; i >= 0; i--)
7769-
{
7770-
if (mask[i] != 0)
7771-
{
7772-
return i;
7773-
}
7774-
}
7775-
7776-
return -1;
7777-
}
7778-
77797815
private static short ConditionalExtract(short[] op1, short op2, short[] op3, bool after)
77807816
{
77817817
int last = LastActiveElement(op1);
@@ -7857,18 +7893,6 @@ public static short[] ConditionalExtractLastActiveElementAndReplicate(short[] op
78577893
return ConditionalExtract(op1, op2, op3, /* after = */ false, /* replicate = */ true);
78587894
}
78597895

7860-
private static int LastActiveElement(ushort[] mask) {
7861-
for (int i = mask.Length - 1; i >= 0; i--)
7862-
{
7863-
if (mask[i] != 0)
7864-
{
7865-
return i;
7866-
}
7867-
}
7868-
7869-
return -1;
7870-
}
7871-
78727896
private static ushort ConditionalExtract(ushort[] op1, ushort op2, ushort[] op3, bool after)
78737897
{
78747898
int last = LastActiveElement(op1);
@@ -7950,18 +7974,6 @@ public static ushort[] ConditionalExtractLastActiveElementAndReplicate(ushort[]
79507974
return ConditionalExtract(op1, op2, op3, /* after = */ false, /* replicate = */ true);
79517975
}
79527976

7953-
private static int LastActiveElement(int[] mask) {
7954-
for (int i = mask.Length - 1; i >= 0; i--)
7955-
{
7956-
if (mask[i] != 0)
7957-
{
7958-
return i;
7959-
}
7960-
}
7961-
7962-
return -1;
7963-
}
7964-
79657977
private static int ConditionalExtract(int[] op1, int op2, int[] op3, bool after)
79667978
{
79677979
int last = LastActiveElement(op1);
@@ -8043,18 +8055,6 @@ public static int[] ConditionalExtractLastActiveElementAndReplicate(int[] op1, i
80438055
return ConditionalExtract(op1, op2, op3, /* after = */ false, /* replicate = */ true);
80448056
}
80458057

8046-
private static int LastActiveElement(uint[] mask) {
8047-
for (int i = mask.Length - 1; i >= 0; i--)
8048-
{
8049-
if (mask[i] != 0)
8050-
{
8051-
return i;
8052-
}
8053-
}
8054-
8055-
return -1;
8056-
}
8057-
80588058
private static uint ConditionalExtract(uint[] op1, uint op2, uint[] op3, bool after)
80598059
{
80608060
int last = LastActiveElement(op1);
@@ -8136,18 +8136,6 @@ public static uint[] ConditionalExtractLastActiveElementAndReplicate(uint[] op1,
81368136
return ConditionalExtract(op1, op2, op3, /* after = */ false, /* replicate = */ true);
81378137
}
81388138

8139-
private static int LastActiveElement(long[] mask) {
8140-
for (int i = mask.Length - 1; i >= 0; i--)
8141-
{
8142-
if (mask[i] != 0)
8143-
{
8144-
return i;
8145-
}
8146-
}
8147-
8148-
return -1;
8149-
}
8150-
81518139
private static long ConditionalExtract(long[] op1, long op2, long[] op3, bool after)
81528140
{
81538141
int last = LastActiveElement(op1);
@@ -8234,18 +8222,6 @@ public static ulong ConditionalExtractAfterLastActiveElement(ulong[] op1, ulong
82348222
return ConditionalExtract(op1, op2, op3, /* after = */ true);
82358223
}
82368224

8237-
private static int LastActiveElement(ulong[] mask) {
8238-
for (int i = mask.Length - 1; i >= 0; i--)
8239-
{
8240-
if (mask[i] != 0)
8241-
{
8242-
return i;
8243-
}
8244-
}
8245-
8246-
return -1;
8247-
}
8248-
82498225
private static ulong ConditionalExtract(ulong[] op1, ulong op2, ulong[] op3, bool after)
82508226
{
82518227
int last = LastActiveElement(op1);
@@ -8322,18 +8298,6 @@ public static ulong[] ConditionalExtractLastActiveElementAndReplicate(ulong[] op
83228298
return ConditionalExtract(op1, op2, op3, /* after = */ false, /* replicate = */ true);
83238299
}
83248300

8325-
private static int LastActiveElement(float[] mask) {
8326-
for (int i = mask.Length - 1; i >= 0; i--)
8327-
{
8328-
if (Unsafe.BitCast<float, int>(mask[i]) != 0)
8329-
{
8330-
return i;
8331-
}
8332-
}
8333-
8334-
return -1;
8335-
}
8336-
83378301
private static float ConditionalExtract(float[] op1, float op2, float[] op3, bool after)
83388302
{
83398303
int last = LastActiveElement(op1);
@@ -8415,18 +8379,6 @@ public static float[] ConditionalExtractLastActiveElementAndReplicate(float[] op
84158379
return ConditionalExtract(op1, op2, op3, /* after = */ false, /* replicate = */ true);
84168380
}
84178381

8418-
private static int LastActiveElement(double[] mask) {
8419-
for (int i = mask.Length - 1; i >= 0; i--)
8420-
{
8421-
if (Unsafe.BitCast<double, long>(mask[i]) != 0)
8422-
{
8423-
return i;
8424-
}
8425-
}
8426-
8427-
return -1;
8428-
}
8429-
84308382
private static double ConditionalExtract(double[] op1, double op2, double[] op3, bool after)
84318383
{
84328384
int last = LastActiveElement(op1);

0 commit comments

Comments
 (0)