Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC failing to identify SMM[UL\LA]R idioms causes performance issues #117

Open
FabKlein opened this issue Aug 31, 2023 · 7 comments
Open
Labels
enhancement New feature or request

Comments

@FabKlein
Copy link
Contributor

For tracking

multAcc_32x32_keep32_R, mult_32x32_keep32_R and co macros, involved in Q.31 FFTs,Fast DF1 Biquad / Fast FIRs are supposed to be converted in single ARMv7M-E DSP instruction (SMM[UL\LA]R variant)

This is OK with Arm Compilers and clang but not for GCC (any version)
https://godbolt.org/z/7GWqdE3xv

Expected successful conversion (e.g. CLANG):
https://godbolt.org/z/3149Knxoc

SMM[UL\LA]R are not part of ACLE, so inline asm may be required

@christophe0606
Copy link
Contributor

@FabKlein There is already a __SMMLA in CMSIS-Core for gcc. No SMMUL yet ...
Same for clang ...

@christophe0606 christophe0606 added the enhancement New feature or request label Sep 4, 2023
@CookiePLMonster
Copy link

For visibility - is there any way to emit SMMUL from GCC that does not involve inline assembly? Neither gcc-cmsis.h or arm_acle.h provide intrinsics for it.

@christophe0606
Copy link
Contributor

@CookiePLMonster I think the only way is to use inline assembly that can be hidden in a C macro.

@CookiePLMonster
Copy link

@christophe0606 Indeed, I tried mimicking intrinsics from cmsis_gcc.h and it works well:

__STATIC_FORCEINLINE int32_t __SMMUL (int32_t op1, int32_t op2)
{
 int32_t result;

 __ASM ("smmul %0, %1, %2" : "=r" (result): "r"  (op1), "r" (op2) );
 return(result);
}

It's just strange that it's omitted from that header file, while e.g. SMMLA exists.

@christophe0606
Copy link
Contributor

@CookiePLMonster It is handled by the CMSIS project. You may open a github issue there to ask them why it was not done, and if they could add it to the header.
(Perhaps there is already an open issue)

@CookiePLMonster
Copy link

Would that be https://github.com/ARM-software/CMSIS_6/issues ?

@christophe0606
Copy link
Contributor

@CookiePLMonster

It is.

But if you're still on CMSIS_5 you also have: https://github.com/ARM-software/CMSIS_5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants