Closed
Bug 583958
Opened 14 years ago
Closed 13 years ago
Add NEON detection to SSE.h?
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla5
People
(Reporter: m_kato, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 2 obsolete files)
3.42 KB,
patch
|
Details | Diff | Splinter Review | |
17.42 KB,
patch
|
derf
:
review+
|
Details | Diff | Splinter Review |
By bug 513422, MMX/SSE detection for x86/x86_64 is added. I need NEON detection for ARM processor such as Cortex-A8/SnapDragon.
Reporter | ||
Comment 1•14 years ago
|
||
Comment 2•14 years ago
|
||
See also bug 585708.
Reporter | ||
Updated•14 years ago
|
Attachment #472341 -
Flags: review?(dbaron)
Comment 3•14 years ago
|
||
I would very much like to base this patch on top of bug 585708's patch, since SSE.h is not particularly usable in its current state.
Reporter | ||
Comment 4•14 years ago
|
||
Justin, what status of bug 585708? I need this for NEON.
Comment 5•14 years ago
|
||
bug 585708 just needs a review. dbaron is currently tagged, although there was talk at some point of asking Vlad to review it; I forget what came of that. Do you know if we compile for ARM with -mneon (or it's somehow presumed)? If not, we certainly want to add this to bug 585708 so you can separate out your NEON code into separate files that get compiled with -mneon. If on the other hand we are presuming that NEON exists, gcc is free to use NEON instructions anywhere, and you don't need to guard on has_neon().
Reporter | ||
Comment 6•14 years ago
|
||
(In reply to comment #5) > bug 585708 just needs a review. dbaron is currently tagged, although there was > talk at some point of asking Vlad to review it; I forget what came of that. > > Do you know if we compile for ARM with -mneon (or it's somehow presumed)? If > not, we certainly want to add this to bug 585708 so you can separate out your > NEON code into separate files that get compiled with -mneon. No, Android and Maemo doesn't use -mfpu=neon. This fix is needed to detect whether CPU supports NEON. Also, Since I am writing all NEON optimization by inline assembler (not use built-in C function), it is unnecessary to separate file.
Comment 7•14 years ago
|
||
Ah, inline assembly, not intrinsics. Sure. In that case, I'd be ok with this patch going ahead as-is, although I'd really prefer just to fix SSE.h per bug 585708 before adding more code which relies on the current interface, which doesn't work for x86 intrinsics. (Off topic, I'm kind of surprised that we target phones which lack NEON.)
FYI, I'm waiting to review this until after bug 585708 lands.
Comment 9•14 years ago
|
||
And FYI, I'm waiting to land bug 585708 until the patches in its dependency tree get reviewed.
Reporter | ||
Comment 10•13 years ago
|
||
Attachment #472341 -
Attachment is obsolete: true
Attachment #472341 -
Flags: review?(dbaron)
Reporter | ||
Updated•13 years ago
|
Attachment #514163 -
Flags: review?(dbaron)
Comment 11•13 years ago
|
||
Comment on attachment 514163 [details] [diff] [review] patch v2 >+#if defined(ANDROID) >+static bool >+has_neon() >+{ >+ FILE *f = fopen("/proc/cpuinfo", "r"); >+ if (f) { >+ char buf[1024]; >+ >+ fread(buf, sizeof(char), 1024, f); >+ fclose(f); >+ if (strstr(buf, "neon")) { >+ return true; >+ } >+ } >+ return false; >+} How do you know buf is null-terminated?
Comment 13•13 years ago
|
||
I also needed this, and wrote a competing patch (attached) before I found out about this one. I think it makes more sense to keep the ARM code separate from the SSE code, as they are not really related at all.
Comment 14•13 years ago
|
||
Just adding that I've tested my patch on both Maemo and Android, and x86 Linux, and does the right thing in each case (as noted in bug 640980). I've also now tested it on a Tegra2, and it correctly disables NEON.
Comment 15•13 years ago
|
||
Comment on attachment 518835 [details] [diff] [review] Generic ARM/NEON detection I had a quick look and assuming this just a port of SSE.h to ARM saw nothing objectionable. It might be worth only using the /proc/cpuinfo instead of /proc/self/auxv on Android like pixman does.
Attachment #518835 -
Flags: review+
Comment 16•13 years ago
|
||
(In reply to comment #15) > Comment on attachment 518835 [details] [diff] [review] > Generic ARM/NEON detection > > I had a quick look and assuming this just a port of SSE.h to ARM saw nothing > objectionable. It might be worth only using the /proc/cpuinfo instead of > /proc/self/auxv on Android like pixman does. The comment about scratchbox is a little unclear. It makes it seem like /proc/self/auxv would work in scratchbox, but we fail detection because we're using /proc/cpuinfo and that this is undesirable.
Comment 17•13 years ago
|
||
Updated patch with revised comment, carrying forward r=jrmuizel
Attachment #518835 -
Attachment is obsolete: true
Attachment #519174 -
Flags: review+
Comment on attachment 514163 [details] [diff] [review] patch v2 Sounds like this review request isn't needed anymore; sorry for delaying it so long.
Attachment #514163 -
Flags: review?(dbaron)
Comment 19•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/3b33622916e2
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
You need to log in
before you can comment on or make changes to this bug.
Description
•