Skip to content

Fix ALU fmin/fmax to use float, not int comparison

Eclipse Webmaster requested to merge github/fork/TobiasKaiser/pulpinov1 into pulpinov1

Created by: TobiasKaiser

The fmin.s / fmax.s instructions gave wrong results, because they used the integer comparison flag, not the float comparison flag.

A minimal example to demonstrate the unintended behavior of of fmax.s is attached. In this example fmax.s(-200, -190) gave -200 as a result. fmax_min_example.c.txt

I found this problem when a C program that uses floats returned wrong results when using the RI5CY core with FPU. The ri5cy toolchain gcc makes frequent use of the fmax.s when optimizing with -O3.

Merge request reports

Loading