diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-11-02 01:53:59 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-11-02 01:53:59 +0000 |
commit | 0a783f783ca05c961234385f5b269d4cf03dbbdb (patch) | |
tree | 70d2d2b4be7b0f5624d954fd3c482eca33c7f43e /lib/Bytecode | |
parent | 0ac6757586b80d0c82a6651780dcd9b09df251b0 (diff) |
For PR950:
Replace the REM instruction with UREM, SREM and FREM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31369 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index d3df471a1c..b1ec74e2d6 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -652,7 +652,14 @@ BytecodeReader::handleObsoleteOpcodes( break; case 11: // Rem - Opcode = Instruction::Rem; + // As with "Div", make the signed/unsigned or floating point Rem + // instruction choice based on the type of the operands. + if (iType == 10 || iType == 11) + Opcode = Instruction::FRem; + else if (iType >= 2 && iType <= 9 && iType % 2 != 0) + Opcode = Instruction::SRem; + else + Opcode = Instruction::URem; break; case 12: // And Opcode = Instruction::And; @@ -1654,18 +1661,16 @@ inline unsigned fixCEOpcodes( else Opcode = Instruction::UDiv; break; - case 11: // Rem - // As with "Div", make the signed/unsigned Rem instruction choice based - // on the type of the instruction. + // As with "Div", make the signed/unsigned or floating point Rem + // instruction choice based on the type of the operands. if (ArgVec[0]->getType()->isFloatingPoint()) - Opcode = Instruction::Rem; + Opcode = Instruction::FRem; else if (ArgVec[0]->getType()->isSigned()) - Opcode = Instruction::Rem; + Opcode = Instruction::SRem; else - Opcode = Instruction::Rem; + Opcode = Instruction::URem; break; - case 12: // And Opcode = Instruction::And; break; |