authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-03-14 07:05:06+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-03-16 21:38:43+07:00
loga8dde7f0ae0776bc3ba5ad45fd0dd6578171425a
tree5dc3731270f4219815847088fba13bed54645546
parentf5a4d24cc0ddb65911a9ede1d364577afde696b4

stage2 sparcv9: Minor parameter type changes

Use the `Condition` type for 2b/2c and signed integer for 4b/4d.

1 files changed, 6 insertions(+), 6 deletions(-)

src/arch/sparcv9/bits.zig+6-6
...@@ -498,7 +498,7 @@ pub const Instruction = union(enum) {...@@ -498,7 +498,7 @@ pub const Instruction = union(enum) {
498 };498 };
499 }499 }
500500
501 fn format2b(annul: bool, cond: u4, op2: u3, disp: i24) Instruction {501 fn format2b(annul: bool, cond: Condition, op2: u3, disp: i24) Instruction {
502 // In SPARC, branch target needs to be aligned to 4 bytes.502 // In SPARC, branch target needs to be aligned to 4 bytes.
503 assert(disp % 4 == 0);503 assert(disp % 4 == 0);
504504
...@@ -514,7 +514,7 @@ pub const Instruction = union(enum) {...@@ -514,7 +514,7 @@ pub const Instruction = union(enum) {
514 };514 };
515 }515 }
516516
517 fn format2c(annul: bool, cond: u4, op2: u3, ccr: CCR, pt: bool, disp: i21) Instruction {517 fn format2c(annul: bool, cond: Condition, op2: u3, ccr: CCR, pt: bool, disp: i21) Instruction {
518 // In SPARC, branch target needs to be aligned to 4 bytes.518 // In SPARC, branch target needs to be aligned to 4 bytes.
519 assert(disp % 4 == 0);519 assert(disp % 4 == 0);
520520
...@@ -573,7 +573,7 @@ pub const Instruction = union(enum) {...@@ -573,7 +573,7 @@ pub const Instruction = union(enum) {
573 };573 };
574 }574 }
575575
576 fn format4b(rd: Register, op3: u6, rs1: Register, cc: CCR, simm11: u11) Instruction {576 fn format4b(rd: Register, op3: u6, rs1: Register, cc: CCR, imm: i11) Instruction {
577 const ccr_cc1 = @truncate(u1, @enumToInt(cc) >> 1);577 const ccr_cc1 = @truncate(u1, @enumToInt(cc) >> 1);
578 const ccr_cc0 = @truncate(u1, @enumToInt(cc));578 const ccr_cc0 = @truncate(u1, @enumToInt(cc));
579 return Instruction{579 return Instruction{
...@@ -583,7 +583,7 @@ pub const Instruction = union(enum) {...@@ -583,7 +583,7 @@ pub const Instruction = union(enum) {
583 .rs1 = rs1.enc(),583 .rs1 = rs1.enc(),
584 .cc1 = ccr_cc1,584 .cc1 = ccr_cc1,
585 .cc0 = ccr_cc0,585 .cc0 = ccr_cc0,
586 .simm11 = simm11,586 .simm11 = @bitCast(i11, imm),
587 },587 },
588 };588 };
589 }589 }
...@@ -605,7 +605,7 @@ pub const Instruction = union(enum) {...@@ -605,7 +605,7 @@ pub const Instruction = union(enum) {
605 };605 };
606 }606 }
607607
608 fn format4d(rd: Register, op3: u6, cc: CCR, cond: Condition, simm11: u11) Instruction {608 fn format4d(rd: Register, op3: u6, cc: CCR, cond: Condition, imm: i11) Instruction {
609 const ccr_cc2 = @truncate(u1, @enumToInt(cc) >> 2);609 const ccr_cc2 = @truncate(u1, @enumToInt(cc) >> 2);
610 const ccr_cc1 = @truncate(u1, @enumToInt(cc) >> 1);610 const ccr_cc1 = @truncate(u1, @enumToInt(cc) >> 1);
611 const ccr_cc0 = @truncate(u1, @enumToInt(cc));611 const ccr_cc0 = @truncate(u1, @enumToInt(cc));
...@@ -617,7 +617,7 @@ pub const Instruction = union(enum) {...@@ -617,7 +617,7 @@ pub const Instruction = union(enum) {
617 .cond = cond,617 .cond = cond,
618 .cc1 = ccr_cc1,618 .cc1 = ccr_cc1,
619 .cc0 = ccr_cc0,619 .cc0 = ccr_cc0,
620 .simm11 = simm11,620 .simm11 = @bitCast(i11, imm),
621 },621 },
622 };622 };
623 }623 }