RFR: 8375536: PPC64: Implement special MachNodes for floating point CMove [v2]

Martin Doerr mdoerr at openjdk.org
Thu Jan 29 17:21:01 UTC 2026


On Thu, 29 Jan 2026 12:23:47 GMT, Richard Reingruber <rrich at openjdk.org> wrote:

>> The condition is adjusted for `CMove` with match rules like `match(Set dst (CMoveD (Binary cop cr) (Binary dst src)));`. If the condition is `false`, the value `dst` is kept. If the condition is `true`, the value `src` is used. So, the comment for PPC64 should actually say "dst = (op1 cmp(cc) op2) ? src2 : src1;".
>
> Are you saying the condition is only adjusted if `dst` and `src1` are identical? Probably not...
> 
> I guess this originates from L44, L45. below The left tree is associated with false and the right with true.
> 
> ```c++
>   38	  CMoveNode( Node *bol, Node *left, Node *right, const Type *t ) : TypeNode(t,4)
>   39	  {
>   40	    init_class_id(Class_CMove);
>   41	    // all inputs are nullified in Node::Node(int)
>   42	    // init_req(Control,nullptr);
>   43	    init_req(Condition,bol);
>   44	    init_req(IfFalse,left);
>   45	    init_req(IfTrue,right);
>   46	  }
> 
> 
> So we cannot think of a CMoveNode as a ternary operator.
> 
> What about adapting the match rules swapping src1 and src2 and implemeting `op1 cond op2 ? src1 : src2`?
> This would be less confusing then implementing `op1 cond op2 ? src2 : src1`

Thanks for pointing this out! The new code is much better readable and avoids much confusion.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29281#discussion_r2742707964


More information about the hotspot-compiler-dev mailing list