[PATCH] D97764: [clang][patch] To solve PR26413, x86 interrupt routines may only call routines with no_saved_reg

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 13 07:58:34 PDT 2021


craig.topper added a comment.

In D97764#2685841 <https://reviews.llvm.org/D97764#2685841>, @mibintc wrote:

> In D97764#2685742 <https://reviews.llvm.org/D97764#2685742>, @craig.topper wrote:
>
>> In D97764#2685655 <https://reviews.llvm.org/D97764#2685655>, @mibintc wrote:
>>
>>> I received a bug report that this patch creates error diagnostics for calls to a builtin, like calling 'abort', 'exit' or one of the target builtins like __builtin_ia32_packssw then that call should be allowed without remark but this patch causes the compilation to fail.  We could require that all builtin's be declared with "no caller saved reg" but that's a big modification. I'm planning to make a change which igores builtin calls, but continue to error on any implicitly declared or user declared functions without the "no caller saved reg" attribute.
>>
>> Builtins like __builtin_ia32_packssw aren't usually called directly. The user should be calling the always_inline wrapper functions in x86intrin.h. Would that also fail?
>
> Thanks for the suggestion Craig!  I could change the check to look for "always_inline" [that means they're always inlined and the call would never be created even with optimization disabled right? ] However, I don't see _builtin_ia32_packssw declared in <immintrin.h>.  In immintrin it is declared implicitly when the usage is seen for example 
> _mm_packs_pi16(__m64 __m1, __m64 __m2)
> {
>
>   return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
>
> }
>
> Is it a bug that __builtin_ia32_packsswb is omitted from the x86intrin declarations? Is there some tricky reason it's not declared?

__builtin_ia32* are always defined for the X86 target as they are part of the compiler. They are defined in clang/include/clang/Basic/BuiltinsX86.def and clang/include/clang/Basic/BuiltinsX86_64.def


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97764/new/

https://reviews.llvm.org/D97764



More information about the cfe-commits mailing list