[mips] Fix definition of mfhi and mflo instructions to read from the whole
authorAkira Hatanaka <ahatanaka@mips.com>
Mon, 7 Oct 2013 18:49:46 +0000 (18:49 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Mon, 7 Oct 2013 18:49:46 +0000 (18:49 +0000)
commit243702b95a471ffb7d2374dfad3d7f8b11bee7e7
treeab2d61d1494d5822ce311f09c9f00add40957013
parent379f76e873b91550e3d9cee79dff814e3ce1e86e
[mips] Fix definition of mfhi and mflo instructions to read from the whole
accumulator instead of its sub-registers, $hi and $lo.

We need this change to prevent a mflo following a mtlo from reading an
unpredictable/undefined value, as shown in the following example:

mult $6, $7 // result of $6 * $7 is written to $lo and $hi.
mflo $2     // read lower 32-bit result from $lo.
mtlo $4     // write to $lo. the content of $hi becomes unpredictable.
mfhi $3     // read higher 32-bit from $hi, which has an unpredictable value.

I don't have a test case for this change that reliably reproduces the problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192119 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/Mips/MicroMipsInstrInfo.td
lib/Target/Mips/Mips64InstrInfo.td
lib/Target/Mips/MipsDSPInstrInfo.td
lib/Target/Mips/MipsISelLowering.cpp
lib/Target/Mips/MipsISelLowering.h
lib/Target/Mips/MipsInstrInfo.td
lib/Target/Mips/MipsSEFrameLowering.cpp
lib/Target/Mips/MipsSEISelLowering.cpp
lib/Target/Mips/MipsSEInstrInfo.cpp
lib/Target/Mips/MipsSEInstrInfo.h