There isn't really such a thing as "sign-extending a uint", as "uint" means
"unsigned int". Zero-extension is the only extension that makes sense for
uint32.

 I think we zero-extend most 32-bit values in V8, however there are a few
cases where we must explicitly sign-extend: specifically when a (signed)
int32 will be added to a 64-bit value, such as for address+offset
computations.
We do rely on 32-bit values being zero-extended in some places, so it's
important to keep those tests working.

(There *may* be room for significant cleanup/redesign there; but our
historical experience is that bugs very easily slip in there, so I'd rather
not change any assumptions unless there's a *really* strong reason to do
so.)


On Mon, Jul 26, 2021 at 2:31 PM Zhao Jiazhong <zhaojiazhong...@loongson.cn>
wrote:

> Hello everyone,
>
> AFAIK, MIPS64 and RV64 don't have 32-bit registers and according to
> their calling convention, they would sign-extend all 32-bit values when
> they are stored in 64-bit registers, both signed and unsigned, see: A
> related question in stackoverflow
> <https://stackoverflow.com/questions/52646216/zero-sign-extend-are-no-op-why-then-instructions-for-each-size-type>
> .
>
> But in v8 it seems the uint32 values are zero-extended? I tried to
> sign-extend uint32 values,  on mips64, which could elide some instructions,
> and only two more tests failed:
> - cctest/test-run-load-store/RunLoadStoreZeroExtend64
> - cctest/test-run-load-store/RunUnalignedLoadStoreZeroExtend64
> Just like their names suggest, they both may load some values and check
> whether they are zero-extended.
>
> So I wonder could uint32  values be sign-extended in v8 on MIPS64? Any
> suggestion would be appreciated, thanks!
>
> Thanks,
> Zhao Jiazhong
>
> --
>
>

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAKSzg3Q945XuHZR_rRcy0mVLaa%2B-3HiO6ST7cmd9Cg2VqvCrLA%40mail.gmail.com.

Reply via email to