Skip to content

Commit 4a1a076

Browse files
Implement various other simple vector APIs from 93513 (#103837)
* Update Vector<T> to implement ISimdVector<TSelf, T> * Expose various constants for Vector2/3/4 * Expose Exp, Log, and Log2 on the other vector types * Expose CopySign on the vector types * Expose DegreesToRadians and RadiansToDegrees on the vector types * Expose Hypot on the vector types * Expose Lerp on the vector types * Expose Truncate and Round on the vector types * Cleanup some of the implementations to use helper functions where possible * Expose Max, MaxMagnitude, MaxMagnitudeNumber, MaxNumber, Min, MinMagnitude, MinMagnitudeNumber, and MinNumber for the vector types * Expose Clamp on the various vector types * Ensure mono handles the various zero and low-cost vector conversions * Apply formatting patch * Ensure that TensorPrimitives uses the in-box vector operations on .NET 9+ * Fix some build failures * Workaround a MonoJIT assertion * Ensure Hypot for double handles insignificant results * Remove part of the mono changes that were extracted to a separate PR * Apply suggestions from code review Co-authored-by: Stephen Toub <stoub@microsoft.com> * Ensure tests are added for the new vector APIs * Fix the mono handling for IsNaN, IsNegative, and IsPositive * Use the right op for WASM * Fix a round test to correctly expect -0 * Fix some tests where the wrong parameter counts were being passed * Ensure APIs are correctly handled for Vector<T> * Fix the mono handling for OP_XCOMPARE_FP * Have Mono use the proper klass for IsPositive/IsNegative since we're reinterpreting * Ensure Mono looks up the class namespace * Ensure mono inserts xcast where required and handles MultiplyAddEstimate * Add missing underscores to fix the mono build * Add the if is_element_type_primitive check to MultiplyAddEstimate for mono * Pass the right klass on Mono * Ensure mono sets the metadata for add_ins * Ensure mono passes down the cast arg0 * Fix the lerp for Mono to match the managed impl * Ensure mono lerp uses ins_amount for scaling y * Use gtCloneExpr after the first fgMakeMultiUse if we need another copy * Combine the SN_IsNegative and SN_IsPositive logic * Update src/mono/mono/mini/simd-intrinsics.c --------- Co-authored-by: Stephen Toub <stoub@microsoft.com>
1 parent c7fa446 commit 4a1a076

File tree

70 files changed

+12134
-3418
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+12134
-3418
lines changed

src/coreclr/jit/compiler.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3292,6 +3292,31 @@ class Compiler
32923292
CorInfoType simdBaseJitType,
32933293
unsigned simdSize);
32943294

3295+
GenTree* gtNewSimdIsNaNNode(var_types type,
3296+
GenTree* op1,
3297+
CorInfoType simdBaseJitType,
3298+
unsigned simdSize);
3299+
3300+
GenTree* gtNewSimdIsNegativeNode(var_types type,
3301+
GenTree* op1,
3302+
CorInfoType simdBaseJitType,
3303+
unsigned simdSize);
3304+
3305+
GenTree* gtNewSimdIsPositiveNode(var_types type,
3306+
GenTree* op1,
3307+
CorInfoType simdBaseJitType,
3308+
unsigned simdSize);
3309+
3310+
GenTree* gtNewSimdIsPositiveInfinityNode(var_types type,
3311+
GenTree* op1,
3312+
CorInfoType simdBaseJitType,
3313+
unsigned simdSize);
3314+
3315+
GenTree* gtNewSimdIsZeroNode(var_types type,
3316+
GenTree* op1,
3317+
CorInfoType simdBaseJitType,
3318+
unsigned simdSize);
3319+
32953320
GenTree* gtNewSimdLoadNode(
32963321
var_types type, GenTree* op1, CorInfoType simdBaseJitType, unsigned simdSize);
32973322

@@ -3307,18 +3332,33 @@ class Compiler
33073332
CorInfoType simdBaseJitType,
33083333
unsigned simdSize);
33093334

3335+
GenTree* gtNewSimdMaxNativeNode(var_types type,
3336+
GenTree* op1,
3337+
GenTree* op2,
3338+
CorInfoType simdBaseJitType,
3339+
unsigned simdSize);
3340+
33103341
GenTree* gtNewSimdMinNode(var_types type,
33113342
GenTree* op1,
33123343
GenTree* op2,
33133344
CorInfoType simdBaseJitType,
33143345
unsigned simdSize);
33153346

3347+
GenTree* gtNewSimdMinNativeNode(var_types type,
3348+
GenTree* op1,
3349+
GenTree* op2,
3350+
CorInfoType simdBaseJitType,
3351+
unsigned simdSize);
3352+
33163353
GenTree* gtNewSimdNarrowNode(var_types type,
33173354
GenTree* op1,
33183355
GenTree* op2,
33193356
CorInfoType simdBaseJitType,
33203357
unsigned simdSize);
33213358

3359+
GenTree* gtNewSimdRoundNode(
3360+
var_types type, GenTree* op1, CorInfoType simdBaseJitType, unsigned simdSize);
3361+
33223362
GenTree* gtNewSimdShuffleNode(var_types type,
33233363
GenTree* op1,
33243364
GenTree* op2,
@@ -3356,6 +3396,9 @@ class Compiler
33563396
CorInfoType simdBaseJitType,
33573397
unsigned simdSize);
33583398

3399+
GenTree* gtNewSimdTruncNode(
3400+
var_types type, GenTree* op1, CorInfoType simdBaseJitType, unsigned simdSize);
3401+
33593402
GenTree* gtNewSimdUnOpNode(genTreeOps op,
33603403
var_types type,
33613404
GenTree* op1,

0 commit comments

Comments
 (0)