https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102232
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |TREE Status|UNCONFIRMED |NEW Last reconfirmed| |2021-09-07 Ever confirmed|0 |1 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So on aarch64, the code for all three functions are almost the same: foo(int, int): sdiv w2, w0, w1 madd w1, w2, w1, w1 sub w0, w1, w0 ret bar(int, int): sdiv w2, w0, w1 madd w1, w2, w1, w1 sub w0, w1, w0 ret tgt(int, int): sdiv w2, w0, w1 msub w0, w2, w1, w0 sub w0, w1, w0 ret MSVC can do the transformation.