Skip to content

[Analyzer] Upgrade from platform specific to cross platform intrinsics #82486

@tannergooding

Description

@tannergooding

We've iteratively exposed support for various levels of hardware intrinsics since .NET Core 3.1. In .NET 7, we exposed the new "cross platform" hardware intrinsics which aim to help simplify the writing and maintenance of SIMD code meant to run across a variety of platforms.

As such, we should provide a code fixer that identifies such platform specific calls and suggests the simple transformation to the equivalent cross platform calls.

Category: Maintainability or Portability seem like the best fit. I could also see this being classified as Usage
Severity = suggestion

Example

A simple example is given below. The full list of APIs recognized is of course more expansive but effectively correlates to a platform specific ISA such as Sse.Add, Sse2.Add, Avx.Add, Avx2.Add, AdvSimd.Add, or PackedSimd.Add correlating to a singular cross platform API, such as operator +:

- return Sse.Add(Sse.Multiply(left, right), addend);
+ return (left * right) + addend;

Metadata

Metadata

Labels

api-approvedAPI was approved in API review, it can be implementedarea-System.Runtime.Intrinsicscode-analyzerMarks an issue that suggests a Roslyn analyzercode-fixerMarks an issue that suggests a Roslyn code fixer

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions