# stage2 x86_64: use abi size to determine 64-bit operation · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/5bd464e386df35bfe38b062190074ce3c2689001)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 5bd464e386df35bfe38b062190074ce3c2689001

Requested commit: 5bd464e386df35bfe38b062190074ce3c2689001

Commit: 5bd464e386df35bfe38b062190074ce3c2689001

Tree: b6f8a6f4b6e82814a8a20d7975cd9f1ce5f9b8de

Author: gracefu

Committer: gracefu

## Message

```
stage2 x86_64: use abi size to determine 64-bit operation

From my very cursory reading, it seems that the register manager doesn't
distinguish between registers that are physically the same but have
different sizes.

In that case, this means that during codegen, we can't rely on
`reg.size()` when determining the width of the operations we have to
perform. Instead, we must use some form of `ty.abiSize(self.target.*)`
to determine the size of the type we're operating with. If this size is
64 bits, then we should enable 64-bit operation.

This fixed a bug in the codegen for spilling instructions, which was
overwriting the previous stack entry with zeroes. See the modified test
case in this commit.

```

## Parents

- [36df1526da0e703a9f3d5bd6c8775d3f0e0f0a33](https://git.cafe/gitcafe/zig/commit/36df1526da0e703a9f3d5bd6c8775d3f0e0f0a33?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/5bd464e386df35bfe38b062190074ce3c2689001?format=markdown)
