Skip to content

JIT: Tune CSE/Constant propagation to fix this SIMD example #70657

@EgorBo

Description

@EgorBo

Found during review of #70654

Vector128<byte> Test(Vector128<byte> a, Vector128<byte> b) 
    => Vector128.GreaterThan(a, b);

Current codegen:

G_M23213_IG01:
       vzeroupper 
G_M23213_IG02:
       vmovupd  xmm0, xmmword ptr [r8]
       vpsubb   xmm0, xmm0, xmmword ptr [reloc @RWD00]
       vmovupd  xmm1, xmmword ptr [r9]
       vpsubb   xmm1, xmm1, xmmword ptr [reloc @RWD00]
       vpcmpgtb xmm0, xmm0, xmm1
       vmovupd  xmmword ptr [rdx], xmm0
       mov      rax, rdx
G_M23213_IG03:
       ret      
RWD00  	dq	8080808080808080h, 8080808080808080h
; Total bytes of code: 41

Here, before vpcmpgtb we subtract a constant vector from both xmm0 and xmm1 - CSE should be able to handle them and give constant propagation a hint that it should not propagate them back.

category:cq
theme:assertion-prop
skill-level:intermediate
cost:small
impact:medium

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMItenet-performancePerformance related issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions