[llvm] [MIPS] Implement llvm.fminimum and llvm.fmaximum with f32/f64 (PR #89907)

Cinhi Young via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 28 23:11:06 PDT 2024


Cyanoxygen wrote:

> Can you have consider it?
> It's due to that we process the most cases as early as possible.

preliminary checks are essential since we do not know what value actually is in the operands, and since minnum and maxnum returns other operand if NaN exists, we have to check if there's any NaN in them.

I have a “slightly better” version in mind, which might handle the edge case. Again, preliminary checks are essential:

```
newx = max(x, y)
if (newx == x) {
	if (y == NaN) {
		return y;
	}
	if (y == 0) {
		if (x == -0) return y;
		return x;
	}
	return x;
}
return y;
```

https://github.com/llvm/llvm-project/pull/89907


More information about the llvm-commits mailing list