Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3301855imm; Thu, 17 May 2018 06:45:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrGk6W2JGXKO5MVH2FaEgMrbsXuwmAOwsWRoxsAiMRVfhx836oGsCglidTDaS53OuZQoo95 X-Received: by 2002:a17:902:108a:: with SMTP id c10-v6mr5414192pla.111.1526564710893; Thu, 17 May 2018 06:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526564710; cv=none; d=google.com; s=arc-20160816; b=vHiW6tkTYeTHP5emFPm2jP5MyauOWHAv9OBim/CStn/PzU8M6yMLWLX4UomU7F7Bvb RxL7LTtqszczYWx3KAsVObyafn4pUUdOgEYF/9MXEwvyn6leLOmzMG7bhfCxPdEZRjCz xXckQxfL7lZE45ID9kb1oKBOQhLJQDOwUGMspTCyuQ74AcGXSouBDH30oG0BFHH9jUE9 f5kcsB6rVRwve7PODn8HPn3lYRACbF9NfL2e0rCyCGT6QQBP3cMl/0ZWhUFXJKlnIl32 gVLCKUBYwuayn1cnH8MmScfUe5LumBNlHVx4CSIGdP9i5UjbqvtdFPLqLT6MuayWpKJN +DyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=p5ErWcVTfM7/mTkV/DPv1DWBEl1CmovEqMqoukNJLRQ=; b=sZk6k5qxA6WDAPPinuW0y+7q2TqgYxCUcLE0EWPlKyRtsjyNN3GV3SARljj4ssDHJ9 cF++RNWee8jhFP6uToDf9flBBskHDVn+0ElFVd+VIFCJ/Xii+xWmqoLiBymTBtf83jhG Zk63IDQJPDWsTmYo/ClK132eSzxLivkBwh9ZeQLzSpyvSbiaraUQ4QKLyry4NKv3GbbA yFW+5bkfAupuIU6eweKCsRA2bIYV8bEDnhNzyhrjjxo7TydpzVUyahiZtiui2qnP0lVU njse/OTG0La+bLwlx0BdwJuIQ9G8GPCIt/FxalMTObmDHILCsHprS4GxfO0s5T0rK2yj nSUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12-v6si4233981pgu.288.2018.05.17.06.44.56; Thu, 17 May 2018 06:45:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752188AbeEQNol (ORCPT + 99 others); Thu, 17 May 2018 09:44:41 -0400 Received: from gate.crashing.org ([63.228.1.57]:51920 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752030AbeEQNoj (ORCPT ); Thu, 17 May 2018 09:44:39 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w4HDiFmj004111; Thu, 17 May 2018 08:44:16 -0500 Message-ID: Subject: Re: [PATCH v2 5/5] powerpc/lib: inline memcmp() for small constant sizes From: Benjamin Herrenschmidt To: Christophe LEROY , Mathieu Malaterre Cc: Paul Mackerras , Michael Ellerman , linuxppc-dev , LKML Date: Thu, 17 May 2018 23:44:15 +1000 In-Reply-To: References: <8a6f90d882c8b60e5fa0826cd23dd70a92075659.1526553552.git.christophe.leroy@c-s.fr> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1 (3.28.1-2.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-05-17 at 15:21 +0200, Christophe LEROY wrote: > > > +static inline int __memcmp8(const void *p, const void *q, int off) > > > +{ > > > + s64 tmp = be64_to_cpu(*(u64*)(p + off)) - be64_to_cpu(*(u64*)(q + off)); > > > > I always assumed 64bits unaligned access would trigger an exception. > > Is this correct ? > > As far as I know, an unaligned access will only occur when the operand > of lmw, stmw, lwarx, or stwcx. is not aligned. > > Maybe that's different for PPC64 ? It's very implementation specific. Recent ppc64 chips generally don't trap (unless it's cache inhibited space). Earlier variants might trap on page boundaries or segment boundaries. Some embedded parts are less forgiving... some earlier POWER chips will trap on unaligned in LE mode... I wouldn't worry too much about it though. I think if 8xx shows an improvement then it's probably fine everywhere else :-) Cheers, Ben.