login
Header Space

 
 

Re: [PATCH 01/18] flag parameters: helper function

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andrew Morton <akpm@...>
Cc: <linux-kernel@...>, <netdev@...>, <davidel@...>, <mtk.manpages@...>, <torvalds@...>
Date: Monday, May 5, 2008 - 10:39 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Morton wrote:

There really is no problem.  The value is in L1d when it is reused.
This is the generated code (%rdi is m):

   f:   85 17                   test   %edx,(%rdi)
  11:   74 0b                   je     1e <flags_remap+0x1e>
  13:   8b 47 04                mov    0x4(%rdi),%eax
  16:   09 01                   or     %eax,(%rcx)
  18:   8b 07                   mov    (%rdi),%eax
  1a:   f7 d0                   not    %eax
  1c:   21 c2                   and    %eax,%edx

At address 18 the load will be satisfied from L1d.  If you would want to
cache the value at address f you'd have to create one more instruction.

This really is the best code sequence.  The compiler could have chosen
to move the value into a register because the array is const.  But it
didn't.



That's Davide's code and I didn't change it because it doesn't really
matter.  This is a trivial function which doesn't need more than 10
seconds to be understood.  If you insist I'll rename the variables and
elements but I consider this just busy work.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFIH8Tl2ijCOnn/RHQRAm+PAKDEArdgKWXLAMzzfYQ3Q8XzbJdWmgCfavq+
+THu/JEISm+IrX7oyhITYVU=
=F2Co
-----END PGP SIGNATURE-----
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 01/18] flag parameters: helper function, Ulrich Drepper, (Sun May 4, 11:42 pm)
Re: [PATCH 01/18] flag parameters: helper function, Andrew Morton, (Mon May 5, 9:51 pm)
Re: [PATCH 01/18] flag parameters: helper function, Ulrich Drepper, (Mon May 5, 10:39 pm)
Re: [PATCH 01/18] flag parameters: helper function, Andrew Morton, (Mon May 5, 10:56 pm)
Re: [PATCH 01/18] flag parameters: helper function, Davide Libenzi, (Mon May 5, 10:09 pm)
Re: [PATCH 01/18] flag parameters: helper function, Davide Libenzi, (Mon May 5, 12:45 am)
Re: [PATCH 01/18] flag parameters: helper function, Ulrich Drepper, (Mon May 5, 1:02 am)
speck-geostationary