From patchwork Mon Nov 12 13:18:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Delvare X-Patchwork-Id: 1728261 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 32714DFE80 for ; Mon, 12 Nov 2012 13:51:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21E989F078 for ; Mon, 12 Nov 2012 05:51:28 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1941 seconds by postgrey-1.32 at gabe; Mon, 12 Nov 2012 05:50:34 PST Received: from services.gcu-squad.org (zoneX.GCU-Squad.org [194.213.125.0]) by gabe.freedesktop.org (Postfix) with ESMTP id B5BDE9F083 for ; Mon, 12 Nov 2012 05:50:34 -0800 (PST) Received: from jdelvare.pck.nerim.net ([62.212.121.182] helo=endymion.delvare) by services.gcu-squad.org (GCU Mailer Daemon) with esmtpsa id 1TXttw-0007Yq-4d (TLSv1:AES128-SHA:128) (envelope-from ) ; Mon, 12 Nov 2012 14:18:08 +0100 Date: Mon, 12 Nov 2012 14:18:02 +0100 From: Jean Delvare To: Daniel Vetter , David Airlie Subject: [PATCH] drm/i915: Optimize DIV_ROUND_CLOSEST call Message-ID: <20121112141802.6326e589@endymion.delvare> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.7; x86_64-suse-linux-gnu) Mime-Version: 1.0 Cc: Andrew Morton , Guenter Roeck , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org DIV_ROUND_CLOSEST is faster if the compiler knows it will only be dealing with unsigned dividends. This optimization rips 32 bytes of binary code on x86_64. Signed-off-by: Jean Delvare Cc: Guenter Roeck Cc: Andrew Morton Cc: Daniel Vetter Cc: David Airlie --- Already sent on: 2012-09-03. Daniel, I think we can safely assume ia_freq can't be negative? drivers/gpu/drm/i915/intel_pm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- linux-3.7-rc5.orig/drivers/gpu/drm/i915/intel_pm.c 2012-11-12 09:30:56.796836818 +0100 +++ linux-3.7-rc5/drivers/gpu/drm/i915/intel_pm.c 2012-11-12 10:49:38.241676096 +0100 @@ -2547,7 +2547,8 @@ static void gen6_update_ring_freq(struct { struct drm_i915_private *dev_priv = dev->dev_private; int min_freq = 15; - int gpu_freq, ia_freq, max_ia_freq; + int gpu_freq; + unsigned int ia_freq, max_ia_freq; int scaling_factor = 180; WARN_ON(!mutex_is_locked(&dev->struct_mutex));