[libc-commits] [libc] [libc][math][c23] Add fmodf16 C23 math function (PR #94629)

via libc-commits libc-commits at lists.llvm.org
Thu Jun 6 11:19:44 PDT 2024


overmighty wrote:

`fputil::generic::FMod<float16, uint16_t>::eval` ("My function") vs `fputil::generic::FMod<float16, uint32_t>::eval` ("Other function"):

```
 Performance tests with inputs in denormal range:
-- My function --
     Total time      : 31887746 ns 
     Average runtime : 6.23416 ns/op 
     Ops per second  : 160406445 op/s 
-- Other function --
     Total time      : 31818669 ns 
     Average runtime : 6.22066 ns/op 
     Ops per second  : 160754681 op/s 
-- Average runtime ratio --
     Mine / Other's  : 1.00217 

 Performance tests with inputs in normal range:
-- My function --
     Total time      : 2102300916 ns 
     Average runtime : 13.6873 ns/op 
     Ops per second  : 73060425 op/s 
-- Other function --
     Total time      : 1455808877 ns 
     Average runtime : 9.47823 ns/op 
     Ops per second  : 105504920 op/s 
-- Average runtime ratio --
     Mine / Other's  : 1.44408 

 Performance tests with inputs in normal range with exponents close to each other:
-- My function --
     Total time      : 1191302996 ns 
     Average runtime : 11.6338 ns/op 
     Ops per second  : 85956301 op/s 
-- Other function --
     Total time      : 896641376 ns 
     Average runtime : 8.75626 ns/op 
     Ops per second  : 114203964 op/s 
-- Average runtime ratio --
     Mine / Other's  : 1.32863 
```

`fputil::generic::FMod<float16, uint16_t>::eval` ("My function") vs `fputil::generic::FMod<float16, uint64_t>::eval` ("Other function"):

```
 Performance tests with inputs in denormal range:
-- My function --
     Total time      : 31902551 ns 
     Average runtime : 6.23706 ns/op 
     Ops per second  : 160332006 op/s 
-- Other function --
     Total time      : 31826412 ns 
     Average runtime : 6.22217 ns/op 
     Ops per second  : 160715571 op/s 
-- Average runtime ratio --
     Mine / Other's  : 1.00239 

 Performance tests with inputs in normal range:
-- My function --
     Total time      : 2102323737 ns 
     Average runtime : 13.6874 ns/op 
     Ops per second  : 73059632 op/s 
-- Other function --
     Total time      : 1373600760 ns 
     Average runtime : 8.943 ns/op 
     Ops per second  : 111819245 op/s 
-- Average runtime ratio --
     Mine / Other's  : 1.53052 

 Performance tests with inputs in normal range with exponents close to each other:
-- My function --
     Total time      : 1191080918 ns 
     Average runtime : 11.6316 ns/op 
     Ops per second  : 85972328 op/s 
-- Other function --
     Total time      : 895173208 ns 
     Average runtime : 8.74193 ns/op 
     Ops per second  : 114391269 op/s 
-- Average runtime ratio --
     Mine / Other's  : 1.33056 
```

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


More information about the libc-commits mailing list