tcg/i386: Rely on undefined/undocumented behaviour of BSF/BSR
commit4ac76910734209dab83ddd3795f08fc7889ef463
authorRichard Henderson <rth@twiddle.net>
Fri, 18 Nov 2016 16:02:59 +0000 (18 17:02 +0100)
committerRichard Henderson <rth@twiddle.net>
Tue, 10 Jan 2017 16:47:48 +0000 (10 08:47 -0800)
tree294ec14a5508d99b315cedff08f4717caf028060
parentbbf25f90ba802a286fd72be9175a860ae5fec726
tcg/i386: Rely on undefined/undocumented behaviour of BSF/BSR

The ISA manual documents the output is undefined if the input was zero.

However, we document in target-i386 that the behavior of real silicon
is to preserve the contents of the output register.  We also mention
that there are real applications that depend on this.  That this is
baked into silicon is mentioned as a potential cause for some false
sharing behaviour wrt lzcnt/tzcnt.

Taking advantage of this allows us to save 2 insns in the normal case,
and 4 insns for i686 emulating a 64-bit clz.

Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg/i386/tcg-target.inc.c