stage2 aarch64: add NOP instruction

This commit is contained in:
Jakub Konka 2020-11-16 17:56:13 +01:00 committed by Andrew Kelley
parent cd4b54fd38
commit 8f47e8feb6

View File

@ -238,6 +238,9 @@ pub const Instruction = union(enum) {
fixed: u5 = 0b00101,
op: u1,
},
NoOperation: packed struct {
fixed: u32 = 0b1101010100_0_00_011_0010_0000_000_11111,
},
pub fn toU32(self: Instruction) u32 {
return switch (self) {
@ -247,6 +250,7 @@ pub const Instruction = union(enum) {
.ExceptionGeneration => |v| @bitCast(u32, v),
.UnconditionalBranchRegister => |v| @bitCast(u32, v),
.UnconditionalBranchImmediate => |v| @bitCast(u32, v),
.NoOperation => |v| @bitCast(u32, v),
};
}
@ -599,6 +603,12 @@ pub const Instruction = union(enum) {
pub fn bl(offset: i28) Instruction {
return unconditionalBranchImmediate(1, offset);
}
// Nop
pub fn nop() Instruction {
return Instruction{ .NoOperation = {} };
}
};
test "" {