Port 0x80 I/O speed
Here are a variety of machines:
600 MHz PIII (Katmai), 440BX chipset, 82371AB/EB/MB PIIX4 ISA bridge:
cycles: out 794, in 348
cycles: out 791, in 348
cycles: out 791, in 349
cycles: out 791, in 348
cycles: out 791, in 348
433 MHz Celeron (Mendocino), 440 BX chipset, same ISA bridge:
cycles: out 624, in 297
cycles: out 623, in 296
cycles: out 624, in 297
cycles: out 623, in 297
cycles: out 623, in 296
1100 MHz Athlon, nForce2 chipset, nForce2 ISA bridge:
cycles: out 1295, in 1162
cycles: out 1295, in 1162
cycles: out 1295, in 1162
cycles: out 1295, in 1162
cycles: out 1295, in 1162
800 MHz Transmeta Crusoe TM5800, Transmeta/ALi M7101 chipset.
cycles: out 1212, in 388
cycles: out 1195, in 375
cycles: out 1197, in 377
cycles: out 1196, in 376
cycles: out 1196, in 377
2200 MHz Athlon 64, K8T890 chipset, VT8237 ISA bridge:
cycles: out 1844674407370814, in 1844674407365758
cycles: out 1844674407370813, in 1844674407365756
cycles: out 1844674407370805, in 1844674407365750
cycles: out 1844674407370813, in 1844674407365755
cycles: out 1844674407370814, in 1844674407365756
Um, huh? That's gcc 4.2.3 (Debian version 4.2.2-4), -O2. Very odd.
I can run it with -O0:
cycles: out 4894, in 4894
cycles: out 4905, in 4917
cycles: out 4910, in 4896
cycles: out 4909, in 4896
cycles: out 4894, in 4898
cycles: out 4911, in 4898
or with -O2 -m32:
cycles: out 4914, in 4927
cycles: out 4913, in 4927
cycles: out 4913, in 4913
cycles: out 4914, in 4913
cycles: out 4913, in 4929
cycles: out 4912, in 4912
cycles: out 4913, in 4915
With -O2, the cycle counts come out (before division) as
out: 0xFFFFFFFFFFEA6F4F in: 0xFFFFFFFFFCE68BB6
I think the "A" constraint doesn't work quite the same in 64-bit code. The compiler seems to be using %rdx rather than %edx:%eax.
Quoted 6 lines · On 12 Dec 2007 06:20:49 -0500 [email protected] wrote:
With -O2, the cycle counts come out (before division) as
out: 0xFFFFFFFFFFEA6F4F in: 0xFFFFFFFFFCE68BB6I think the "A" constraint doesn't work quite the same in 64-bit code. The compiler seems to be using %rdx rather than %edx:%eax.
In another message he says to compile it with "-m32" :)
Signature · 2 lines
Paolo Ornati Linux 2.6.24-rc5-g4af75653 on x86_64
Quoted 1 line · On 12-12-07 12:20, [email protected] wrote:
Here are a variety of machines:
Thanks much for all! Collecting all data now...
Quoted 6 lines
With -O2, the cycle counts come out (before division) as
out: 0xFFFFFFFFFFEA6F4F in: 0xFFFFFFFFFCE68BB6I think the "A" constraint doesn't work quite the same in 64-bit code. The compiler seems to be using %rdx rather than %edx:%eax.
Yes indeed, that tripped me up. Have been using the "=A" locally for a while for similar timing tests. Will use a manual "=a" (lo), "=d" (hi) I guess for amd64 compatibility from now on.
If I'd care deeply I'd probably categorize this as a backwards compatibility bug in GCC though. Things were probably never guaranteed but they certainly worked that way...
Rene.