dotnet/runtime

Support recognizing `Blend` as commutative

Open

#82,365 创建于 2023年2月19日

在 GitHub 查看
 (5 评论) (2 反应) (2 负责人)C# (5,445 fork)batch import
area-CodeGen-coreclrhelp wanted

仓库指标

Star
 (17,886 star)
PR 合并指标
 (平均合并 12天 11小时) (30 天内合并 661 个 PR)

描述

We don't currently track Blend as commutative and so we miss an opportunity to ensure that "memory operands" always appear on the RHS: https://github.com/SixLabors/ImageSharp/pull/2359#discussion_r1111147888

Support should be added to treat this as commutative which really just entails inverting the constant (e.g. Blend(x, y, 0b0111_0111) is equivalent to Blend(y, x, 0b1000_1000)).

There are actually a few operations this applies to that involve two inputs + control mask. Not all of them are as trivially as inverting the constant, however.

贡献者指南