WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
170089
[jsc][mips] Add missing MacroAssembler functions after
r214187
https://bugs.webkit.org/show_bug.cgi?id=170089
Summary
[jsc][mips] Add missing MacroAssembler functions after r214187
Guillaume Emont
Reported
2017-03-24 17:16:02 PDT
We need to implement MacroAssemblerMIPS::loadFloat() and storeFloat() with an ImplicitAddress argument.
Attachments
Patch
(2.75 KB, patch)
2017-03-27 16:26 PDT
,
Guillaume Emont
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Guillaume Emont
Comment 1
2017-03-24 18:56:52 PDT
I am currently testing a patch that I will submit for revision once I'm confident it doesn't break anything (likely on Monday).
Guillaume Emont
Comment 2
2017-03-27 16:26:24 PDT
Created
attachment 305523
[details]
Patch The patch. It does not seem to break anything.
Yusuke Suzuki
Comment 3
2017-04-03 01:11:27 PDT
Comment on
attachment 305523
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=305523&action=review
r=me with comment.
> Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:2462 > + void loadFloat(ImplicitAddress address, FPRegisterID dest) > + { > + if (address.offset >= -32768 && address.offset <= 32767 > + && !m_fixedWidth) { > + m_assembler.lwc1(dest, address.base, address.offset); > + } else { > + /* > + lui addrTemp, (offset + 0x8000) >> 16 > + addu addrTemp, addrTemp, base > + lwc1 dest, (offset & 0xffff)(addrTemp) > + */ > + m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16); > + m_assembler.addu(addrTempRegister, addrTempRegister, address.base); > + m_assembler.lwc1(dest, addrTempRegister, address.offset); > + } > + }
Looking the loadDouble code, we can see WTF_MIPS_ISA(1) guard. Isn't it required here?
> Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:2617 > + }
Ditto.
Adrian Perez
Comment 4
2017-04-04 04:21:25 PDT
(In reply to Yusuke Suzuki from
comment #3
)
> Comment on
attachment 305523
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=305523&action=review
> > r=me with comment. > > > Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:2462 > > + void loadFloat(ImplicitAddress address, FPRegisterID dest) > > + { > > + if (address.offset >= -32768 && address.offset <= 32767 > > + && !m_fixedWidth) { > > + m_assembler.lwc1(dest, address.base, address.offset); > > + } else { > > + /* > > + lui addrTemp, (offset + 0x8000) >> 16 > > + addu addrTemp, addrTemp, base > > + lwc1 dest, (offset & 0xffff)(addrTemp) > > + */ > > + m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16); > > + m_assembler.addu(addrTempRegister, addrTempRegister, address.base); > > + m_assembler.lwc1(dest, addrTempRegister, address.offset); > > + } > > + } > > Looking the loadDouble code, we can see WTF_MIPS_ISA(1) guard. > Isn't it required here?
I think Yusuke is right. FPRegisterIDs refer to 64-bit registers. In MIPS32/MIPS-II “ldc1” can be used to load a 32-bit value directly, but in MIPS-I it is needed to use two “lwc1” instructions, one for each 32-bit half of the 64-bit value.
Guillaume Emont
Comment 5
2017-04-05 19:25:47 PDT
(In reply to Adrian Perez from
comment #4
)
> (In reply to Yusuke Suzuki from
comment #3
) > > Comment on
attachment 305523
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=305523&action=review
> > > > r=me with comment. > > > > > Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:2462 > > > + void loadFloat(ImplicitAddress address, FPRegisterID dest) > > > + { > > > + if (address.offset >= -32768 && address.offset <= 32767 > > > + && !m_fixedWidth) { > > > + m_assembler.lwc1(dest, address.base, address.offset); > > > + } else { > > > + /* > > > + lui addrTemp, (offset + 0x8000) >> 16 > > > + addu addrTemp, addrTemp, base > > > + lwc1 dest, (offset & 0xffff)(addrTemp) > > > + */ > > > + m_assembler.lui(addrTempRegister, (address.offset + 0x8000) >> 16); > > > + m_assembler.addu(addrTempRegister, addrTempRegister, address.base); > > > + m_assembler.lwc1(dest, addrTempRegister, address.offset); > > > + } > > > + } > > > > Looking the loadDouble code, we can see WTF_MIPS_ISA(1) guard. > > Isn't it required here? > > I think Yusuke is right. FPRegisterIDs refer to 64-bit registers. In > MIPS32/MIPS-II “ldc1” can be used to load a 32-bit value directly, > but in MIPS-I it is needed to use two “lwc1” instructions, one for > each 32-bit half of the 64-bit value.
No, I don't think we need that guard. loadDouble/storeDouble use that because MIPS-I does not contain the ldc1 (resp. sdc1) instruction, and therefore two lwc1 (resp swc1) instructions are used instead for the MIPS-I version. In loadFloat/storeFloat, we do not use ldc1/sdc1, and all the instructions that we use are MIPS-I compatible AFAIK, so there's no need for an alternative version. You can see that the pre-existing loadFloat/storeFloat with a BaseIndex argument don't have such a guard either, for the same reasons. Another way to put it: the need for special cases for MIPS-I only exists when dealing with doubles. The fact of using an ImplicitAddress instead of a BaseIndex does not incur this need. Another debate is whether we still want to support MIPS-I, I don't know if there still are many devices using that where it makes sense to use webkit, though I could be wrong, because, hey, we have these guards in the code.
Adrian Perez
Comment 6
2017-04-06 04:01:04 PDT
(In reply to Guillaume Emont from
comment #5
)
> Another way to put it: the need for special cases for MIPS-I only exists > when dealing with doubles. The fact of using an ImplicitAddress instead of a > BaseIndex does not incur this need.
Oh, I was assuming that loadFloat() would emit a load for a 64-bit value. Thanks for clarifying. Then you're right (and I should have checked the code before commenting) and it's an r+me :-)
> Another debate is whether we still want to support MIPS-I, I don't know if > there still are many devices using that where it makes sense to use webkit, > though I could be wrong, because, hey, we have these guards in the code.
The cost of maintaining MIPS-I support is quite low: ~/devel/WebKit % rg -F 'WTF_MIPS_ISA(1)' Source | wc -l 8 There's only the code for emitting load/save of 64-bit floating point values in “MacroAssemblerMIPS.h”, and two one-liners to insert “nop”-delays after some load instructions. It does not seem that it is much of a problem to keep the support around, though it's difficult to gauge how often JSC ends up running on MIPS-I hardware. As far as I know that would be only the original R2000/R3000 CPUs, and more recently clones (e.g. OpenCores has a synthetizable clean room design) often used as microcontrollers — so I have no strong opinion towards keeping the MIPS-I bits.
Yusuke Suzuki
Comment 7
2017-04-11 05:16:16 PDT
Comment on
attachment 305523
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=305523&action=review
>>>> Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h:2462 >>>> + } >>> >>> Looking the loadDouble code, we can see WTF_MIPS_ISA(1) guard. >>> Isn't it required here? >> >> I think Yusuke is right. FPRegisterIDs refer to 64-bit registers. In >> MIPS32/MIPS-II “ldc1” can be used to load a 32-bit value directly, >> but in MIPS-I it is needed to use two “lwc1” instructions, one for >> each 32-bit half of the 64-bit value. > > No, I don't think we need that guard. loadDouble/storeDouble use that because MIPS-I does not contain the ldc1 (resp. sdc1) instruction, and therefore two lwc1 (resp swc1) instructions are used instead for the MIPS-I version. In loadFloat/storeFloat, we do not use ldc1/sdc1, and all the instructions that we use are MIPS-I compatible AFAIK, so there's no need for an alternative version. > You can see that the pre-existing loadFloat/storeFloat with a BaseIndex argument don't have such a guard either, for the same reasons. > > Another way to put it: the need for special cases for MIPS-I only exists when dealing with doubles. The fact of using an ImplicitAddress instead of a BaseIndex does not incur this need. > > Another debate is whether we still want to support MIPS-I, I don't know if there still are many devices using that where it makes sense to use webkit, though I could be wrong, because, hey, we have these guards in the code.
Make sense.
WebKit Commit Bot
Comment 8
2017-04-11 05:44:50 PDT
Comment on
attachment 305523
[details]
Patch Clearing flags on attachment: 305523 Committed
r215226
: <
http://trac.webkit.org/changeset/215226
>
WebKit Commit Bot
Comment 9
2017-04-11 05:44:52 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug