From 33947b4391458ed3ba2d7e7c741968325cbffa1d Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Thu, 7 Mar 2013 20:42:17 +0000 Subject: [PATCH] [fast-isel] Add support for the expect intrinsic. rdar://13370942 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176649 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/FastISel.cpp | 5 +++++ test/CodeGen/ARM/fast-isel-intrinsic.ll | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index a11f434ae00..35f7fcbd390 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -698,6 +698,11 @@ bool FastISel::SelectCall(const User *I) { UpdateValueMap(Call, ResultReg); return true; } + case Intrinsic::expect: { +// unsigned ResultReg = getRegForValue(Call->getArgOperand(0)); +// UpdateValueMap(Call, ResultReg); +// return true; + } } // Usually, it does not make sense to initialize a value, diff --git a/test/CodeGen/ARM/fast-isel-intrinsic.ll b/test/CodeGen/ARM/fast-isel-intrinsic.ll index 41089785cef..48105dd3893 100644 --- a/test/CodeGen/ARM/fast-isel-intrinsic.ll +++ b/test/CodeGen/ARM/fast-isel-intrinsic.ll @@ -238,3 +238,15 @@ define void @t7() nounwind ssp { call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([60 x i8]* @temp, i32 0, i32 4), i8* getelementptr inbounds ([60 x i8]* @temp, i32 0, i32 16), i32 3, i32 2, i1 false) ret void } + +define i32 @t8(i32 %x) nounwind { +entry: +; ARM: t8 +; ARM-NOT: FastISel missed call: %expval = call i32 @llvm.expect.i32(i32 %x, i32 1) +; THUMB: t8 +; THUMB-NOT: FastISel missed call: %expval = call i32 @llvm.expect.i32(i32 %x, i32 1) + %expval = call i32 @llvm.expect.i32(i32 %x, i32 1) + ret i32 %expval +} + +declare i32 @llvm.expect.i32(i32, i32) nounwind readnone