RFR: 8308340: C2: Idealize Fma nodes [v4]
Emanuel Peter
epeter at openjdk.org
Thu Aug 10 13:40:28 UTC 2023
On Thu, 20 Jul 2023 09:34:27 GMT, Fei Gao <fgao at openjdk.org> wrote:
>> Thanks. How are `FmaV` nodes with mask handled then? Are they transformed into equivalent nodes without mask?
>
> 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".
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14576#discussion_r1290108363
More information about the hotspot-compiler-dev
mailing list