RFR: 8375536: PPC64: Implement special MachNodes for floating point CMove

Martin Doerr mdoerr at openjdk.org
Fri Jan 16 16:10:37 UTC 2026


On Fri, 16 Jan 2026 13:56:13 GMT, David Briemann <dbriemann at openjdk.org> wrote:

> Adds the following mach nodes:
> match(Set dst (CMoveF (Binary cop (CmpF op1 op2)) (Binary src1 src2)));
> match(Set dst (CMoveD (Binary cop (CmpD op1 op2)) (Binary src1 src2)));
> match(Set dst (CMoveF (Binary cop (CmpD op1 op2)) (Binary src1 src2)));
> match(Set dst (CMoveD (Binary cop (CmpF op1 op2)) (Binary src1 src2)));

This looks great! I only have some minor suggestions. Thanks for implementing it!

src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp line 667:

> 665: }
> 666: 
> 667: void C2_MacroAssembler::cmovF(int cc, VectorSRegister dst, VectorSRegister op1, VectorSRegister op2,

Maybe add a comment what this function does:
dst = (op1 cmp(cc) op2) ? src1 : src2; // works for single and double precision floats

src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp line 692:

> 690:     break;
> 691:   default:
> 692:     assert(false, "unsupported compare condition: %d", cmp);

Maybe use `cc` instead of `cmp`? Would provide more info.

src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.hpp line 77:

> 75: 
> 76:   void reduceI(int opcode, Register dst, Register iSrc, VectorRegister vSrc, VectorRegister vTmp1, VectorRegister vTmp2);
> 77:   void cmovF(int cmpFlag, VectorSRegister dst, VectorSRegister op1, VectorSRegister op2, VectorSRegister src1, VectorSRegister src2, VectorSRegister tmp);

The cpp file uses `cc`. Having it consistent would be better. A line break would be nice, too.

src/hotspot/cpu/ppc/matcher_ppc.hpp line 70:

> 68: 
> 69:   // Suppress CMOVF for Power8 because there are no fast nodes.
> 70:   static int float_cmove_cost() {return (PowerArchitecturePPC64 >= 9) ? 0 : ConditionalMoveLimit; }

Whitespace before `return` would be better.

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

PR Review: https://git.openjdk.org/jdk/pull/29281#pullrequestreview-3671544232
PR Review Comment: https://git.openjdk.org/jdk/pull/29281#discussion_r2699042546
PR Review Comment: https://git.openjdk.org/jdk/pull/29281#discussion_r2699051341
PR Review Comment: https://git.openjdk.org/jdk/pull/29281#discussion_r2699058439
PR Review Comment: https://git.openjdk.org/jdk/pull/29281#discussion_r2699064310


More information about the hotspot-compiler-dev mailing list