This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM GCC is missing some builtins for ARMv7-M Thumb

I'm writing embedded code for the Cortex-M4 using ARM GCC 11.2.1, and wish to call the SMLAxy instruction from C code. Ideally, I'd like to do this with built-in functions like:

int res0 = __builtin_arm_smlabb(a, b, c);
int res1 = __builtin_arm_smlatt(a, b, c);
int res2 = __builtin_arm_smlatb(a, b, c);
int res3 = __builtin_arm_smlabt(a, b, c); // does not exist

The first three of these lines compile correctly. However, the last one (__builtin_arm_smlabt) throws an error saying the built in function is not defined. I'm compiling with the flag "-mcpu=cortex-m4" and no other flags. I know I can just switch the order of the arguments and call "__builtin_arm_smlatb" (or use inline assembly), but is there a reason why SMLABT specifically does not have a builtin, while its variants do?

On a similar note, I'd also like to call the SMULxy instruction the same way. However, "__builtin_arm_smultt" does not exist, nor do any of its other permutations. Why is this the case?

FWIW, on Arm 32-bit Clang, all eight permutations of __builtin_arm_smlaXY and __builtin_arm_smulXY exist.