On Wed, Apr 25, 2012 at 10:18 AM, Alexei Filippov <[email protected]> wrote: > > 2012/4/25 Vitaly Repeshko <[email protected]> >> >> On Wed, Apr 25, 2012 at 1:24 AM, Alexandre Rames >> <[email protected]> wrote: >> > Not using the intrinsic shouldn't make any difference here. >> > >> > But __popcnt is the intrinsic, not the instruction. Shouldn't MS >> > compiler >> > automatically detect hardware support and use another solution if the >> > popcnt >> > isn't available. >> >> Maybe it should, but it's not what the MSDN page says it does. If it >> did, this code code would have to check some global flag every time, >> which would be more expensive than the operation itself, or require >> some patching in runtime. >> > He probably meant compile time checking.
Compile time checking won't work because this code is compiled only once and then used on different platforms, including old ones. E.g., there is no SSE2 build of V8; whether processor supports SSE2 is checked in runtime before JIT code is compiled. -- Vitaly > I used to implement some sse and avx intrinsics in Sun compiler and it also > does not provide generic implementation (emulation) for instruction related > intrinsics. > Btw their declarations are guarded by corresponding ifdefs in system > headers, so you cannot place a call to intrinsic which is not supported by > the target arch. > As for some other intrinsics (not instruction related), e.g. memcpy, strlen, > compiler provides multiple implementations that make full use of available > instruction set. > > Alexei > >> >> -- Vitaly >> >> > >> > On Wed, Apr 25, 2012 at 9:22 AM, Florian Schneider >> > <[email protected]> >> > wrote: >> >> >> >> Hm, interesting. I assume that we don't instruct g++ or msvc to >> >> generate >> >> any fancy SSE4.1 instructions anyway because V8 has to run on old >> >> non-SSE >> >> hardware - in which case the benefit of using the compiler intrinsics >> >> is >> >> probably void. >> >> >> >> Den 24. apr. 2012 19.20 skrev Vitaly Repeshko <[email protected]>: >> >> >> >>> FYI. http://msdn.microsoft.com/en-us/library/bb385231.aspx says "If >> >>> you run code that uses this intrinsic on hardware that does not >> >>> support the popcnt instruction, the results are unpredictable." >> >>> >> >>> >> >>> -- Vitaly >> >>> >> >>> On Tue, Apr 24, 2012 at 10:03 AM, Florian Schneider >> >>> <[email protected]> wrote: >> >>> > You're welcome. The Win32 builder still not happy. I'm not so >> >>> > familiar >> >>> > with >> >>> > our Windows buildbot configuration, so I'm fixing it for now by just >> >>> > avoiding the problematic compiler intrinsic >> >>> > (http://code.google.com/p/v8/source/detail?r=11428) It should not >> >>> > make >> >>> > a big >> >>> > difference, should it? >> >>> > >> >>> > >> >>> > >> >>> > Den 24. apr. 2012 18.14 skrev Alexandre Rames >> >>> > <[email protected]>: >> >>> > >> >>> >> Thanks! >> >>> >> >> >>> >> >> >>> >> On Tue, Apr 24, 2012 at 4:36 PM, <[email protected]> wrote: >> >>> >>> >> >>> >>> Thanks. Still LGTM. >> >>> >>> >> >>> >>> I'll re-land it >> >>> >>> >> >>> >>> http://codereview.chromium.org/9638018/ >> >>> >> >> >>> >> >> >>> > >> >>> > -- >> >>> > v8-dev mailing list >> >>> > [email protected] >> >>> > http://groups.google.com/group/v8-dev >> >>> >> >>> -- >> >>> v8-dev mailing list >> >>> [email protected] >> >>> http://groups.google.com/group/v8-dev >> >> >> >> >> > >> > -- >> > v8-dev mailing list >> > [email protected] >> > http://groups.google.com/group/v8-dev > > -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
