aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
diff options
context:
space:
mode:
authorjoachimschmidt557 <joachim.schmidt557@outlook.com>2021-03-27 21:39:55 +0100
committerJakub Konka <kubkon@jakubkonka.com>2021-03-31 23:26:49 +0200
commite088a17f56a154ecc43c36e8308833d657e6f43e (patch)
tree776c36bb528ac145d96dda5ede95ec3d3e8ef3d0 /src/codegen.zig
parent501b4aff9968e691283dd6ce637b503a12b03d38 (diff)
downloadzig-e088a17f56a154ecc43c36e8308833d657e6f43e.tar.gz
zig-e088a17f56a154ecc43c36e8308833d657e6f43e.zip
stage2 AArch64: implement strb and strh
Diffstat (limited to 'src/codegen.zig')
-rw-r--r--src/codegen.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/codegen.zig b/src/codegen.zig
index 858a1e6559..6365d66ec6 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -3111,7 +3111,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
const adj_off = stack_offset + abi_size;
switch (abi_size) {
- 4, 8 => {
+ 1, 2, 4, 8 => {
const offset = if (math.cast(i9, adj_off)) |imm|
Instruction.LoadStoreOffset.imm_post_index(-imm)
else |_|
@@ -3121,8 +3121,14 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
.aarch64_32 => .w29,
else => unreachable,
};
+ const str = switch (abi_size) {
+ 1 => Instruction.strb,
+ 2 => Instruction.strh,
+ 4, 8 => Instruction.str,
+ else => unreachable, // unexpected abi size
+ };
- writeInt(u32, try self.code.addManyAsArray(4), Instruction.str(reg, rn, .{
+ writeInt(u32, try self.code.addManyAsArray(4), str(reg, rn, .{
.offset = offset,
}).toU32());
},