RFR: 8375536: PPC64: Implement special MachNodes for floating point CMove [v5]
Martin Doerr
mdoerr at openjdk.org
Fri Jan 30 15:06:55 UTC 2026
On Fri, 30 Jan 2026 15:01:11 GMT, Richard Reingruber <rrich at openjdk.org> wrote:
> > That was also wrong, but an additional problem was the wrong handling of NaN: C2 requires unordered to get treated like less
>
> The requirement is to implement `op1 cond op2 ? src1 : src2`. For NaN this means the result has to be `src2` except for `!=`. And that's it, isn't it?
>
> It might have helped to implement `op1 < op2` as `op2 > op1` using xscmpgtdp. The chosen implementation is also good.
We had tried. The following example can show that it's wrong:
class test {
static double cmovf_ge(double op1, double op2, double src1, double src2) {
return op1 >= op2 ? src1 : src2;
}
static void main(String[] args) {
double result = 0.0;
System.out.println(cmovf_ge(Double.NaN, Double.NaN, 1.0, 2.0));
for (int i = 0; i < 100_000; ++i) {
result += cmovf_ge((double) (i / 2), (double) ((i + 1) / 2), 1.0, 2.0);
}
System.out.println("result = " + result);
System.out.println(cmovf_ge(Double.NaN, Double.NaN, 1.0, 2.0));
}
}
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29281#issuecomment-3824211983
More information about the hotspot-compiler-dev
mailing list