Commit c21438ab authored by Liu Yu's avatar Liu Yu Committed by V8 LUCI CQ

[loong64] Adjust the disassembler instruction format

Change-Id: I1148508825b7bdff3dae0634aed5318a605ba4da
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3153355Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Auto-Submit: Liu yu <liuyu@loongson.cn>
Cr-Commit-Position: refs/heads/main@{#76762}
parent b728cd9c
......@@ -62,7 +62,6 @@ class Decoder {
void PrintUi5(Instruction* instr);
void PrintUi6(Instruction* instr);
void PrintUi12(Instruction* instr);
void PrintXi12(Instruction* instr);
void PrintMsbw(Instruction* instr);
void PrintLsbw(Instruction* instr);
void PrintMsbd(Instruction* instr);
......@@ -72,6 +71,8 @@ class Decoder {
void PrintSi14(Instruction* instr);
void PrintSi16(Instruction* instr);
void PrintSi20(Instruction* instr);
void PrintXi12(Instruction* instr);
void PrintXi20(Instruction* instr);
void PrintCj(Instruction* instr);
void PrintCd(Instruction* instr);
void PrintCa(Instruction* instr);
......@@ -206,6 +207,11 @@ void Decoder::PrintXi12(Instruction* instr) {
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", xi);
}
void Decoder::PrintXi20(Instruction* instr) {
int xi = instr->Si20Value();
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", xi);
}
void Decoder::PrintMsbd(Instruction* instr) {
int msbd = instr->MsbdValue();
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%u", msbd);
......@@ -228,23 +234,27 @@ void Decoder::PrintLsbw(Instruction* instr) {
void Decoder::PrintSi12(Instruction* instr) {
int si = ((instr->Si12Value()) << (32 - kSi12Bits)) >> (32 - kSi12Bits);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", si);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d(0x%x)",
si, instr->Si12Value());
}
void Decoder::PrintSi14(Instruction* instr) {
int si = ((instr->Si14Value()) << (32 - kSi14Bits)) >> (32 - kSi14Bits);
si <<= 2;
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", si);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d(0x%x)",
si, instr->Si14Value() << 2);
}
void Decoder::PrintSi16(Instruction* instr) {
int si = ((instr->Si16Value()) << (32 - kSi16Bits)) >> (32 - kSi16Bits);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", si);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d(0x%x)",
si, instr->Si16Value());
}
void Decoder::PrintSi20(Instruction* instr) {
int si = ((instr->Si20Value()) << (32 - kSi20Bits)) >> (32 - kSi20Bits);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", si);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d(0x%x)",
si, instr->Si20Value());
}
void Decoder::PrintCj(Instruction* instr) {
......@@ -314,23 +324,20 @@ void Decoder::PrintPCOffs26(Instruction* instr) {
void Decoder::PrintOffs16(Instruction* instr) {
int offs = instr->Offs16Value();
offs <<= (32 - kOffsLowBits);
offs >>= (32 - kOffsLowBits);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", offs);
out_buffer_pos_ +=
base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", offs << 2);
}
void Decoder::PrintOffs21(Instruction* instr) {
int offs = instr->Offs21Value();
offs <<= (32 - kOffsLowBits - kOffs21HighBits);
offs >>= (32 - kOffsLowBits - kOffs21HighBits);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", offs);
out_buffer_pos_ +=
base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", offs << 2);
}
void Decoder::PrintOffs26(Instruction* instr) {
int offs = instr->Offs26Value();
offs <<= (32 - kOffsLowBits - kOffs26HighBits);
offs >>= (32 - kOffsLowBits - kOffs26HighBits);
out_buffer_pos_ += base::SNPrintF(out_buffer_ + out_buffer_pos_, "%d", offs);
out_buffer_pos_ +=
base::SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", offs << 2);
}
// Handle all register based formatting in this function to reduce the
......@@ -541,10 +548,17 @@ int Decoder::FormatOption(Instruction* instr, const char* format) {
break;
}
case 'x': {
if (format[2] == '2') {
DCHECK(STRING_STARTS_WITH(format, "xi20"));
PrintXi20(instr);
return 4;
} else if (format[3] == '2') {
DCHECK(STRING_STARTS_WITH(format, "xi12"));
PrintXi12(instr);
return 4;
}
break;
}
default:
UNREACHABLE();
}
......@@ -643,22 +657,22 @@ void Decoder::DecodeTypekOp6(Instruction* instr) {
void Decoder::DecodeTypekOp7(Instruction* instr) {
switch (instr->Bits(31, 25) << 25) {
case LU12I_W:
Format(instr, "lu12i.w 'rd, 'si20");
Format(instr, "lu12i.w 'rd, 'xi20");
break;
case LU32I_D:
Format(instr, "lu32i.d 'rd, 'si20");
Format(instr, "lu32i.d 'rd, 'xi20");
break;
case PCADDI:
Format(instr, "pcaddi 'rd, 'si20");
Format(instr, "pcaddi 'rd, 'xi20");
break;
case PCALAU12I:
Format(instr, "pcalau12i 'rd, 'si20");
Format(instr, "pcalau12i 'rd, 'xi20");
break;
case PCADDU12I:
Format(instr, "pcaddu12i 'rd, 'si20");
Format(instr, "pcaddu12i 'rd, 'xi20");
break;
case PCADDU18I:
Format(instr, "pcaddu18i 'rd, 'si20");
Format(instr, "pcaddu18i 'rd, 'xi20");
break;
default:
UNREACHABLE();
......@@ -727,7 +741,7 @@ void Decoder::DecodeTypekOp10(Instruction* instr) {
Format(instr, "addi.d 'rd, 'rj, 'si12");
break;
case LU52I_D:
Format(instr, "lu52i.d 'rd, 'rj, 'si12");
Format(instr, "lu52i.d 'rd, 'rj, 'xi12");
break;
case ANDI:
Format(instr, "andi 'rd, 'rj, 'xi12");
......
......@@ -110,9 +110,9 @@ bool DisassembleAndCompare(byte* pc, const char* compare_string) {
TEST(TypeOp6) {
SET_UP();
COMPARE(jirl(ra, t7, 0), "4c000261 jirl ra, t7, 0");
COMPARE(jirl(ra, t7, 32767), "4dfffe61 jirl ra, t7, 32767");
COMPARE(jirl(ra, t7, -32768), "4e000261 jirl ra, t7, -32768");
COMPARE(jirl(ra, t7, 0), "4c000261 jirl ra, t7, 0x0");
COMPARE(jirl(ra, t7, 32767), "4dfffe61 jirl ra, t7, 0x1fffc");
COMPARE(jirl(ra, t7, -32768), "4e000261 jirl ra, t7, 0x20000");
VERIFY_RUN();
}
......@@ -120,69 +120,71 @@ TEST(TypeOp6) {
TEST(TypeOp6PC) {
SET_UP();
COMPARE_PC_REL(beqz(t7, 1048575), "43fffe6f beqz t7, 1048575",
COMPARE_PC_REL(beqz(t7, 1048575), "43fffe6f beqz t7, 0x3ffffc",
1048575);
COMPARE_PC_REL(beqz(t0, -1048576), "40000190 beqz t0, -1048576",
COMPARE_PC_REL(beqz(t0, -1048576), "40000190 beqz t0, 0x400000",
-1048576);
COMPARE_PC_REL(beqz(t1, 0), "400001a0 beqz t1, 0", 0);
COMPARE_PC_REL(beqz(t1, 0), "400001a0 beqz t1, 0x0", 0);
COMPARE_PC_REL(bnez(a2, 1048575), "47fffccf bnez a2, 1048575",
COMPARE_PC_REL(bnez(a2, 1048575), "47fffccf bnez a2, 0x3ffffc",
1048575);
COMPARE_PC_REL(bnez(s3, -1048576), "44000350 bnez s3, -1048576",
COMPARE_PC_REL(bnez(s3, -1048576), "44000350 bnez s3, 0x400000",
-1048576);
COMPARE_PC_REL(bnez(t8, 0), "44000280 bnez t8, 0", 0);
COMPARE_PC_REL(bnez(t8, 0), "44000280 bnez t8, 0x0", 0);
COMPARE_PC_REL(bceqz(FCC0, 1048575), "4bfffc0f bceqz fcc0, 1048575",
1048575);
COMPARE_PC_REL(bceqz(FCC0, 1048575),
"4bfffc0f bceqz fcc0, 0x3ffffc", 1048575);
COMPARE_PC_REL(bceqz(FCC0, -1048576),
"48000010 bceqz fcc0, -1048576", -1048576);
COMPARE_PC_REL(bceqz(FCC0, 0), "48000000 bceqz fcc0, 0", 0);
"48000010 bceqz fcc0, 0x400000", -1048576);
COMPARE_PC_REL(bceqz(FCC0, 0), "48000000 bceqz fcc0, 0x0", 0);
COMPARE_PC_REL(bcnez(FCC0, 1048575), "4bfffd0f bcnez fcc0, 1048575",
1048575);
COMPARE_PC_REL(bcnez(FCC0, 1048575),
"4bfffd0f bcnez fcc0, 0x3ffffc", 1048575);
COMPARE_PC_REL(bcnez(FCC0, -1048576),
"48000110 bcnez fcc0, -1048576", -1048576);
COMPARE_PC_REL(bcnez(FCC0, 0), "48000100 bcnez fcc0, 0", 0);
COMPARE_PC_REL(b(33554431), "53fffdff b 33554431", 33554431);
COMPARE_PC_REL(b(-33554432), "50000200 b -33554432", -33554432);
COMPARE_PC_REL(b(0), "50000000 b 0", 0);
COMPARE_PC_REL(beq(t0, a6, 32767), "59fffd8a beq t0, a6, 32767",
32767);
COMPARE_PC_REL(beq(t1, a0, -32768), "5a0001a4 beq t1, a0, -32768",
-32768);
COMPARE_PC_REL(beq(a4, t1, 0), "5800010d beq a4, t1, 0", 0);
COMPARE_PC_REL(bne(a3, a4, 32767), "5dfffce8 bne a3, a4, 32767",
32767);
COMPARE_PC_REL(bne(a6, a5, -32768), "5e000149 bne a6, a5, -32768",
-32768);
COMPARE_PC_REL(bne(a4, a5, 0), "5c000109 bne a4, a5, 0", 0);
COMPARE_PC_REL(blt(a4, a6, 32767), "61fffd0a blt a4, a6, 32767",
32767);
COMPARE_PC_REL(blt(a4, a5, -32768), "62000109 blt a4, a5, -32768",
-32768);
COMPARE_PC_REL(blt(a4, a6, 0), "6000010a blt a4, a6, 0", 0);
COMPARE_PC_REL(bge(s7, a5, 32767), "65ffffc9 bge s7, a5, 32767",
32767);
COMPARE_PC_REL(bge(a1, a3, -32768), "660000a7 bge a1, a3, -32768",
-32768);
COMPARE_PC_REL(bge(a5, s3, 0), "6400013a bge a5, s3, 0", 0);
COMPARE_PC_REL(bltu(a5, s7, 32767), "69fffd3e bltu a5, s7, 32767",
32767);
COMPARE_PC_REL(bltu(a4, a5, -32768), "6a000109 bltu a4, a5, -32768",
-32768);
COMPARE_PC_REL(bltu(a4, t6, 0), "68000112 bltu a4, t6, 0", 0);
COMPARE_PC_REL(bgeu(a7, a6, 32767), "6dfffd6a bgeu a7, a6, 32767",
32767);
COMPARE_PC_REL(bgeu(a5, a3, -32768), "6e000127 bgeu a5, a3, -32768",
-32768);
COMPARE_PC_REL(bgeu(t2, t1, 0), "6c0001cd bgeu t2, t1, 0", 0);
"48000110 bcnez fcc0, 0x400000", -1048576);
COMPARE_PC_REL(bcnez(FCC0, 0), "48000100 bcnez fcc0, 0x0", 0);
COMPARE_PC_REL(b(33554431), "53fffdff b 0x7fffffc",
33554431);
COMPARE_PC_REL(b(-33554432), "50000200 b 0x8000000",
-33554432);
COMPARE_PC_REL(b(0), "50000000 b 0x0", 0);
COMPARE_PC_REL(beq(t0, a6, 32767),
"59fffd8a beq t0, a6, 0x1fffc", 32767);
COMPARE_PC_REL(beq(t1, a0, -32768),
"5a0001a4 beq t1, a0, 0x20000", -32768);
COMPARE_PC_REL(beq(a4, t1, 0), "5800010d beq a4, t1, 0x0", 0);
COMPARE_PC_REL(bne(a3, a4, 32767),
"5dfffce8 bne a3, a4, 0x1fffc", 32767);
COMPARE_PC_REL(bne(a6, a5, -32768),
"5e000149 bne a6, a5, 0x20000", -32768);
COMPARE_PC_REL(bne(a4, a5, 0), "5c000109 bne a4, a5, 0x0", 0);
COMPARE_PC_REL(blt(a4, a6, 32767),
"61fffd0a blt a4, a6, 0x1fffc", 32767);
COMPARE_PC_REL(blt(a4, a5, -32768),
"62000109 blt a4, a5, 0x20000", -32768);
COMPARE_PC_REL(blt(a4, a6, 0), "6000010a blt a4, a6, 0x0", 0);
COMPARE_PC_REL(bge(s7, a5, 32767),
"65ffffc9 bge s7, a5, 0x1fffc", 32767);
COMPARE_PC_REL(bge(a1, a3, -32768),
"660000a7 bge a1, a3, 0x20000", -32768);
COMPARE_PC_REL(bge(a5, s3, 0), "6400013a bge a5, s3, 0x0", 0);
COMPARE_PC_REL(bltu(a5, s7, 32767),
"69fffd3e bltu a5, s7, 0x1fffc", 32767);
COMPARE_PC_REL(bltu(a4, a5, -32768),
"6a000109 bltu a4, a5, 0x20000", -32768);
COMPARE_PC_REL(bltu(a4, t6, 0), "68000112 bltu a4, t6, 0x0", 0);
COMPARE_PC_REL(bgeu(a7, a6, 32767),
"6dfffd6a bgeu a7, a6, 0x1fffc", 32767);
COMPARE_PC_REL(bgeu(a5, a3, -32768),
"6e000127 bgeu a5, a3, 0x20000", -32768);
COMPARE_PC_REL(bgeu(t2, t1, 0), "6c0001cd bgeu t2, t1, 0x0", 0);
VERIFY_RUN();
}
......@@ -190,30 +192,30 @@ TEST(TypeOp6PC) {
TEST(TypeOp7) {
SET_UP();
COMPARE(lu12i_w(a4, 524287), "14ffffe8 lu12i.w a4, 524287");
COMPARE(lu12i_w(a5, -524288), "15000009 lu12i.w a5, -524288");
COMPARE(lu12i_w(a6, 0), "1400000a lu12i.w a6, 0");
COMPARE(lu12i_w(a4, 524287), "14ffffe8 lu12i.w a4, 0x7ffff");
COMPARE(lu12i_w(a5, -524288), "15000009 lu12i.w a5, 0x80000");
COMPARE(lu12i_w(a6, 0), "1400000a lu12i.w a6, 0x0");
COMPARE(lu32i_d(a7, 524287), "16ffffeb lu32i.d a7, 524287");
COMPARE(lu32i_d(t0, 524288), "1700000c lu32i.d t0, -524288");
COMPARE(lu32i_d(t1, 0), "1600000d lu32i.d t1, 0");
COMPARE(lu32i_d(a7, 524287), "16ffffeb lu32i.d a7, 0x7ffff");
COMPARE(lu32i_d(t0, -524288), "1700000c lu32i.d t0, 0x80000");
COMPARE(lu32i_d(t1, 0), "1600000d lu32i.d t1, 0x0");
COMPARE(pcaddi(t1, 1), "1800002d pcaddi t1, 1");
COMPARE(pcaddi(t2, 524287), "18ffffee pcaddi t2, 524287");
COMPARE(pcaddi(t3, -524288), "1900000f pcaddi t3, -524288");
COMPARE(pcaddi(t4, 0), "18000010 pcaddi t4, 0");
COMPARE(pcaddi(t1, 1), "1800002d pcaddi t1, 0x1");
COMPARE(pcaddi(t2, 524287), "18ffffee pcaddi t2, 0x7ffff");
COMPARE(pcaddi(t3, -524288), "1900000f pcaddi t3, 0x80000");
COMPARE(pcaddi(t4, 0), "18000010 pcaddi t4, 0x0");
COMPARE(pcalau12i(t5, 524287), "1afffff1 pcalau12i t5, 524287");
COMPARE(pcalau12i(t6, -524288), "1b000012 pcalau12i t6, -524288");
COMPARE(pcalau12i(a4, 0), "1a000008 pcalau12i a4, 0");
COMPARE(pcalau12i(t5, 524287), "1afffff1 pcalau12i t5, 0x7ffff");
COMPARE(pcalau12i(t6, -524288), "1b000012 pcalau12i t6, 0x80000");
COMPARE(pcalau12i(a4, 0), "1a000008 pcalau12i a4, 0x0");
COMPARE(pcaddu12i(a5, 524287), "1cffffe9 pcaddu12i a5, 524287");
COMPARE(pcaddu12i(a6, -524288), "1d00000a pcaddu12i a6, -524288");
COMPARE(pcaddu12i(a7, 0), "1c00000b pcaddu12i a7, 0");
COMPARE(pcaddu12i(a5, 524287), "1cffffe9 pcaddu12i a5, 0x7ffff");
COMPARE(pcaddu12i(a6, -524288), "1d00000a pcaddu12i a6, 0x80000");
COMPARE(pcaddu12i(a7, 0), "1c00000b pcaddu12i a7, 0x0");
COMPARE(pcaddu18i(t0, 524287), "1effffec pcaddu18i t0, 524287");
COMPARE(pcaddu18i(t1, -524288), "1f00000d pcaddu18i t1, -524288");
COMPARE(pcaddu18i(t2, 0), "1e00000e pcaddu18i t2, 0");
COMPARE(pcaddu18i(t0, 524287), "1effffec pcaddu18i t0, 0x7ffff");
COMPARE(pcaddu18i(t1, -524288), "1f00000d pcaddu18i t1, 0x80000");
COMPARE(pcaddu18i(t2, 0), "1e00000e pcaddu18i t2, 0x0");
VERIFY_RUN();
}
......@@ -221,37 +223,53 @@ TEST(TypeOp7) {
TEST(TypeOp8) {
SET_UP();
COMPARE(ll_w(t2, t3, 32764), "207ffdee ll.w t2, t3, 32764");
COMPARE(ll_w(t3, t4, -32768), "2080020f ll.w t3, t4, -32768");
COMPARE(ll_w(t5, t6, 0), "20000251 ll.w t5, t6, 0");
COMPARE(sc_w(a6, a7, 32764), "217ffd6a sc.w a6, a7, 32764");
COMPARE(sc_w(t0, t1, -32768), "218001ac sc.w t0, t1, -32768");
COMPARE(sc_w(t2, t3, 0), "210001ee sc.w t2, t3, 0");
COMPARE(ll_d(a0, a1, 32764), "227ffca4 ll.d a0, a1, 32764");
COMPARE(ll_d(a2, a3, -32768), "228000e6 ll.d a2, a3, -32768");
COMPARE(ll_d(a4, a5, 0), "22000128 ll.d a4, a5, 0");
COMPARE(sc_d(t4, t5, 32764), "237ffe30 sc.d t4, t5, 32764");
COMPARE(sc_d(t6, a0, -32768), "23800092 sc.d t6, a0, -32768");
COMPARE(sc_d(a1, a2, 0), "230000c5 sc.d a1, a2, 0");
COMPARE(ldptr_w(a4, a5, 32764), "247ffd28 ldptr.w a4, a5, 32764");
COMPARE(ldptr_w(a6, a7, -32768), "2480016a ldptr.w a6, a7, -32768");
COMPARE(ldptr_w(t0, t1, 0), "240001ac ldptr.w t0, t1, 0");
COMPARE(stptr_w(a4, a5, 32764), "257ffd28 stptr.w a4, a5, 32764");
COMPARE(stptr_w(a6, a7, -32768), "2580016a stptr.w a6, a7, -32768");
COMPARE(stptr_w(t0, t1, 0), "250001ac stptr.w t0, t1, 0");
COMPARE(ldptr_d(t2, t3, 32764), "267ffdee ldptr.d t2, t3, 32764");
COMPARE(ldptr_d(t4, t5, -32768), "26800230 ldptr.d t4, t5, -32768");
COMPARE(ldptr_d(t6, a4, 0), "26000112 ldptr.d t6, a4, 0");
COMPARE(stptr_d(a5, a6, 32764), "277ffd49 stptr.d a5, a6, 32764");
COMPARE(stptr_d(a7, t0, -32768), "2780018b stptr.d a7, t0, -32768");
COMPARE(stptr_d(t1, t2, 0), "270001cd stptr.d t1, t2, 0");
COMPARE(ll_w(t2, t3, 32764),
"207ffdee ll.w t2, t3, 32764(0x7ffc)");
COMPARE(ll_w(t3, t4, -32768),
"2080020f ll.w t3, t4, -32768(0x8000)");
COMPARE(ll_w(t5, t6, 0), "20000251 ll.w t5, t6, 0(0x0)");
COMPARE(sc_w(a6, a7, 32764),
"217ffd6a sc.w a6, a7, 32764(0x7ffc)");
COMPARE(sc_w(t0, t1, -32768),
"218001ac sc.w t0, t1, -32768(0x8000)");
COMPARE(sc_w(t2, t3, 0), "210001ee sc.w t2, t3, 0(0x0)");
COMPARE(ll_d(a0, a1, 32764),
"227ffca4 ll.d a0, a1, 32764(0x7ffc)");
COMPARE(ll_d(a2, a3, -32768),
"228000e6 ll.d a2, a3, -32768(0x8000)");
COMPARE(ll_d(a4, a5, 0), "22000128 ll.d a4, a5, 0(0x0)");
COMPARE(sc_d(t4, t5, 32764),
"237ffe30 sc.d t4, t5, 32764(0x7ffc)");
COMPARE(sc_d(t6, a0, -32768),
"23800092 sc.d t6, a0, -32768(0x8000)");
COMPARE(sc_d(a1, a2, 0), "230000c5 sc.d a1, a2, 0(0x0)");
COMPARE(ldptr_w(a4, a5, 32764),
"247ffd28 ldptr.w a4, a5, 32764(0x7ffc)");
COMPARE(ldptr_w(a6, a7, -32768),
"2480016a ldptr.w a6, a7, -32768(0x8000)");
COMPARE(ldptr_w(t0, t1, 0), "240001ac ldptr.w t0, t1, 0(0x0)");
COMPARE(stptr_w(a4, a5, 32764),
"257ffd28 stptr.w a4, a5, 32764(0x7ffc)");
COMPARE(stptr_w(a6, a7, -32768),
"2580016a stptr.w a6, a7, -32768(0x8000)");
COMPARE(stptr_w(t0, t1, 0), "250001ac stptr.w t0, t1, 0(0x0)");
COMPARE(ldptr_d(t2, t3, 32764),
"267ffdee ldptr.d t2, t3, 32764(0x7ffc)");
COMPARE(ldptr_d(t4, t5, -32768),
"26800230 ldptr.d t4, t5, -32768(0x8000)");
COMPARE(ldptr_d(t6, a4, 0), "26000112 ldptr.d t6, a4, 0(0x0)");
COMPARE(stptr_d(a5, a6, 32764),
"277ffd49 stptr.d a5, a6, 32764(0x7ffc)");
COMPARE(stptr_d(a7, t0, -32768),
"2780018b stptr.d a7, t0, -32768(0x8000)");
COMPARE(stptr_d(t1, t2, 0), "270001cd stptr.d t1, t2, 0(0x0)");
VERIFY_RUN();
}
......@@ -278,21 +296,28 @@ TEST(TypeOp10) {
COMPARE(bstrpick_d(a4, a4, 25, 2),
"00d90908 bstrpick.d a4, a4, 25, 2");
COMPARE(slti(t2, a5, 2047), "021ffd2e slti t2, a5, 2047");
COMPARE(slti(a7, a1, -2048), "022000ab slti a7, a1, -2048");
COMPARE(slti(t2, a5, 2047),
"021ffd2e slti t2, a5, 2047(0x7ff)");
COMPARE(slti(a7, a1, -2048),
"022000ab slti a7, a1, -2048(0x800)");
COMPARE(sltui(a7, a7, 2047), "025ffd6b sltui a7, a7, 2047");
COMPARE(sltui(t1, t1, -2048), "026001ad sltui t1, t1, -2048");
COMPARE(sltui(a7, a7, 2047),
"025ffd6b sltui a7, a7, 2047(0x7ff)");
COMPARE(sltui(t1, t1, -2048),
"026001ad sltui t1, t1, -2048(0x800)");
COMPARE(addi_w(t0, t2, 2047), "029ffdcc addi.w t0, t2, 2047");
COMPARE(addi_w(a0, a0, -2048), "02a00084 addi.w a0, a0, -2048");
COMPARE(addi_w(t0, t2, 2047),
"029ffdcc addi.w t0, t2, 2047(0x7ff)");
COMPARE(addi_w(a0, a0, -2048),
"02a00084 addi.w a0, a0, -2048(0x800)");
COMPARE(addi_d(a0, zero_reg, 2047),
"02dffc04 addi.d a0, zero_reg, 2047");
COMPARE(addi_d(t7, t7, -2048), "02e00273 addi.d t7, t7, -2048");
"02dffc04 addi.d a0, zero_reg, 2047(0x7ff)");
COMPARE(addi_d(t7, t7, -2048),
"02e00273 addi.d t7, t7, -2048(0x800)");
COMPARE(lu52i_d(a0, a0, 2047), "031ffc84 lu52i.d a0, a0, 2047");
COMPARE(lu52i_d(a1, a1, -2048), "032000a5 lu52i.d a1, a1, -2048");
COMPARE(lu52i_d(a0, a0, 2047), "031ffc84 lu52i.d a0, a0, 0x7ff");
COMPARE(lu52i_d(a1, a1, -2048), "032000a5 lu52i.d a1, a1, 0x800");
COMPARE(andi(s3, a3, 0xfff), "037ffcfa andi s3, a3, 0xfff");
COMPARE(andi(a4, a4, 0), "03400108 andi a4, a4, 0x0");
......@@ -303,51 +328,81 @@ TEST(TypeOp10) {
COMPARE(xori(t1, t1, 0xfff), "03fffdad xori t1, t1, 0xfff");
COMPARE(xori(a3, a3, 0x0), "03c000e7 xori a3, a3, 0x0");
COMPARE(ld_b(a1, a1, 2047), "281ffca5 ld.b a1, a1, 2047");
COMPARE(ld_b(a4, a4, -2048), "28200108 ld.b a4, a4, -2048");
COMPARE(ld_h(a4, a0, 2047), "285ffc88 ld.h a4, a0, 2047");
COMPARE(ld_h(a4, a3, -2048), "286000e8 ld.h a4, a3, -2048");
COMPARE(ld_w(a6, a6, 2047), "289ffd4a ld.w a6, a6, 2047");
COMPARE(ld_w(a5, a4, -2048), "28a00109 ld.w a5, a4, -2048");
COMPARE(ld_d(a0, a3, 2047), "28dffce4 ld.d a0, a3, 2047");
COMPARE(ld_d(a6, fp, -2048), "28e002ca ld.d a6, fp, -2048");
COMPARE(ld_d(a0, a6, 0), "28c00144 ld.d a0, a6, 0");
COMPARE(st_b(a4, a0, 2047), "291ffc88 st.b a4, a0, 2047");
COMPARE(st_b(a6, a5, -2048), "2920012a st.b a6, a5, -2048");
COMPARE(st_h(a4, a0, 2047), "295ffc88 st.h a4, a0, 2047");
COMPARE(st_h(t1, t2, -2048), "296001cd st.h t1, t2, -2048");
COMPARE(st_w(t3, a4, 2047), "299ffd0f st.w t3, a4, 2047");
COMPARE(st_w(a3, t2, -2048), "29a001c7 st.w a3, t2, -2048");
COMPARE(st_d(s3, sp, 2047), "29dffc7a st.d s3, sp, 2047");
COMPARE(st_d(fp, s6, -2048), "29e003b6 st.d fp, s6, -2048");
COMPARE(ld_bu(a6, a0, 2047), "2a1ffc8a ld.bu a6, a0, 2047");
COMPARE(ld_bu(a7, a7, -2048), "2a20016b ld.bu a7, a7, -2048");
COMPARE(ld_hu(a7, a7, 2047), "2a5ffd6b ld.hu a7, a7, 2047");
COMPARE(ld_hu(a3, a3, -2048), "2a6000e7 ld.hu a3, a3, -2048");
COMPARE(ld_wu(a3, a0, 2047), "2a9ffc87 ld.wu a3, a0, 2047");
COMPARE(ld_wu(a3, a5, -2048), "2aa00127 ld.wu a3, a5, -2048");
COMPARE(fld_s(f0, a3, 2047), "2b1ffce0 fld.s f0, a3, 2047");
COMPARE(fld_s(f0, a1, -2048), "2b2000a0 fld.s f0, a1, -2048");
COMPARE(fld_d(f0, a0, 2047), "2b9ffc80 fld.d f0, a0, 2047");
COMPARE(fld_d(f0, fp, -2048), "2ba002c0 fld.d f0, fp, -2048");
COMPARE(fst_d(f0, fp, 2047), "2bdffec0 fst.d f0, fp, 2047");
COMPARE(fst_d(f0, a0, -2048), "2be00080 fst.d f0, a0, -2048");
COMPARE(fst_s(f0, a5, 2047), "2b5ffd20 fst.s f0, a5, 2047");
COMPARE(fst_s(f0, a3, -2048), "2b6000e0 fst.s f0, a3, -2048");
COMPARE(ld_b(a1, a1, 2047),
"281ffca5 ld.b a1, a1, 2047(0x7ff)");
COMPARE(ld_b(a4, a4, -2048),
"28200108 ld.b a4, a4, -2048(0x800)");
COMPARE(ld_h(a4, a0, 2047),
"285ffc88 ld.h a4, a0, 2047(0x7ff)");
COMPARE(ld_h(a4, a3, -2048),
"286000e8 ld.h a4, a3, -2048(0x800)");
COMPARE(ld_w(a6, a6, 2047),
"289ffd4a ld.w a6, a6, 2047(0x7ff)");
COMPARE(ld_w(a5, a4, -2048),
"28a00109 ld.w a5, a4, -2048(0x800)");
COMPARE(ld_d(a0, a3, 2047),
"28dffce4 ld.d a0, a3, 2047(0x7ff)");
COMPARE(ld_d(a6, fp, -2048),
"28e002ca ld.d a6, fp, -2048(0x800)");
COMPARE(ld_d(a0, a6, 0), "28c00144 ld.d a0, a6, 0(0x0)");
COMPARE(st_b(a4, a0, 2047),
"291ffc88 st.b a4, a0, 2047(0x7ff)");
COMPARE(st_b(a6, a5, -2048),
"2920012a st.b a6, a5, -2048(0x800)");
COMPARE(st_h(a4, a0, 2047),
"295ffc88 st.h a4, a0, 2047(0x7ff)");
COMPARE(st_h(t1, t2, -2048),
"296001cd st.h t1, t2, -2048(0x800)");
COMPARE(st_w(t3, a4, 2047),
"299ffd0f st.w t3, a4, 2047(0x7ff)");
COMPARE(st_w(a3, t2, -2048),
"29a001c7 st.w a3, t2, -2048(0x800)");
COMPARE(st_d(s3, sp, 2047),
"29dffc7a st.d s3, sp, 2047(0x7ff)");
COMPARE(st_d(fp, s6, -2048),
"29e003b6 st.d fp, s6, -2048(0x800)");
COMPARE(ld_bu(a6, a0, 2047),
"2a1ffc8a ld.bu a6, a0, 2047(0x7ff)");
COMPARE(ld_bu(a7, a7, -2048),
"2a20016b ld.bu a7, a7, -2048(0x800)");
COMPARE(ld_hu(a7, a7, 2047),
"2a5ffd6b ld.hu a7, a7, 2047(0x7ff)");
COMPARE(ld_hu(a3, a3, -2048),
"2a6000e7 ld.hu a3, a3, -2048(0x800)");
COMPARE(ld_wu(a3, a0, 2047),
"2a9ffc87 ld.wu a3, a0, 2047(0x7ff)");
COMPARE(ld_wu(a3, a5, -2048),
"2aa00127 ld.wu a3, a5, -2048(0x800)");
COMPARE(fld_s(f0, a3, 2047),
"2b1ffce0 fld.s f0, a3, 2047(0x7ff)");
COMPARE(fld_s(f0, a1, -2048),
"2b2000a0 fld.s f0, a1, -2048(0x800)");
COMPARE(fld_d(f0, a0, 2047),
"2b9ffc80 fld.d f0, a0, 2047(0x7ff)");
COMPARE(fld_d(f0, fp, -2048),
"2ba002c0 fld.d f0, fp, -2048(0x800)");
COMPARE(fst_d(f0, fp, 2047),
"2bdffec0 fst.d f0, fp, 2047(0x7ff)");
COMPARE(fst_d(f0, a0, -2048),
"2be00080 fst.d f0, a0, -2048(0x800)");
COMPARE(fst_s(f0, a5, 2047),
"2b5ffd20 fst.s f0, a5, 2047(0x7ff)");
COMPARE(fst_s(f0, a3, -2048),
"2b6000e0 fst.s f0, a3, -2048(0x800)");
VERIFY_RUN();
}
......@@ -355,16 +410,20 @@ TEST(TypeOp10) {
TEST(TypeOp12) {
SET_UP();
COMPARE(fmadd_s(f0, f1, f2, f3), "08118820 fmadd.s f0, f1, f2, f3");
COMPARE(fmadd_s(f4, f5, f6, f7), "081398a4 fmadd.s f4, f5, f6, f7");
COMPARE(fmadd_s(f0, f1, f2, f3),
"08118820 fmadd.s f0, f1, f2, f3");
COMPARE(fmadd_s(f4, f5, f6, f7),
"081398a4 fmadd.s f4, f5, f6, f7");
COMPARE(fmadd_d(f8, f9, f10, f11),
"0825a928 fmadd.d f8, f9, f10, f11");
COMPARE(fmadd_d(f12, f13, f14, f15),
"0827b9ac fmadd.d f12, f13, f14, f15");
COMPARE(fmsub_s(f0, f1, f2, f3), "08518820 fmsub.s f0, f1, f2, f3");
COMPARE(fmsub_s(f4, f5, f6, f7), "085398a4 fmsub.s f4, f5, f6, f7");
COMPARE(fmsub_s(f0, f1, f2, f3),
"08518820 fmsub.s f0, f1, f2, f3");
COMPARE(fmsub_s(f4, f5, f6, f7),
"085398a4 fmsub.s f4, f5, f6, f7");
COMPARE(fmsub_d(f8, f9, f10, f11),
"0865a928 fmsub.d f8, f9, f10, f11");
......@@ -544,7 +603,8 @@ TEST(TypeOp17) {
SET_UP();
COMPARE(sltu(t5, t4, a4), "0012a211 sltu t5, t4, a4");
COMPARE(sltu(t4, zero_reg, t4), "0012c010 sltu t4, zero_reg, t4");
COMPARE(sltu(t4, zero_reg, t4),
"0012c010 sltu t4, zero_reg, t4");
COMPARE(add_w(a4, a4, a6), "00102908 add.w a4, a4, a6");
COMPARE(add_w(a5, a6, t3), "00103d49 add.w a5, a6, t3");
......@@ -567,8 +627,10 @@ TEST(TypeOp17) {
COMPARE(maskeqz(a6, a7, t0), "0013b16a maskeqz a6, a7, t0");
COMPARE(maskeqz(t1, t2, t3), "0013bdcd maskeqz t1, t2, t3");
COMPARE(or_(s3, sp, zero_reg), "0015007a or s3, sp, zero_reg");
COMPARE(or_(a4, a0, zero_reg), "00150088 or a4, a0, zero_reg");
COMPARE(or_(s3, sp, zero_reg),
"0015007a or s3, sp, zero_reg");
COMPARE(or_(a4, a0, zero_reg),
"00150088 or a4, a0, zero_reg");
COMPARE(and_(sp, sp, t6), "0014c863 and sp, sp, t6");
COMPARE(and_(a3, a3, a7), "0014ace7 and a3, a3, a7");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment