diff options
author | Che-Liang Chiou <clchiou@gmail.com> | 2010-12-22 10:38:51 +0000 |
---|---|---|
committer | Che-Liang Chiou <clchiou@gmail.com> | 2010-12-22 10:38:51 +0000 |
commit | fc7072c3c4db03555a0a62220d61a2b85acd01fd (patch) | |
tree | a4d7687080097e1a140b95abd2599637d781e99e /test/CodeGen/PTX/ld.ll | |
parent | a3c44a5280042dbc0cde995675c225ede4528c6e (diff) |
ptx: add ld instruction and test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122398 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/PTX/ld.ll')
-rw-r--r-- | test/CodeGen/PTX/ld.ll | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/CodeGen/PTX/ld.ll b/test/CodeGen/PTX/ld.ll new file mode 100644 index 0000000000..5ae82a0385 --- /dev/null +++ b/test/CodeGen/PTX/ld.ll @@ -0,0 +1,44 @@ +; RUN: llc < %s -march=ptx | FileCheck %s + +;CHECK: .extern .global .s32 array[]; +@array = external global [10 x i32] + +define ptx_device i32 @t1(i32* %p) { +entry: +;CHECK: ld.global.s32 r0, [r1]; + %x = load i32* %p + ret i32 %x +} + +define ptx_device i32 @t2(i32* %p) { +entry: +;CHECK: ld.global.s32 r0, [r1+4]; + %i = getelementptr i32* %p, i32 1 + %x = load i32* %i + ret i32 %x +} + +define ptx_device i32 @t3(i32* %p, i32 %q) { +entry: +;CHECK: shl.b32 r0, r2, 2; +;CHECK: ld.global.s32 r0, [r1+r0]; + %i = getelementptr i32* %p, i32 %q + %x = load i32* %i + ret i32 %x +} + +define ptx_device i32 @t4() { +entry: +;CHECK: ld.global.s32 r0, [array]; + %i = getelementptr [10 x i32]* @array, i32 0, i32 0 + %x = load i32* %i + ret i32 %x +} + +define ptx_device i32 @t5() { +entry: +;CHECK: ld.global.s32 r0, [array+4]; + %i = getelementptr [10 x i32]* @array, i32 0, i32 1 + %x = load i32* %i + ret i32 %x +} |