dotnet / dotnet/runtime

Bad lowering of CreateScalar when EnableHWIntrinsic=0

Open
#133,746 3 comments 0 reactions 1 assignee Assigned to @tannergooding View on GitHub
area-CodeGen-coreclr
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

With `DOTNET_EnableHWIntrinsic=0`, this prints `<-1, 0, 0, ...>` with `tieredcompilation=1` but prints `<-1, -1, ...>` with `tieredcompilation=0`.
```
using System;
using System.Runtime.Intrinsics;

public class Mini
{
public static int Main()
{
Vector64 value = Vector64.CreateScalar((sbyte)-1);
Console.WriteLine(value);
return 100;
}
}
```

Problem is lowering/store coalescing making this transform, byte->long:
```
lowering store lcl var/field (before):
N001 ( 1, 2) [000055] -----+----- t55 = CNS_INT int -1 $40
/--* t55 int
N002 ( 6, 8) [000056] UA---+----- * STORE_LCL_FLD byte V02 tmp2 ud:1->2[+0] $VN.Void

lowering store lcl var/field (after):
N001 ( 1, 2) [000055] -----+----- t55 = CNS_INT long -1 $40
/--* t55 long
N002 ( 6, 8) [000056] UA---+----- * STORE_LCL_FLD long V02 tmp2 ud:1->2[+0] $VN.Void
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.