Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
July 08, 2012 [D-runtime] core.bitop.bsr | ||||
---|---|---|---|---|
| ||||
Is there any reason that Phobos can't assume that core.bitop.bsr is defined? It's not versioned at all, so as far as I can tell, it will always exist. But for some reason std.utf.strideImpl currently checks for whether core.bitop.bsr is defined. I'd prefer to remove dead code like that. Does anyone know why it _wouldn't_ be dead code (i.e. why core.bitop.bsr wouldn't be defined)?
- Jonathan M Davis
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime
|
July 09, 2012 Re: [D-runtime] core.bitop.bsr | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Mon, Jul 9, 2012 at 5:57 AM, Jonathan M Davis <jmdavisProg@gmx.com> wrote: > Is there any reason that Phobos can't assume that core.bitop.bsr is defined? It's not versioned at all, so as far as I can tell, it will always exist. But for some reason std.utf.strideImpl currently checks for whether core.bitop.bsr is defined. I'd prefer to remove dead code like that. Does anyone know why it _wouldn't_ be dead code (i.e. why core.bitop.bsr wouldn't be defined)? It is always defined in DMD, GDC, and LDC. Just kill whatever code thinks it might not exist. Regards, Alex _______________________________________________ D-runtime mailing list D-runtime@puremagic.com http://lists.puremagic.com/mailman/listinfo/d-runtime |
July 09, 2012 Re: [D-runtime] core.bitop.bsr | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On 9 July 2012 04:57, Jonathan M Davis <jmdavisProg@gmx.com> wrote: > Is there any reason that Phobos can't assume that core.bitop.bsr is defined? It's not versioned at all, so as far as I can tell, it will always exist. But for some reason std.utf.strideImpl currently checks for whether core.bitop.bsr is defined. I'd prefer to remove dead code like that. Does anyone know why it _wouldn't_ be dead code (i.e. why core.bitop.bsr wouldn't be defined)? > bsr is handled as an internal builtin function here at gdc. -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; _______________________________________________ D-runtime mailing list D-runtime@puremagic.com http://lists.puremagic.com/mailman/listinfo/d-runtime |
July 10, 2012 Re: [D-runtime] core.bitop.bsr | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Mon, 09 Jul 2012 05:57:26 +0200, Jonathan M Davis <jmdavisProg@gmx.com> wrote: > Is there any reason that Phobos can't assume that core.bitop.bsr is defined? > It's not versioned at all, so as far as I can tell, it will always exist. But > for some reason std.utf.strideImpl currently checks for whether core.bitop.bsr > is defined. I'd prefer to remove dead code like that. Does anyone know why it > _wouldn't_ be dead code (i.e. why core.bitop.bsr wouldn't be defined)? > > - Jonathan M Davis > _______________________________________________ > D-runtime mailing list > D-runtime@puremagic.com > http://lists.puremagic.com/mailman/listinfo/d-runtime Yeah we should, bsr is very x86 specific, but intrinsics are broadly available and a handwritten replacement could easily be added. Just for the reference: LLVM: llvm.ctlz.* @ http://llvm.org/docs/LangRef.html#int_ctlz GCC: __builtin_clz @ http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Other-Builtins.html _______________________________________________ D-runtime mailing list D-runtime@puremagic.com http://lists.puremagic.com/mailman/listinfo/d-runtime |
July 10, 2012 Re: [D-runtime] core.bitop.bsr | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On 10 July 2012 09:10, Martin Nowak <dawg@dawgfoto.de> wrote: > On Mon, 09 Jul 2012 05:57:26 +0200, Jonathan M Davis <jmdavisProg@gmx.com> wrote: > >> Is there any reason that Phobos can't assume that core.bitop.bsr is >> defined? >> It's not versioned at all, so as far as I can tell, it will always exist. >> But >> for some reason std.utf.strideImpl currently checks for whether >> core.bitop.bsr >> is defined. I'd prefer to remove dead code like that. Does anyone know why >> it >> _wouldn't_ be dead code (i.e. why core.bitop.bsr wouldn't be defined)? >> >> - Jonathan M Davis >> _______________________________________________ >> D-runtime mailing list >> D-runtime@puremagic.com >> http://lists.puremagic.com/mailman/listinfo/d-runtime > > > Yeah we should, bsr is very x86 specific, but intrinsics are broadly > available > and a handwritten replacement could easily be added. > > Just for the reference: > > LLVM: llvm.ctlz.* @ http://llvm.org/docs/LangRef.html#int_ctlz GCC: __builtin_clz @ http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Other-Builtins.html bsf would be ctlz bsr is (31 - ctlz) or (63 - ctlz) depending on type size. -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; _______________________________________________ D-runtime mailing list D-runtime@puremagic.com http://lists.puremagic.com/mailman/listinfo/d-runtime |
Copyright © 1999-2021 by the D Language Foundation