Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Side by Side Diff: lib/Analysis/ConstantFolding.cpp

Issue 7792066: [llvm] Conditionally include target intrinsics, based on --enable-target Base URL: https://llvm.org/svn/llvm-project/llvm/trunk/
Patch Set: cleanups Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/Analysis/BasicAliasAnalysis.cpp ('k') | lib/Analysis/ValueTracking.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===-- ConstantFolding.cpp - Fold instructions into constants ------------===// 1 //===-- ConstantFolding.cpp - Fold instructions into constants ------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file defines routines for folding instructions into constants. 10 // This file defines routines for folding instructions into constants.
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 case Intrinsic::ctlz: 1051 case Intrinsic::ctlz:
1052 case Intrinsic::cttz: 1052 case Intrinsic::cttz:
1053 case Intrinsic::sadd_with_overflow: 1053 case Intrinsic::sadd_with_overflow:
1054 case Intrinsic::uadd_with_overflow: 1054 case Intrinsic::uadd_with_overflow:
1055 case Intrinsic::ssub_with_overflow: 1055 case Intrinsic::ssub_with_overflow:
1056 case Intrinsic::usub_with_overflow: 1056 case Intrinsic::usub_with_overflow:
1057 case Intrinsic::smul_with_overflow: 1057 case Intrinsic::smul_with_overflow:
1058 case Intrinsic::umul_with_overflow: 1058 case Intrinsic::umul_with_overflow:
1059 case Intrinsic::convert_from_fp16: 1059 case Intrinsic::convert_from_fp16:
1060 case Intrinsic::convert_to_fp16: 1060 case Intrinsic::convert_to_fp16:
1061 #if defined(TARGET_ENABLED_X86)
1061 case Intrinsic::x86_sse_cvtss2si: 1062 case Intrinsic::x86_sse_cvtss2si:
1062 case Intrinsic::x86_sse_cvtss2si64: 1063 case Intrinsic::x86_sse_cvtss2si64:
1063 case Intrinsic::x86_sse_cvttss2si: 1064 case Intrinsic::x86_sse_cvttss2si:
1064 case Intrinsic::x86_sse_cvttss2si64: 1065 case Intrinsic::x86_sse_cvttss2si64:
1065 case Intrinsic::x86_sse2_cvtsd2si: 1066 case Intrinsic::x86_sse2_cvtsd2si:
1066 case Intrinsic::x86_sse2_cvtsd2si64: 1067 case Intrinsic::x86_sse2_cvtsd2si64:
1067 case Intrinsic::x86_sse2_cvttsd2si: 1068 case Intrinsic::x86_sse2_cvttsd2si:
1068 case Intrinsic::x86_sse2_cvttsd2si64: 1069 case Intrinsic::x86_sse2_cvttsd2si64:
1070 #endif // TARGET_ENABLED_X86
1069 return true; 1071 return true;
1070 default: 1072 default:
1071 return false; 1073 return false;
1072 case 0: break; 1074 case 0: break;
1073 } 1075 }
1074 1076
1075 if (!F->hasName()) return false; 1077 if (!F->hasName()) return false;
1076 StringRef Name = F->getName(); 1078 StringRef Name = F->getName();
1077 1079
1078 // In these cases, the check of the length is required. We don't want to 1080 // In these cases, the check of the length is required. We don't want to
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 return ConstantFP::get(F->getContext(), Val); 1298 return ConstantFP::get(F->getContext(), Val);
1297 } 1299 }
1298 default: 1300 default:
1299 return 0; 1301 return 0;
1300 } 1302 }
1301 } 1303 }
1302 1304
1303 if (ConstantVector *Op = dyn_cast<ConstantVector>(Operands[0])) { 1305 if (ConstantVector *Op = dyn_cast<ConstantVector>(Operands[0])) {
1304 switch (F->getIntrinsicID()) { 1306 switch (F->getIntrinsicID()) {
1305 default: break; 1307 default: break;
1308 #if defined(TARGET_ENABLED_X86)
1306 case Intrinsic::x86_sse_cvtss2si: 1309 case Intrinsic::x86_sse_cvtss2si:
1307 case Intrinsic::x86_sse_cvtss2si64: 1310 case Intrinsic::x86_sse_cvtss2si64:
1308 case Intrinsic::x86_sse2_cvtsd2si: 1311 case Intrinsic::x86_sse2_cvtsd2si:
1309 case Intrinsic::x86_sse2_cvtsd2si64: 1312 case Intrinsic::x86_sse2_cvtsd2si64:
1310 if (ConstantFP *FPOp = dyn_cast<ConstantFP>(Op->getOperand(0))) 1313 if (ConstantFP *FPOp = dyn_cast<ConstantFP>(Op->getOperand(0)))
1311 return ConstantFoldConvertToInt(FPOp, /*roundTowardZero=*/false, Ty); 1314 return ConstantFoldConvertToInt(FPOp, /*roundTowardZero=*/false, Ty);
1312 case Intrinsic::x86_sse_cvttss2si: 1315 case Intrinsic::x86_sse_cvttss2si:
1313 case Intrinsic::x86_sse_cvttss2si64: 1316 case Intrinsic::x86_sse_cvttss2si64:
1314 case Intrinsic::x86_sse2_cvttsd2si: 1317 case Intrinsic::x86_sse2_cvttsd2si:
1315 case Intrinsic::x86_sse2_cvttsd2si64: 1318 case Intrinsic::x86_sse2_cvttsd2si64:
1316 if (ConstantFP *FPOp = dyn_cast<ConstantFP>(Op->getOperand(0))) 1319 if (ConstantFP *FPOp = dyn_cast<ConstantFP>(Op->getOperand(0)))
1317 return ConstantFoldConvertToInt(FPOp, /*roundTowardZero=*/true, Ty); 1320 return ConstantFoldConvertToInt(FPOp, /*roundTowardZero=*/true, Ty);
1321 #endif // TARGET_ENABLED_X86
1318 } 1322 }
1319 } 1323 }
1320 1324
1321 if (isa<UndefValue>(Operands[0])) { 1325 if (isa<UndefValue>(Operands[0])) {
1322 if (F->getIntrinsicID() == Intrinsic::bswap) 1326 if (F->getIntrinsicID() == Intrinsic::bswap)
1323 return Operands[0]; 1327 return Operands[0];
1324 return 0; 1328 return 0;
1325 } 1329 }
1326 1330
1327 return 0; 1331 return 0;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 } 1407 }
1404 } 1408 }
1405 } 1409 }
1406 1410
1407 return 0; 1411 return 0;
1408 } 1412 }
1409 return 0; 1413 return 0;
1410 } 1414 }
1411 return 0; 1415 return 0;
1412 } 1416 }
OLDNEW
« no previous file with comments | « lib/Analysis/BasicAliasAnalysis.cpp ('k') | lib/Analysis/ValueTracking.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698