diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2014-12-17 21:04:08 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2014-12-17 21:04:08 +0000 |
| commit | 303011a0059039a9635db856e0b4bb5d4df12347 (patch) | |
| tree | 755c1810fc463a84bae7f6de16c6f912eb7922dd /llvm/lib/Target/R600/SIInstrInfo.cpp | |
| parent | d663fdd2165d39862f7d466412b0321a776070f2 (diff) | |
| download | bcm5719-llvm-303011a0059039a9635db856e0b4bb5d4df12347.tar.gz bcm5719-llvm-303011a0059039a9635db856e0b4bb5d4df12347.zip | |
R600/SI: Fix f64 inline immediates
llvm-svn: 224458
Diffstat (limited to 'llvm/lib/Target/R600/SIInstrInfo.cpp')
| -rw-r--r-- | llvm/lib/Target/R600/SIInstrInfo.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/llvm/lib/Target/R600/SIInstrInfo.cpp b/llvm/lib/Target/R600/SIInstrInfo.cpp index 9328c2c2c23..08bfc5e1422 100644 --- a/llvm/lib/Target/R600/SIInstrInfo.cpp +++ b/llvm/lib/Target/R600/SIInstrInfo.cpp @@ -896,10 +896,23 @@ bool SIInstrInfo::areMemAccessesTriviallyDisjoint(MachineInstr *MIa, } bool SIInstrInfo::isInlineConstant(const APInt &Imm) const { - int32_t Val = Imm.getSExtValue(); - if (Val >= -16 && Val <= 64) + int64_t SVal = Imm.getSExtValue(); + if (SVal >= -16 && SVal <= 64) return true; + if (Imm.getBitWidth() == 64) { + uint64_t Val = Imm.getZExtValue(); + return (DoubleToBits(0.0) == Val) || + (DoubleToBits(1.0) == Val) || + (DoubleToBits(-1.0) == Val) || + (DoubleToBits(0.5) == Val) || + (DoubleToBits(-0.5) == Val) || + (DoubleToBits(2.0) == Val) || + (DoubleToBits(-2.0) == Val) || + (DoubleToBits(4.0) == Val) || + (DoubleToBits(-4.0) == Val); + } + // The actual type of the operand does not seem to matter as long // as the bits match one of the inline immediate values. For example: // @@ -908,16 +921,17 @@ bool SIInstrInfo::isInlineConstant(const APInt &Imm) const { // // 1065353216 has the hexadecimal encoding 0x3f800000 which is 1.0f in // floating-point, so it is a legal inline immediate. - - return (APInt::floatToBits(0.0f) == Imm) || - (APInt::floatToBits(1.0f) == Imm) || - (APInt::floatToBits(-1.0f) == Imm) || - (APInt::floatToBits(0.5f) == Imm) || - (APInt::floatToBits(-0.5f) == Imm) || - (APInt::floatToBits(2.0f) == Imm) || - (APInt::floatToBits(-2.0f) == Imm) || - (APInt::floatToBits(4.0f) == Imm) || - (APInt::floatToBits(-4.0f) == Imm); + uint32_t Val = Imm.getZExtValue(); + + return (FloatToBits(0.0f) == Val) || + (FloatToBits(1.0f) == Val) || + (FloatToBits(-1.0f) == Val) || + (FloatToBits(0.5f) == Val) || + (FloatToBits(-0.5f) == Val) || + (FloatToBits(2.0f) == Val) || + (FloatToBits(-2.0f) == Val) || + (FloatToBits(4.0f) == Val) || + (FloatToBits(-4.0f) == Val); } bool SIInstrInfo::isInlineConstant(const MachineOperand &MO) const { |

