|
From: | David Chisnall |
Subject: | Re: Small change in NSObject.m ASM needed for PowerPC build |
Date: | Mon, 4 May 2009 22:23:47 +0100 |
On 4 May 2009, at 22:12, Fred Kiefer wrote:
Please keep in mind that my i586 is surely able to execute these instructions, still I get a link error with your latest patch. I think we agree that the aim is to get it to work out of the box on as much environments as possible. The i486 assembler code already restrictedthat a bit, but nobody has complained up to now (and the change has beenin a full year already). The gcc build in change would break it on my machine and an unknown amount of others as well.
I think it's important to work out why it is failing on your machine. The reason I suggested this change is that, for me, looking at the assembly, it generates the same code as our inline asm on x86 but also works on non-x86 platforms that we currently use a painfully slow code path for.
I am using GCC 4.2.1, and this compiles correctly with no -march= anything specified. If I specify -march=i386 it still generates the LOCK. Looking more deeply at the ISA references, it appears that the LOCK prefix was part of the original 80386 instruction set, so this is atomic on any x86 processor (it was the CMPXCHG instruction and friends that came in with the 80486).
Possibly the GCC version check is incorrect. According to the gcc docs, these functions appeared in 4.1.0, however it seems that 4.2 is when they became well-supported. Possibly setting 4.2.0 or 4.2.1 as the minimum GCC version to adopt them will be better?
David
[Prev in Thread] | Current Thread | [Next in Thread] |