On 10/09/2016 07:05 PM, Stefan Koch wrote:
On Sunday, 9 October 2016 at 22:11:50 UTC, Andrei Alexandrescu wrote:
Had a bit of a good time with popFront for UTF, got to this:
https://github.com/dlang/phobos/pull/4848. I suspect there are
cleverer things that can be done. Can anyone make it tighter? Take a
look at the disassembly referred to in the pull request. Thanks! --
Andrei
With -Oz both functions look almost the same on ldc and gdc
The big ldc link I posted:
http://ldc.acomirei.ru/#compilers:!((compiler:ldc,options:'-release+-O3+-boundscheck%3Doff',sourcez:G4ewlgJgBADiMDEBOIB2AXAjACiQUwDMoBjACwEMkBtAXSgGcBKKAAXSQFd709oYP8UVCHSkUAdygBvAFBQoYALaKO6cgCMANnhJQAvAyoAGGgG45CotmJQAPFCMAPABxHms%2BfPr6GAOhjsVJhQvr5%2B2qgA5qJmFgC%2BUHia9DoenkpwSOgkIPi%2B6mDo8OaeUBxgGAo%2BAOwcUAC0UOr0SNgAfjYAPlCYHIwl6YqZ2dwQvuSakbmFpIoD8mBWYFAAfFAAbH1VBpjzDD70/oGKFdhgADTheFGizKFXN6Sx8nEyrzKgkLDwyGjoAEy4QgkCjUOjcJDMNicbi8WACHTCUQSaQWJQqNRaHQ2AwQ4zPSxQax2BwuNwWNLyAD0VICSAU3i4cKKUHIn2gHFQXLwxDw9HolAAnk0QJyIN4yDyANYVSK%2BCxedgHdhHajBe4Q3wRaJPAaveRJFKE4l6AxOAgERgUhVQGlNFplVAQQgVOEEXIOG0Q5VIVVBEJhTXamJ6iyGvDW0oZXLZYi5PD5QrwKAALntSD25FUICginozRqDXT7WI/RtiyJ2DzBfs/2Y3Sr%2Be8a3WjCtpUpnhpAElUMAJl8AKoAFQQ9WcNvk1e8Oz2%2BsGwwY6DGEymSBmcy9StxKrpVBOqEbzUuQeuOrugZVwd18TeMiAA)),filterAsm:(commentOnly:!t,directives:!t,labels:!t),version:3
uses -O3, not -Oz. Changing the flag to -Oz seems to cause no change in
the generated code. I see different code generated for popFront1
(proposed) and popFront2 (candidate), e.g. popFront1 has 27 asm lines
whereas popFront2 has 34. (BTW: is there an easy way to see the size of
the generated functions?)
Under what conditions did you notice almost identical code?
Thanks,
Andrei