https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119629
--- Comment #7 from Peter Bergner <bergner at gcc dot gnu.org> --- (In reply to Peter Bergner from comment #2) > (In reply to Peter Bergner from comment #1) > > > but the conditions that enable the expansion of > > > __builtin_scalar_byte_in_set > > > are those of [power9-64], namely TARGET_MODULE && TARGET_POWERPC64. > > I believe this is a bug and this and the other [power*-64] tests should be > > using TARGET_64BIT instead of TARGET_POWERPC64. > I think this should be the correct fix for this specific bug. Actually no. All the built-ins guarded by the [power*-64] selector do want to be guarded by TARGET_POWERPC64, except for this one __builtin_scalar_byte_in_set built-in which emits the cmpeqb instruction. Looking at the ISA, cmpeqb is the only 64-bit insn that explicitly says its results are undefined in 32-bit mode. Therefore, I think we only want to disable this one built-in 32-bit mode like so: diff --git a/gcc/config/rs6000/rs6000-builtins.def b/gcc/config/rs6000/rs6000-builtins.def index 555d7d58950..56b3a544b7d 100644 --- a/gcc/config/rs6000/rs6000-builtins.def +++ b/gcc/config/rs6000/rs6000-builtins.def @@ -2650,7 +2650,7 @@ STXVL stxvl {} const signed int __builtin_scalar_byte_in_set (signed int, signed long long); - CMPEQB cmpeqb {} + CMPEQB cmpeqb {no32bit} pure vsc __builtin_vsx_lxvl (const void *, signed long); LXVL lxvl {} Alex, can you give this patch a try and see if it fixes your first problem (ie, not the TARGET_POWERPC64 is enabled for power-elf builds issue)?