Skip to content

Commit fbf5eb5

Browse files
authored
Merge pull request #41 from OFFTKP/bseti
Fix BSETI instruction
2 parents 1ed625d + 9b89db3 commit fbf5eb5

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/assembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ void Assembler::BSETI(GPR rd, GPR rs, uint32_t bit) noexcept {
13681368
}
13691369

13701370
const auto imm = (0b001010U << 6) | bit;
1371-
EmitIType(m_buffer, imm, rs, 0b001, rd, 0b0110011);
1371+
EmitIType(m_buffer, imm, rs, 0b001, rd, 0b0010011);
13721372
}
13731373

13741374
void Assembler::CLMUL(GPR rd, GPR rs1, GPR rs2) noexcept {

tests/src/assembler_rvb_tests.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,40 +202,40 @@ TEST_CASE("BSETI", "[rvb]") {
202202
auto as = MakeAssembler32(value);
203203

204204
as.BSETI(x31, x7, 0);
205-
REQUIRE(value == 0x28039FB3);
205+
REQUIRE(value == 0x28039F93);
206206

207207
as.RewindBuffer();
208208

209209
as.BSETI(x31, x7, 15);
210-
REQUIRE(value == 0x28F39FB3);
210+
REQUIRE(value == 0x28F39F93);
211211

212212
as.RewindBuffer();
213213

214214
as.BSETI(x31, x7, 31);
215-
REQUIRE(value == 0x29F39FB3);
215+
REQUIRE(value == 0x29F39F93);
216216
}
217217

218218
TEST_CASE("BSETI (RV64)", "[rvb]") {
219219
uint32_t value = 0;
220220
auto as = MakeAssembler64(value);
221221

222222
as.BSETI(x31, x7, 0);
223-
REQUIRE(value == 0x28039FB3);
223+
REQUIRE(value == 0x28039F93);
224224

225225
as.RewindBuffer();
226226

227227
as.BSETI(x31, x7, 15);
228-
REQUIRE(value == 0x28F39FB3);
228+
REQUIRE(value == 0x28F39F93);
229229

230230
as.RewindBuffer();
231231

232232
as.BSETI(x31, x7, 31);
233-
REQUIRE(value == 0x29F39FB3);
233+
REQUIRE(value == 0x29F39F93);
234234

235235
as.RewindBuffer();
236236

237237
as.BSETI(x31, x7, 63);
238-
REQUIRE(value == 0x2BF39FB3);
238+
REQUIRE(value == 0x2BF39F93);
239239
}
240240

241241
TEST_CASE("CLMUL", "[rvb]") {

0 commit comments

Comments
 (0)