diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-08-28 22:41:57 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-08-28 22:41:57 +0000 |
commit | f9355c80d55110ebef66475717b4400f6bb0ad4e (patch) | |
tree | f28a56e4d69cf31c79a3e3e7f41ec62fbba338a4 /test/Transforms/Inline | |
parent | 2b884bcbce3ec76bd065d2dd9a6597f13e9fdd57 (diff) | |
download | external_llvm-f9355c80d55110ebef66475717b4400f6bb0ad4e.zip external_llvm-f9355c80d55110ebef66475717b4400f6bb0ad4e.tar.gz external_llvm-f9355c80d55110ebef66475717b4400f6bb0ad4e.tar.bz2 |
Handle address spaces in TargetTransformInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189527 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/Inline')
-rw-r--r-- | test/Transforms/Inline/ptr-diff.ll | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/test/Transforms/Inline/ptr-diff.ll b/test/Transforms/Inline/ptr-diff.ll index 01b42da..af42bc7 100644 --- a/test/Transforms/Inline/ptr-diff.ll +++ b/test/Transforms/Inline/ptr-diff.ll @@ -1,6 +1,6 @@ ; RUN: opt -inline < %s -S -o - -inline-threshold=10 | FileCheck %s -target datalayout = "p:32:32" +target datalayout = "p:32:32-p1:64:64-p2:16:16-n16:32:64" define i32 @outer1() { ; CHECK-LABEL: @outer1( @@ -56,3 +56,46 @@ else: %t = load i32* %begin ret i32 %t } + +; The inttoptrs are free since it is a smaller integer to a larger +; pointer size +define i32 @inttoptr_free_cost(i32 %a, i32 %b, i32 %c) { + %p1 = inttoptr i32 %a to i32 addrspace(1)* + %p2 = inttoptr i32 %b to i32 addrspace(1)* + %p3 = inttoptr i32 %c to i32 addrspace(1)* + %t1 = load i32 addrspace(1)* %p1 + %t2 = load i32 addrspace(1)* %p2 + %t3 = load i32 addrspace(1)* %p3 + %s = add i32 %t1, %t2 + %s1 = add i32 %s, %t3 + ret i32 %s1 +} + +define i32 @inttoptr_free_cost_user(i32 %begin, i32 %end) { +; CHECK-LABEL: @inttoptr_free_cost_user( +; CHECK-NOT: call + %x = call i32 @inttoptr_free_cost(i32 %begin, i32 %end, i32 9) + ret i32 %x +} + +; The inttoptrs have a cost since it is a larger integer to a smaller +; pointer size +define i32 @inttoptr_cost_smaller_ptr(i32 %a, i32 %b, i32 %c) { + %p1 = inttoptr i32 %a to i32 addrspace(2)* + %p2 = inttoptr i32 %b to i32 addrspace(2)* + %p3 = inttoptr i32 %c to i32 addrspace(2)* + %t1 = load i32 addrspace(2)* %p1 + %t2 = load i32 addrspace(2)* %p2 + %t3 = load i32 addrspace(2)* %p3 + %s = add i32 %t1, %t2 + %s1 = add i32 %s, %t3 + ret i32 %s1 +} + +define i32 @inttoptr_cost_smaller_ptr_user(i32 %begin, i32 %end) { +; CHECK-LABEL: @inttoptr_cost_smaller_ptr_user( +; CHECK: call + %x = call i32 @inttoptr_cost_smaller_ptr(i32 %begin, i32 %end, i32 9) + ret i32 %x +} + |