Skip to content

Vector<T> operator+ does not generate NotSupportedException on arm32. #37506

@sandreenko

Description

@sandreenko

We are expecting the following test to pass:

    public static int Main()
    {
        var a = new Vector<Vector4>(new Vector4(1));
        try
        {
            a = a + a;
            Debug.Assert(false, "unreachable");
        }
        catch (System.NotSupportedException)
        {
        }
        return 100;
    }

but on arm32 it hits the assert, based on @tannergooding analysis it happens because on arm32 we don't have IsHardwareAccelerated, so we go to the else condition in Vector<T> operator +:
https://source.dot.net/#System.Private.CoreLib/Vector.cs,729
and the else branch is missing something like (in my understanding):

    else
    {
        throw new NotSupportedException(SR.Arg_TypeNotSupported);
    }

https://source.dot.net/#System.Private.CoreLib/Vector.cs,826
similar to the IsHardwareAccelerated block.

cc @CarolEidt

JitDump confirms that we are not doing addition and just generate `default:
Addition.txt

Metadata

Metadata

Assignees

Labels

arch-arm32area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIbreaking-changeIssue or PR that represents a breaking API or functional change over a previous release.bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions