From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 34C91383FF4F for ; Fri, 9 Dec 2022 09:18:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 34C91383FF4F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 528661FDB3; Fri, 9 Dec 2022 09:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1670577515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=66WAkIZ/iwef4pEIosQWENfbf3BQ3SPN+Lwv3cvQiC8=; b=xBFfjIS3HPFczN+QDN3T5YquTN+fVuSw2IhqFUCNQkWudQ5TIKo2EQCH0CsQGHWKo2LW6F m0jrKYxFAAezBsj/+7MeHHAFaEw0qPRC91zMkGSqdsFBOE2OPvaywODWjFMm+XS3UbwFfn C9qq0+yfdKDl6JZeP9JN5Y9X3/A5eEk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1670577515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=66WAkIZ/iwef4pEIosQWENfbf3BQ3SPN+Lwv3cvQiC8=; b=+CKmFrxhz8MiUSteR2F9251OJEfP79G6sqAADemicu29qP5tIpFQX0ZUpklR3M5SmS8lXv ZE5hfwYYiLvaRvCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2206113597; Fri, 9 Dec 2022 09:18:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mQg3Bmv9kmPhXwAAMHmgww (envelope-from ); Fri, 09 Dec 2022 09:18:35 +0000 Message-ID: <38137444-4255-6e0d-db37-f635748363db@suse.cz> Date: Fri, 9 Dec 2022 10:18:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH] i386: fix assert (__builtin_cpu_supports ("x86-64") >= 0) Content-Language: en-US To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org, Uros Bizjak References: From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 >