About cctest/test-run-load-store/RunLoadStoreZeroExtend64 in v8

37 views
Skip to first unread message

Yahan Lu

unread,
Sep 23, 2021, 10:33:45 PM9/23/21
to v8-dev
Hi all ~
   I notice the case cctest/test-run-load-store/RunLoadStoreZeroExtend64.  
   It  load a uint32 from a pointer and store it back by Kword64

    Node* load64 = m.LoadFromPointer(&buffer[0], MachineType::Uint64());
    m.StoreToPointer(&buffer[3], MachineRepresentation::kWord64, load32);

    Does V8 default uint32 must be unsigned extended to 64bit in 64-bit platform?
    Due to riscv64 spec, riscv64 load a uint32 into register  and SignExtend to 64bit.


 
```
aswaterman commented on 3 Sep 2020

The sign-extension is an ABI constraint. If you want zero extension, you need to use a wider unsigned type, like uint64_t.

The intent of the RISC-V ISA is that 32-bit C values are stored sign extended in registers, even for unsigned types.

```

Reply all
Reply to author
Forward
0 new messages