aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-07 08:07:10 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-07 08:07:10 +0000
commite3671f90f2d199c128b10246f8dc9be273c19f00 (patch)
treeb1bdf81a3901db914c59cf2437e1dd528c67fbf3
parenta121fddf3c34938d866ac4bb67247a479dedcd1b (diff)
Upgrade the llvm.isunordered intrinsics to "fcmp uno" instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32986 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/llvm-upgrade/UpgradeParser.y38
1 files changed, 24 insertions, 14 deletions
diff --git a/tools/llvm-upgrade/UpgradeParser.y b/tools/llvm-upgrade/UpgradeParser.y
index 0544d400e6..f6338e7292 100644
--- a/tools/llvm-upgrade/UpgradeParser.y
+++ b/tools/llvm-upgrade/UpgradeParser.y
@@ -1872,21 +1872,31 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
delete $2.val;
}
| OptTailCall OptCallingConv TypesV ValueRef '(' ValueRefListE ')' {
- if (!$2->empty())
- *$1 += " " + *$2;
- if (!$1->empty())
- *$1 += " ";
- *$1 += $3->getNewTy() + " " + *$4.val + "(";
- for (unsigned i = 0; i < $6->size(); ++i) {
- ValueInfo& VI = (*$6)[i];
- *$1 += *VI.val;
- if (i+1 < $6->size())
- *$1 += ", ";
- VI.destroy();
+ // map llvm.isunordered to "fcmp uno"
+ if (*$4.val == "%llvm.isunordered.f32" ||
+ *$4.val == "%llvm.isunordered.f64") {
+ $$.val = new std::string( "fcmp uno " + *(*$6)[0].val + ", ");
+ size_t pos = (*$6)[1].val->find(' ');
+ assert(pos != std::string::npos && "no space?");
+ *$$.val += (*$6)[1].val->substr(pos+1);
+ $$.type = TypeInfo::get("bool", BoolTy);
+ } else {
+ if (!$2->empty())
+ *$1 += " " + *$2;
+ if (!$1->empty())
+ *$1 += " ";
+ *$1 += $3->getNewTy() + " " + *$4.val + "(";
+ for (unsigned i = 0; i < $6->size(); ++i) {
+ ValueInfo& VI = (*$6)[i];
+ *$1 += *VI.val;
+ if (i+1 < $6->size())
+ *$1 += ", ";
+ VI.destroy();
+ }
+ *$1 += ")";
+ $$.val = $1;
+ $$.type = getFunctionReturnType($3);
}
- *$1 += ")";
- $$.val = $1;
- $$.type = getFunctionReturnType($3);
delete $2; $4.destroy(); delete $6;
}
| MemoryInst ;