Skip to content

Commit d5aaa3e

Browse files
committed
{u,s}{add,sub,mul}_overflow emit tests for aarch64
1 parent 6f97598 commit d5aaa3e

2 files changed

Lines changed: 35 additions & 4 deletions

File tree

cranelift/codegen/src/isa/aarch64/inst/emit_tests.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,30 @@ fn test_aarch64_binemit() {
10861086
"4190039B",
10871087
"msub x1, x2, x3, x4",
10881088
));
1089+
insns.push((
1090+
Inst::AluRRRR {
1091+
alu_op: ALUOp3::UMAddL,
1092+
size: OperandSize::Size32,
1093+
rd: writable_xreg(1),
1094+
rn: xreg(2),
1095+
rm: xreg(3),
1096+
ra: xreg(4),
1097+
},
1098+
"4110A39B",
1099+
"umaddl x1, w2, w3, x4",
1100+
));
1101+
insns.push((
1102+
Inst::AluRRRR {
1103+
alu_op: ALUOp3::SMAddL,
1104+
size: OperandSize::Size32,
1105+
rd: writable_xreg(1),
1106+
rn: xreg(2),
1107+
rm: xreg(3),
1108+
ra: xreg(4),
1109+
},
1110+
"4110239B",
1111+
"smaddl x1, w2, w3, x4",
1112+
));
10891113
insns.push((
10901114
Inst::AluRRR {
10911115
alu_op: ALUOp::SMulH,

cranelift/codegen/src/isa/aarch64/inst/mod.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,16 +1191,23 @@ impl Inst {
11911191
rm,
11921192
ra,
11931193
} => {
1194+
let mut da_size = size;
11941195
let op = match alu_op {
11951196
ALUOp3::MAdd => "madd",
11961197
ALUOp3::MSub => "msub",
1197-
ALUOp3::UMAddL => "umaddl",
1198-
ALUOp3::SMAddL => "smaddl",
1198+
ALUOp3::UMAddL => {
1199+
da_size = OperandSize::Size64;
1200+
"umaddl"
1201+
}
1202+
ALUOp3::SMAddL => {
1203+
da_size = OperandSize::Size64;
1204+
"smaddl"
1205+
}
11991206
};
1200-
let rd = pretty_print_ireg(rd.to_reg(), size, allocs);
1207+
let rd = pretty_print_ireg(rd.to_reg(), da_size, allocs);
12011208
let rn = pretty_print_ireg(rn, size, allocs);
12021209
let rm = pretty_print_ireg(rm, size, allocs);
1203-
let ra = pretty_print_ireg(ra, size, allocs);
1210+
let ra = pretty_print_ireg(ra, da_size, allocs);
12041211

12051212
format!("{} {}, {}, {}, {}", op, rd, rn, rm, ra)
12061213
}

0 commit comments

Comments
 (0)