Closed
Description
Description
Hey, I discovered a bug with tiered compilation that is generating an invalid code when a Vector128<double>
is embedded in a struct and we perform calculation with it.
Reproduction Steps
Create a program with the following code, dotnet run -c Release
using System.Runtime.Intrinsics;
using System.Runtime.CompilerServices;
var rect = new PseudoPointF64(1.0, 2.0);
var result = rect * 2.0;
Console.WriteLine(result);
public readonly struct PseudoPointF64
{
private readonly Vector128<double> _value;
public PseudoPointF64(Vector128<double> value)
{
_value = value;
}
public PseudoPointF64(double x, double y)
{
_value = Vector128.Create(x, y);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static PseudoPointF64 operator *(PseudoPointF64 left, double right) => new(left._value * Vector128.Create(right));
public override string ToString()
{
return _value.ToString();
}
}
Expected behavior
It should print <2, 4>
Actual behavior
It prints <2, 0>
Regression?
No response
Known Workarounds
Add [MethodImpl(MethodImplOptions.AggressiveOptimizations)]
to the method is fixing the issue.
Configuration
- dotnet --version 8.0.100
- x64
- Windows 11 Pro
- Version 23H2
- OS build 22631.2861
Other information
No response