Skip to content

Replace Create(ulong) with CreateScalar(uint) in PopCount#37912

Merged
kunalspathak merged 2 commits intodotnet:masterfrom
kunalspathak:min-popcount
Jun 16, 2020
Merged

Replace Create(ulong) with CreateScalar(uint) in PopCount#37912
kunalspathak merged 2 commits intodotnet:masterfrom
kunalspathak:min-popcount

Conversation

@kunalspathak
Copy link
Contributor

In PopCount(uint) implementation, we were creating Vector64<ulong> of input by casting uint to ulong because of #35976. However now that issue is fixed, revert to Vector.CreateScalar(uint) because that is more accurate readability wise and we generate equivalent optimal code.

Before:

G_M46009_IG02:
        2A0003E0          mov     w0, w0
        4E081C10          mov     v16.d[0], x0
        0E205A10          cnt     v16.8b, v16.8b
        0E31BA10          addv    b16, v16.8b
        0E013E00          umov    w0, v16.b[0]
                                                ;; bbWeight=1    PerfScore 5.50

After:

G_M46009_IG02:
        0F000410          movi    v16.2s, #0x00
        4E041C10          ins     v16.s[0], w0
        0E205A10          cnt     v16.8b, v16.8b
        0E31BA10          addv    b16, v16.8b
        0E013E00          umov    w0, v16.b[0]
                                                ;; bbWeight=1    PerfScore 5.50

@kunalspathak
Copy link
Contributor Author

@tannergooding , @echesakovMSFT

@kunalspathak kunalspathak merged commit 132be64 into dotnet:master Jun 16, 2020
@kunalspathak kunalspathak deleted the min-popcount branch June 16, 2020 06:40
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants