[llvm-bugs] [Bug 51114] New: Error in MIPSISelLowering performMADD_MSUBCombine for sub (mul r1, r2), r3 case

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 16 08:03:08 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51114

            Bug ID: 51114
           Summary: Error in MIPSISelLowering performMADD_MSUBCombine for
                    sub (mul r1, r2), r3 case
           Product: new-bugs
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: digitalseraphim at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 25030
  --> https://bugs.llvm.org/attachment.cgi?id=25030&action=edit
test code

When combining a sub instruction with a mul instruction, and the mul is the
"left" argument, the resulting code is incorrect. Because of how the msub
instruction works, combining always puts the mul on the right. This means the
result in this case is the negative of what the value should be. `[ r1 -
(r2*r3) = -((r2*r3) - r1) ]`. I have attached sample c code that shows this
error. I left out error handling to simplify it, but passing "7 7 7" (no
quotes, obv.) should result in "c = 42, d = -42", but on mips it results in "c
= -42, d = -42".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210716/0133d26f/attachment.html>


More information about the llvm-bugs mailing list