On 12/7/22 12:27, Jakub Jelinek wrote: > On Fri, Nov 25, 2022 at 01:57:35PM +0100, Martin Liška wrote: >> PR target/107551 >> >> gcc/ChangeLog: >> >> * config/i386/i386-builtins.cc (fold_builtin_cpu): Use same path >> as for PR103661. >> * doc/extend.texi: Fix "x86-64" use. >> >> gcc/testsuite/ChangeLog: >> >> * gcc.target/i386/builtin_target.c: Add more checks. >> + >> + field_val = (1U << feature); > > Just > field_val = 1U << feature; > ? > >> + final = build2 (BIT_AND_EXPR, unsigned_type_node, array_elt, >> + build_int_cstu (unsigned_type_node, field_val)); >> + if (feature == (INT_TYPE_SIZE - 1)) > > Just > if (feature == INT_TYPE_SIZE - 1) > ?
Sure, included the 2 aforementioned suggestions. > >> + return build2 (NE_EXPR, integer_type_node, final, >> + build_int_cst (unsigned_type_node, 0)); >> + else >> + return build1 (NOP_EXPR, integer_type_node, final); >> } >> gcc_unreachable (); >> } > > Otherwise LGTM, though I must say the destinction for when > __builtin_cpu_is and __builtin_cpu_supports works looks completely random. I'm going to push the revision. What exactly do you mean by random? I just know there are differences in between x86 and ppc: int __builtin_cpu_supports(const char *feature) This function returns a positive integer if the run-time CPU supports feature and returns 0 otherwise. This function returns a value of 1 if the run-time CPU supports the HWCAP feature feature and returns 0 otherwise. Martin > > Jakub >