-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
Minimal repro from #70336 (comment)
static int Test()
{
var cns = Vector128.Create(1, 2, 3, 4);
int i = 0;
do
{
i = (cns + Vector128.Create(i)).ToScalar();
}
while (i < 100);
return i;
}Despite the fact I declared the constant vector outside of the loop it ends up inside leading to a memory load each iteration:
x64:
; Method C:Test():int
G_M43325_IG01:
vzeroupper
G_M43325_IG02:
xor eax, eax
align [11 bytes for IG03]
G_M43325_IG03:
vmovd xmm0, eax
vpbroadcastd xmm0, xmm0
vpaddd xmm0, xmm0, xmmword ptr [reloc @RWD00]
vmovd eax, xmm0
cmp eax, 100
jl SHORT G_M43325_IG03
G_M43325_IG04:
ret
RWD00 dq 0000000200000001h, 0000000400000003h
; Total bytes of code: 43Arm64:
; Method C:Test():int
G_M43325_IG01:
stp fp, lr, [sp,#-16]!
mov fp, sp
G_M43325_IG02:
mov w0, wzr
G_M43325_IG03:
dup v16.4s, w0
ldr q17, [@RWD00]
add v16.4s, v17.4s, v16.4s
smov x0, v16.s[0]
cmp w0, #100
blt G_M43325_IG03
G_M43325_IG04:
ldp fp, lr, [sp],#16
ret lr
RWD00 dq 0000000200000001h, 0000000400000003h
; Total bytes of code: 44Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI