From patchwork Mon Mar 20 17:27:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 741093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vn2vS0tjxz9s78 for ; Tue, 21 Mar 2017 04:27:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ouFJkBKF"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=Ts9MwciijTZACD8rmDiB9RbCIDC2gnU0ut2PLFA0UYUesU48et4dv yvXnMsIGoXt2MiRi0O9Z9N4xfdhqv3u4TfDI4v52xdzuO90lh+9yvNYktJ+AM+So W59z3lMjqFs3lj+7xhzrWSsImGJ9AkBPA6Ka9oUGxs/AyEgjox8nQY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type:content-transfer-encoding; s=default; bh=xOWXb6EAJJQIns/M9MUuqyjO5w8=; b=ouFJkBKFnOE45rQMYdqMGiY3F6tE A/HdHy49KzfpG830RaPwkvMlOjNCvQDYKIsN/g3qoz9pjwxaKO9g9KYRLRBqNSoQ YAw72KtL7dJ/Os73yjGLVxRWyh1bNfoZn4Mj0u4jeN+8dDhSKliYViJh4060dVnp XEwVxewVKMFTo1s= Received: (qmail 78116 invoked by alias); 20 Mar 2017 17:27:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 78102 invoked by uid 89); 20 Mar 2017 17:27:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Mar 2017 17:27:20 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1428CAC21; Mon, 20 Mar 2017 17:27:18 +0000 (UTC) From: Andreas Schwab To: "Richard Earnshaw \(lists\)" Cc: gcc-patches Subject: Re: [PATCH][AArch64] Optimized implementation of search_line_fast for the CPP lexer References: <7b1f910a-628f-089a-eed3-23476c1bda9e@arm.com> <8934498e-830f-751a-976d-f6caf9e32d14@arm.com> X-Yow: ...Um...Um... Date: Mon, 20 Mar 2017 18:27:18 +0100 In-Reply-To: <8934498e-830f-751a-976d-f6caf9e32d14@arm.com> (Richard Earnshaw's message of "Mon, 20 Mar 2017 15:17:01 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 On Mär 20 2017, "Richard Earnshaw (lists)" wrote: > I don't have access to an ILP32 run-time environment, so I'm not sure > how I'll be able to check this out. There are some pointer checks in > the code so it's possible something is going awry. Can you compare the > assembly output for ILP32 and LP64 to see if there's anything obvious? The problem is here: if (__builtin_expect (vpaddd_u64 ((uint64x2_t)t), 0)) vpaddd_u64 returns a uint64_t value, but __builtin_expect takes a long (32-bit in ILP32 mode). Andreas. * lex.c (search_line_fast) [__ARM_NEON && __ARM_64BIT_STATE]: Convert 64-bit value to boolean before passing to __builtin_expect. diff --git a/libcpp/lex.c b/libcpp/lex.c index 8a8c79cde7..a431ac8e05 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -821,7 +821,7 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED) v = vorrq_u8 (t, vceqq_u8 (data, repl_bs)); w = vorrq_u8 (u, vceqq_u8 (data, repl_qm)); t = vorrq_u8 (v, w); - if (__builtin_expect (vpaddd_u64 ((uint64x2_t)t), 0)) + if (__builtin_expect (vpaddd_u64 ((uint64x2_t)t) != 0, 0)) goto done; }