I would give this "condition" a name
`@if(NEEDS_SPECIAL_INT32_TO_INT64_SIGN_EXTENSION)`
(maybe find something more descriptive) and then set this build flag for
all architectures that need that.

On Wed, Aug 7, 2024 at 10:52 AM Zhao Jiazhong <[email protected]>
wrote:

> Hi Nico,
>
> Thanks for your information, it indeed works!
> But it seems that the @if and @ifnot annotations can't handle two
> conditions at once like `@if(V8_TARGET_ARCH_LOONG64 ||
> V8_TARGET_ARCH_MIPS64)`, and I didn't find something like `@elif`.
> I thinks MIPS64 is likely need this change too, but add @if(MIPS64) and
> @ifnot(MIPS64) in @ifnot(LOONG64) seems ugly. Do you have any suggestions?
> Thank you very much!
>
> Yours,
> Zhao Jiazhong
> On Wednesday, August 7, 2024 at 2:21:24 PM UTC+8 [email protected]
> wrote:
>
>> Hi Zhao,
>>
>> you can use Torque's @if and @ifnot annotations to make such distinctions
>> (check @if(TAGGED_SIZE_8_BYTES) for an example). You then need to set this
>> from the C++ side in torque-parser.cc
>> <https://source.chromium.org/chromium/chromium/src/+/main:v8/src/torque/torque-parser.cc;l=46;drc=35bb990bac45ef15807c9eab4d60b8078b65f038>
>>  and
>> for that you can use the usual `V8_TARGET_ARCH_XXX`. The places where you
>> can use such annotations are a bit restricted if I remember correctly, but
>> it should be enough to support your case (maybe see this
>> <https://source.chromium.org/chromium/chromium/src/+/main:v8/src/builtins/promise-misc.tq;l=82;drc=7857eb34db42f339b337c6bdfb0d10deb14862f3>
>> for an example). Hope that helps.
>>
>> Cheers
>> Nico
>>
>>
>> On Wed, Aug 7, 2024 at 4:18 AM Zhao Jiazhong <[email protected]>
>> wrote:
>>
>>> Hi all,
>>>
>>> I'm porting JSPI to loong64 port, and find an issue that in
>>> JSToWasmWrapperHelper
>>> <https://source.chromium.org/chromium/chromium/src/+/refs/tags/119.0.6045.214:v8/src/builtins/js-to-wasm.tq;l=559>,
>>> a 32-bit value is converted to unsigned then converted to intptr, which
>>> leading to a zero-extended value, but on LoongArch64, we need the 32-bit
>>> value to be sign-extended in 64-bit registers.
>>>
>>> I don't want to change the behavior on other arches, but the builtin is
>>> written in torque, I suppose I can't use `V8_TARGET_ARCH_XXX` macro in
>>> it, so is there a way to distinguish v8 target arch in torque builtins?
>>> Thanks!
>>>
>>> Yours,
>>> Zhao Jiazhong
>>>
>>> --
>>> --
>>> v8-dev mailing list
>>> [email protected]
>>> http://groups.google.com/group/v8-dev
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/v8-dev/c2790cc7-513d-4296-8531-f620fe93e038n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/v8-dev/c2790cc7-513d-4296-8531-f620fe93e038n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> Nico Hartmann | Software Engineer | [email protected] | Chrome - V8
>>
> --
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-dev/88402770-d013-4847-8688-cfdf6cf0793an%40googlegroups.com
> <https://groups.google.com/d/msgid/v8-dev/88402770-d013-4847-8688-cfdf6cf0793an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Nico Hartmann | Software Engineer | [email protected] | Chrome - V8

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAHNjccKGuJRZ5d21%2B06YiSWjc6CaERZs0SC6cBA-Lq1kLgKQcw%40mail.gmail.com.

Reply via email to