https://sourceware.org/bugzilla/show_bug.cgi?id=22871
--- Comment #20 from Linus Torvalds ---
I thought I could make the numbers more stable by using serializing
instructions (cpuid with %eax=0) around the rdtsc, but that just caused some
odd bi-modal behavior where testb/testl and testw/testq "p
https://sourceware.org/bugzilla/show_bug.cgi?id=22871
--- Comment #19 from Linus Torvalds ---
(In reply to Linus Torvalds from comment #18)
>
> Very interesting. I can confirm that testb seems slower on Skylake too.
Oh no, I take that back.
There's something else going on.
Sometimes I get res
https://sourceware.org/bugzilla/show_bug.cgi?id=22871
--- Comment #18 from Linus Torvalds ---
(In reply to H.J. Lu from comment #17)
> A testb microbenchmark
Very interesting. I can confirm that testb seems slower on Skylake too.
And it's not some odd effect of just the call/ret sequence - I di
https://sourceware.org/bugzilla/show_bug.cgi?id=22871
--- Comment #16 from Linus Torvalds ---
(In reply to H.J. Lu from comment #14)
> We should avoid testb optimization. This are latencies:
>
> testb : 33711871
> testw : 21204854
> testl : 18938530
> testq : 18942712
>
> on Haswell. Most
https://sourceware.org/bugzilla/show_bug.cgi?id=22871
--- Comment #12 from Linus Torvalds ---
(In reply to H.J. Lu from comment #11)
>
> imm8 isn't sign-extended. 8 bits should work.
No, it's not sign-extended to the full size, but it doesn't work because you
change the sign bit in the flags i
https://sourceware.org/bugzilla/show_bug.cgi?id=22871
--- Comment #10 from Linus Torvalds ---
(In reply to H.J. Lu from comment #7)
>
> Good point. I will remove "testq $imm31, mem". I will add
> "test{q,l,w} $imm8,%r{64,32,16}" to "testb $imm8,%r8" to -O3.
I'm assuming that you limit the im
https://sourceware.org/bugzilla/show_bug.cgi?id=22871
--- Comment #9 from Linus Torvalds ---
I already pointed this out in email to hjl, but adding it to the bugzilla too,
in case people want to track it:
There are a few more common cases that can use the REX.W optimization, notably
movq $
https://sourceware.org/bugzilla/show_bug.cgi?id=22871
Linus Torvalds changed:
What|Removed |Added
CC||torvalds@linux-foundation.o