| Issue |
237699
|
| Summary |
[X86] use vrcpps/vrcp14ps for i8 division
|
| Labels |
backend:X86,
missed-optimization
|
| Assignees |
|
| Reporter |
Andarwinux
|
http://0x80.pl/notesen/2024-12-21-uint8-division.html
https://godbolt.org/z/Y493jW7cK
Using approximate reciprocal
SSE comes with instruction [RCPPS](https://hjlebbink.github.io/x86doc/html/RCPPS.html) that calculates the approximate inversion of its argument: 1/x. This would allow us to use _expression_ dividend ⋅ approx(1/divisor).
The specification says relative error does not exceed 1.5 ⋅ 2 − 12. But for our needs, the absolute error is too big to use the instruction result directly. The following table shows the results for initial x values, for which the error is significant.
However, by trial-and-error search, we found that after multiplying the dividend by value 1.00025, the result of RCPPS can be used. To be precise, any multiplier between 1.00024 and 1.00199 works.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs