RFR: 8308340: C2: Idealize Fma nodes [v4]

Fei Gao fgao at openjdk.org
Mon Aug 14 07:43:28 UTC 2023


On Thu, 10 Aug 2023 13:13:18 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Actually, there is no handling on `FmaV` nodes **with mask** in this patch, whether in the C2 mid-end or codegen backend. The gvn transformation just skips them. And I suppose `FmaV` nodes with mask can't be transformed into nodes **without mask**, except that C2 can guarantee that the mask is all true (this transformation has not been supported by current C2). Thanks.
>
> @fg1417 I only understood the comment with the help of your explanations in this thread. I think you should improve the comment. I would not mention the vectorapi. We may generate `FmaV` through an auto-vectorizer. Though I guess that is unlikely, since the scalar version `Fma::Ideal` would already reshape things.
> 
> Suggestion:
> 
> // We canonicalize the node by converting "(-a)*b+c" into "b*(-a)+c"
> // This reduces the number of rules in the matcher, as we only need to check
> // for negations on the second argument, and not the symmetric case where
> // the first argument is negated.
> // We cannot do this if he FmaV is masked. the inactive lanes have to return
> // the first input (ie "-a"). If we were to swap the inputs, the inactive lanes would
> // incorrectly return "b".

Thanks! Done.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14576#discussion_r1293070273


More information about the hotspot-compiler-dev mailing list