https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86710
Bug ID: 86710 Summary: 3 missing logarithm optimizations Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: mcccs at gmx dot com Target Milestone: --- I've looked at match.pd, and spotted missing properties of logarithm. I could poorly write the code for two, still needs to check that the log base is the same: (for logs (LOG LOG2 LOG10) /* logN(a) + logN(b) -> logN(a * b). */ (simplify (plus (logs (@0)) (logs (@1))) (logs (mult:c (@0) (@1)))) (for logs (LOG LOG2 LOG10) /* logN(a) - logN(b) -> logN(a / b). */ (simplify (sub (logs (@0)) (logs (@1))) (logs (rdiv (@0) (@1)))) I couldn't code the last one /* logN(b)/logN(a) * logN(c)/logN(b) -> logN(c)/logN(a). */ Here are the test cases: 1: https://godbolt.org/g/boqxQb 2: https://godbolt.org/g/m7zHxK 3: https://godbolt.org/g/KXrbV4