RESOLVED FIXED 152886
[mips] Add countLeadingZeros32 implementation in macro assembler
https://bugs.webkit.org/show_bug.cgi?id=152886
Summary [mips] Add countLeadingZeros32 implementation in macro assembler
Julien Brianceau
Reported 2016-01-08 05:05:36 PST
void countLeadingZeros32(RegisterID src, RegisterID dest) implementation is missing from mips macro assembler
Attachments
Add countLeadingZeros32 implementation in mips macro assembler (2.20 KB, patch)
2016-01-08 05:19 PST, Julien Brianceau
no flags
Add countLeadingZeros32 implementation in mips macro assembler (v2) (2.19 KB, patch)
2016-01-09 00:51 PST, Julien Brianceau
msaboff: review+
Julien Brianceau
Comment 1 2016-01-08 05:19:37 PST
Created attachment 268538 [details] Add countLeadingZeros32 implementation in mips macro assembler
Konstantin Tokarev
Comment 2 2016-01-08 05:26:54 PST
Comment on attachment 268538 [details] Add countLeadingZeros32 implementation in mips macro assembler View in context: https://bugs.webkit.org/attachment.cgi?id=268538&action=review > Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:318 > + m_assembler.clz(dest, src); Shouldn't we have a fallback here in case assembler does not support clz?
Julien Brianceau
Comment 3 2016-01-08 05:39:39 PST
(In reply to comment #2) > Comment on attachment 268538 [details] > Add countLeadingZeros32 implementation in mips macro assembler > > View in context: > https://bugs.webkit.org/attachment.cgi?id=268538&action=review > > > Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:318 > > + m_assembler.clz(dest, src); > > Shouldn't we have a fallback here in case assembler does not support clz? It would be great to provide a generic fallback implementation indeed. However, mips32 is already a quite old ISA, so I doubt this would be useful to anyone.
Alex Christensen
Comment 4 2016-01-08 17:31:34 PST
Comment on attachment 268538 [details] Add countLeadingZeros32 implementation in mips macro assembler View in context: https://bugs.webkit.org/attachment.cgi?id=268538&action=review > Source/JavaScriptCore/assembler/MIPSAssembler.h:249 > + RELEASE_ASSERT_NOT_REACHED(); I think this should be static_assert(false, "CLZ opcode is not available for this ISA"); so that someone will notice this when compiling instead of waiting to compile and do somewhat thorough testing on a device.
Julien Brianceau
Comment 5 2016-01-09 00:51:44 PST
Created attachment 268617 [details] Add countLeadingZeros32 implementation in mips macro assembler (v2)
Julien Brianceau
Comment 6 2016-01-09 00:55:33 PST
(In reply to comment #4) > > I think this should be static_assert(false, "CLZ opcode is not available for > this ISA"); so that someone will notice this when compiling instead of > waiting to compile and do somewhat thorough testing on a device. You're right. I also took the opportunity to move the check from MIPSAssembler.h to MacroAssemblerMIPS.h, because if someone wants to write a generic implementation for an older ISA, MacroAssemblerMIPS.h is a better place than MIPSAssembler.h
Konstantin Tokarev
Comment 7 2016-01-09 05:27:58 PST
LGTM
Konstantin Tokarev
Comment 8 2016-01-14 13:54:25 PST
Could anyone approve this patch?
Michael Saboff
Comment 9 2016-01-14 14:24:50 PST
Comment on attachment 268617 [details] Add countLeadingZeros32 implementation in mips macro assembler (v2) Had to look up the encoding. r=me
Julien Brianceau
Comment 10 2016-01-15 00:13:15 PST
Note You need to log in before you can comment on or make changes to this bug.