-
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
Cf. #67492 (comment)
Repro:
bool Bad(Vector<ushort> vec) => Vector<ushort>.Zero.Equals(vec);
bool Good(Vector<ushort> vec) => vec == Vector<ushort>.Zero;The version with the == boils down to a ptest ymm0, ymm0 which is ideal.
The version with explicit equals (i.e. Bad above) emits extra vxorps and vpxor which aren't needed.
This is especially cumbersome in loops where these instructions bloat the loop-body. By manual hoisting Vector<T>.Zero one xor can be eliminated.
Expected is same codegen for both versions.
The same happens for byte too (didn't check other types).
/cc: @EgorBo
category:cq
theme:vector-codegen
skill-level:beginner
cost:small
impact:small
Reactions are currently unavailable
Metadata
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