xtensa calling convention: arguments pre-extended, post-extended, or both?
Posted: Fri Aug 23, 2024 6:39 pm
More notes here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116467
In the above code, both caller() and callee() will zero-extend the `y` parameter. On many other 32-bit systems, only one of the two functions would need to zero-extend `y` (with `extui` instruction). I looked through the calling convention information but haven't found a definitive source for this for xtensa. If parameters only need zero-extended once, it would be good to update GCC to take advantage of this.
Code: Select all
#include <stdint.h>
__attribute__ ((noinline)) uint32_t callee(uint32_t x, uint16_t y){
return x + y;
}
__attribute__ ((noinline)) uint32_t caller(uint32_t x, uint32_t y){
return callee(x, y);
}