| ... | ... | @@ -380,6 +380,7 @@ const Tag = enum { |
| 380 | 380 | @"test", |
| 381 | 381 | brk, |
| 382 | 382 | nop, |
| 383 | imul, |
| 383 | 384 | syscall, |
| 384 | 385 | ret_near, |
| 385 | 386 | ret_far, |
| ... | ... | @@ -635,6 +636,7 @@ inline fn getOpCode(tag: Tag, enc: Encoding, is_one_byte: bool) ?OpCode { |
| 635 | 636 | .cmp => OpCode.oneByte(if (is_one_byte) 0x3a else 0x3b), |
| 636 | 637 | .mov => OpCode.oneByte(if (is_one_byte) 0x8a else 0x8b), |
| 637 | 638 | .lea => OpCode.oneByte(if (is_one_byte) 0x8c else 0x8d), |
| 639 | .imul => OpCode.twoByte(0x0f, 0xaf), |
| 638 | 640 | else => null, |
| 639 | 641 | }, |
| 640 | 642 | .oi => return switch (tag) { |
| ... | ... | @@ -1378,16 +1380,7 @@ fn mirIMulComplex(emit: *Emit, inst: Mir.Inst.Index) InnerError!void { |
| 1378 | 1380 | assert(tag == .imul_complex); |
| 1379 | 1381 | const ops = Mir.Ops.decode(emit.mir.instructions.items(.ops)[inst]); |
| 1380 | 1382 | switch (ops.flags) { |
| 1381 | | 0b00 => { |
| 1382 | | const encoder = try Encoder.init(emit.code, 4); |
| 1383 | | encoder.rex(.{ |
| 1384 | | .w = ops.reg1.size() == 64, |
| 1385 | | .r = ops.reg1.isExtended(), |
| 1386 | | .b = ops.reg2.isExtended(), |
| 1387 | | }); |
| 1388 | | encoder.opcode_2byte(0x0f, 0xaf); |
| 1389 | | encoder.modRm_direct(ops.reg1.lowId(), ops.reg2.lowId()); |
| 1390 | | }, |
| 1383 | 0b00 => return lowerToRmEnc(.imul, ops.reg1, RegisterOrMemory.reg(ops.reg2), emit.code), |
| 1391 | 1384 | 0b10 => { |
| 1392 | 1385 | const imm = emit.mir.instructions.items(.data)[inst].imm; |
| 1393 | 1386 | const opc: u8 = if (imm <= math.maxInt(i8)) 0x6b else 0x69; |