[Libre-soc-bugs] [Bug 432] mulld pseudocode overflow calculation incorrect

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Wed Jul 15 15:54:33 BST 2020


--- Comment #4 from Jacob Lifshay <programmerjake at gmail.com> ---
sec of powerisa v3.1:
If OE=1 then OV and OV32 are set to 1 if the product can-
not be represented in 64 bits.

so, it doesn't explicitly say u64 or i64

however, I did include test cases in power-instruction-analyzer which wouldn't
overflow according to the buggy pseudocode but are still marked as overflowing
in the mulld instruction model:
-1i64 * -0x8000_0000_0000_0000i64
2i64 * -0x8000_0000_0000_0000i64

instruction model code:

pub fn mulldo(inputs: InstructionInput) -> InstructionResult {
    let ra = inputs.ra as i64;
    let rb = inputs.rb as i64;
    let result = ra.wrapping_mul(rb) as u64;
    let overflow = ra.checked_mul(rb).is_none();
    InstructionResult {
        rt: Some(result),
        overflow: Some(OverflowFlags::from_overflow(overflow)),

You are receiving this mail because:
You are on the CC list for the bug.

More information about the libre-soc-bugs mailing list