Hi Steve, The latest version compiles the examples I used correctly, so it looks fine from that perspective (but see comments below). However the key point of the ABI is to enable better code generation when calling a vector function, and that will likely require further changes that may conflict with this patch. Do you have patches for that work outstanding? It seems best to do this in one go.
Also did you check there is no regression in code generation for non-vector functions? +/* Return 1 if the register is used by the epilogue. We need to say the + return register is used, but only after epilogue generation is complete. + Note that in the case of sibcalls, the values "used by the epilogue" are + considered live at the start of the called function. + + For SIMD functions we need to return 1 for FP registers that are saved and + restored by a function but not zero in call_used_regs. If we do not do + this optimizations may remove the restore of the register. */ + +int +aarch64_epilogue_uses (int regno) +{ + if (epilogue_completed && (regno) == LR_REGNUM) + return 1; + if (aarch64_simd_decl_p (cfun->decl) && FP_SIMD_SAVED_REGNUM_P (regno)) + return 1; + return 0; +} I'm not convinced this is a good idea. It suggests GCC doesn't have the correct set of caller/callee-save registers for vector functions (I don't see a change to update CALL_USED_REGISTERS or aarch64_hard_regno_call_part_clobbered), which could lead to all kinds of interesting issues. +/* Return false for non-leaf SIMD functions in order to avoid + shrink-wrapping them. Doing this will lose the necessary + save/restore of FP registers. */ + +bool +aarch64_use_simple_return_insn_p (void) +{ + if (aarch64_simd_decl_p (cfun->decl) && !crtl->is_leaf) + return false; + + return true; +} Such as this... Wilco