Hi! On Sun, Oct 04, 2020 at 09:56:01PM -0400, Hans-Peter Nilsson wrote: > Please excuse a comment from the gallery:
:-) Thanks! > > > + rtx tmp = gen_rtx_CONST_INT (SImode, __builtin_clz (INTVAL > > > (operands[1]))); > > This doesn't appear to be very portable, to any-cxx11-compiler > that doesn't pretend to be gcc-intrinsics-compatible. Yup, thanks for spotting this :-) > PS. No less than four targets fail like that. Meh. $ grep -r __builtin_clz config/ config/tilepro/gen-mul-tables.cc: int prev_pow2 = 1 << (31 - __builtin_clz (abs_multiplier)); config/tilepro/gen-mul-tables.cc: 1LL << (63 - __builtin_clzll (abs_multiplier)); This is a generator program that is not run on normal builds, so arguably not a bug. config/nds32/nds32-md-auxiliary.c: clear_sign_bit_copies = __builtin_clz (remainder); config/arc/arc.c: if ((GMASK_LEN - __builtin_clzll (gmask)) == (i + 1) config/arc/arc.c: if ((GMASK_LEN - __builtin_clzll (gmask)) == i Those seem bugs yes. config/rs6000/bmi2intrin.h: c = __builtin_clzl (m); config/rs6000/bmi2intrin.h: c = __builtin_clzl (m); config/rs6000/bmi2intrin.h: c = __builtin_clzl (m); config/rs6000/ppu_intrinsics.h:#define __cntlzw(v) __builtin_clz(v) config/rs6000/ppu_intrinsics.h:#define __cntlzd(v) __builtin_clzll(v) These are installed headers, only used with the built GCC. No bug. config/i386/i386-builtin.def:BDESC (OPTION_MASK_ISA_LZCNT, 0, CODE_FOR_lzcnt_hi, "__builtin_clzs", IX86_BUILTIN_CLZS, UNKNOWN, (int) UINT16_FTYPE_UINT16) A different thing altogether, my grep was a bit wide :-) But not a bug anyway. config/aarch64/aarch64.c: return val == mask * bitmask_imm_mul[__builtin_clz (bits) - 26]; This seems bad as well, yes. Thanks, Segher