llvm.org GIT mirror llvm / 9685372
Add the isunordered intrinsic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14159 91177308-0d34-0410-b5e6-96231b3b80d8 Alkis Evlogimenos 16 years ago
7 changed file(s) with 31 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
6060
6161 // libm related functions.
6262 isnan, // Return true if fp argument is a NAN.
63 isunordered, // Return true if fp arguments are unordered
6364
6465 // Input/Output intrinsics.
6566 readport,
207207 Type::BoolTy, isnanFCache);
208208 break;
209209 }
210 case Intrinsic::isunordered: {
211 static Function *isunorderedFCache = 0;
212 ReplaceCallWith("isunordered", CI, CI->op_begin()+1, CI->op_end(),
213 Type::BoolTy, isunorderedFCache);
214 break;
215 }
210216 }
211217
212218 assert(CI->use_empty() &&
223223 break;
224224 case 'i':
225225 if (getName() == "llvm.isnan") return Intrinsic::isnan;
226 if (getName() == "llvm.isunordered") return Intrinsic::isunordered;
226227 break;
227228 case 'l':
228229 if (getName() == "llvm.longjmp") return Intrinsic::longjmp;
207207 Type::BoolTy, isnanFCache);
208208 break;
209209 }
210 case Intrinsic::isunordered: {
211 static Function *isunorderedFCache = 0;
212 ReplaceCallWith("isunordered", CI, CI->op_begin()+1, CI->op_end(),
213 Type::BoolTy, isunorderedFCache);
214 break;
215 }
210216 }
211217
212218 assert(CI->use_empty() &&
687687 break;
688688 }
689689
690 case Intrinsic::isnan:
690 case Intrinsic::isnan:
691691 Assert1(FT->getNumParams() == 1 && FT->getParamType(0)->isFloatingPoint(),
692692 "Illegal prototype for llvm.isnan", IF);
693693 Assert1(FT->getReturnType() == Type::BoolTy,
694694 "Illegal prototype for llvm.isnan", IF);
695695 NumArgs = 1;
696 break;
697
698 case Intrinsic::isunordered:
699 Assert1(FT->getNumParams() == 2 &&
700 FT->getParamType(0)->isFloatingPoint() &&
701 FT->getParamType(1)->isFloatingPoint(),
702 "Illegal prototype for llvm.isunordered", IF);
703 Assert1(FT->getReturnType() == Type::BoolTy,
704 "Illegal prototype for llvm.isunordered", IF);
705 NumArgs = 2;
696706 break;
697707
698708 case Intrinsic::setjmp: NumArgs = 1; break;
0
11 declare bool %llvm.isnan(float)
22 declare bool %llvm.isnan(double)
3
4 declare bool %llvm.isunordered(float, float)
5 declare bool %llvm.isunordered(double, double)
36
47 implementation
58
811 void %libm() {
912 call bool %llvm.isnan(float 0.0)
1013 call bool %llvm.isnan(double 10.0)
14 call bool %llvm.isunordered(float 0.0, float 1.0)
15 call bool %llvm.isunordered(double 0.0, double 1.0)
1116 ret void
1217 }