Lower llvm.isunordered(a, b) into a != a | b != b.
[oota-llvm.git] / lib / CodeGen / AsmPrinter.cpp
index 80f67023f4311e72bc2a989ecd3db9e3c2a53264..4e77a78d81b1e7a628a1edd790c4d8838645281a 100644 (file)
@@ -78,10 +78,14 @@ void AsmPrinter::emitConstantValueOnly(const Constant *CV) {
       // generate a symbolic expression for the byte address
       const Constant *ptrVal = CE->getOperand(0);
       std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
-      if (uint64_t Offset = TD.getIndexedOffset(ptrVal->getType(), idxVec)) {
-        O << "(";
+      if (int64_t Offset = TD.getIndexedOffset(ptrVal->getType(), idxVec)) {
+        if (Offset)
+          O << "(";
         emitConstantValueOnly(ptrVal);
-        O << ") + " << Offset;
+        if (Offset > 0)
+          O << ") + " << Offset;
+        else if (Offset < 0)
+          O << ") - " << -Offset;
       } else {
         emitConstantValueOnly(ptrVal);
       }