Skip to contentSkip to conversation

drm/i915: Optimize DIV_ROUND_CLOSEST call

PATCH Applied Jean Delvare 2 participants 3 messages Nov 12, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Optimize DIV_ROUND_CLOSEST call

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.

Cc Guenter Roeck <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>

---
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(-)
drivers/gpu/drm/i915/intel_pm.c +2 -1
@@ -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));
Signature · 1 line
Jean Delvare
#1 lore raw
Quoted 9 lines · Jean Delvare

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.

Cc Guenter Roeck <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
Quoted 4 lines

---
Already sent on: 2012-09-03.

Daniel, I think we can safely assume ia_freq can't be negative?

Queued for -next, thanks for the patch. Sorry that I've missed it on first submission.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
Quoted 13 lines · Daniel Vetter
Quoted 12 lines · Jean Delvare

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.

Cc Guenter Roeck <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>

---
Already sent on: 2012-09-03.

Quoted 4 lines
Quoted 1 line

Daniel, I think we can safely assume ia_freq can't be negative?

Queued for -next, thanks for the patch. Sorry that I've missed it on first submission.

No problem, thanks :)

Signature · 1 line
Jean Delvare