https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112789

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Sam James from comment #11)
> (In reply to Andrew Pinski from comment #7)
> > Sounds like that HPC QCD app is broken. You should report it to the
> > developers. Also since __builtin_ctzg is added, adding __builtin_ctzs really
> > does not make any sense since it would just done as `#define __builtin_ctzs
> > __builtin_ctzg((unsigned short)a)` in the source.
> 
> And you can achieve this in a bunch of ways without even directly modifying
> the source via the command line.

One way is to do the add `-include ${PATH_TO_SRC}/clang_builtins_to_gcc.h` to
the command line and have something like:
```
#ifndef __CLANG_BUILTINS_TO_GCC_H__
#define __CLANG_BUILTINS_TO_GCC_H__

#if !__has_builtin(__builtin_ctzs)
static inline unsigned short __builtin_ctzs(unsigned short a)
{
#if __has_builtin(__builtin_ctzg)
  return __builtin_ctzg(a);
#else
  #error implement fallback
#endif
}
#endif

#endif
```
in clang_builtins_to_gcc.h .

Reply via email to