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

Richard Reingruber rrich at openjdk.org
Thu Jul 20 09:10:42 UTC 2023


On Thu, 20 Jul 2023 02:35:47 GMT, Fei Gao <fgao at openjdk.org> wrote:

>> Yes that's what I meant. Thanks. Now on PPC, my understanding would be that with the symmetrical match-rules (removed with this pr) the `NegV` wouldn't be generated. Is my understanding correct?
>
> Hi @reinrich, I'm sorry that I didn't explain the transformation here clearly enough to lead to your misunderstanding.  Let's revisit the comment here.
> 
> The example `av.neg().lanewise(VectorOperators.FMA, bv, cv, mask)` I gave here was used to explain the latter part
> "// except vectorapi masked nodes, since the inactive lanes should
> // save the first input of the masked node."
> 
> It means the pr has no real impact on subgraph or codegen for `FmaV` nodes **with mask**, certainly including `PPC`. Since it doesn't apply the change to vector nodes with mask (`is_predicated_vector()`), and the pr doesn't remove any rules **with mask**. 
> 
>> Now on PPC, my understanding would be that with the symmetrical match-rules (removed with this pr) the NegV wouldn't be generated. Is my understanding correct?
> 
> The symmetrical match-rules removed with this pr works only for `FmaV` nodes **without mask**. The reason why we can remove them is that here we apply the transformation to these non-masked vector nodes. For example, on `PPC` backend, we removed ` match(Set dst (FmaVF dst (Binary (NegVF src1) src2)));` and kept `match(Set dst (FmaVF dst (Binary src1 (NegVF src2))));`, because all `(-a)*b+c` should be converted into `b*(-a)+c` here. Therefore, even without these removed symmetrical match-rules, whether `(-a)*b+c` or `a*(-b)+c` can be fused and the `NegV` won't be generated, given that the backend supports it.
> 
> Thanks.

Thanks. How are `FmaV` nodes with mask handled then? Are they transformed into equivalent nodes without mask?

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

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


More information about the hotspot-compiler-dev mailing list