https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68360
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- For AARCH64 GCC does a much better job: foo: stp x29, x30, [sp, -32]! add x29, sp, 0 ldrb w1, [x29,28] lsr w2, w0, 2 bfi w1, w2, 2, 2 lsr w0, w0, 6 bfi w1, w0, 6, 1 add x0, x29, 24 strb w1, [x29,28] bl bar But there is still some things missing but it is still a much better job than what happens on x86.