diff options
Diffstat (limited to 'test/CodeGen/AMDGPU')
| -rw-r--r-- | test/CodeGen/AMDGPU/llvm.dbg.value.ll | 37 | ||||
| -rw-r--r-- | test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll | 22 | ||||
| -rw-r--r-- | test/CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll | 52 | ||||
| -rw-r--r-- | test/CodeGen/AMDGPU/trunc-store.ll | 48 |
4 files changed, 159 insertions, 0 deletions
diff --git a/test/CodeGen/AMDGPU/llvm.dbg.value.ll b/test/CodeGen/AMDGPU/llvm.dbg.value.ll new file mode 100644 index 0000000000000..d001bcb4db176 --- /dev/null +++ b/test/CodeGen/AMDGPU/llvm.dbg.value.ll @@ -0,0 +1,37 @@ +; RUN: llc -O0 -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -verify-machineinstrs < %s | FileCheck %s + +; CHECK-LABEL: {{^}}test_debug_value: +; CHECK: s_load_dwordx2 +; CHECK: DEBUG_VALUE: test_debug_value:globalptr_arg <- SGPR0_SGPR1 +; CHECK: buffer_store_dword +; CHECK: s_endpgm +define void @test_debug_value(i32 addrspace(1)* nocapture %globalptr_arg) #0 { +entry: + tail call void @llvm.dbg.value(metadata i32 addrspace(1)* %globalptr_arg, i64 0, metadata !10, metadata !13), !dbg !14 + store i32 123, i32 addrspace(1)* %globalptr_arg, align 4 + ret void +} + +declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 + +attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind readnone } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!11, !12} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 244715) (llvm/trunk 244718)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3) +!1 = !DIFile(filename: "/tmp/test_debug_value.cl", directory: "/Users/matt/src/llvm/build_debug") +!2 = !{} +!3 = !{!4} +!4 = !DISubprogram(name: "test_debug_value", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, function: void (i32 addrspace(1)*)* @test_debug_value, variables: !9) +!5 = !DISubroutineType(types: !6) +!6 = !{null, !7} +!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64, align: 32) +!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!9 = !{!10} +!10 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "globalptr_arg", arg: 1, scope: !4, file: !1, line: 1, type: !7) +!11 = !{i32 2, !"Dwarf Version", i32 4} +!12 = !{i32 2, !"Debug Info Version", i32 3} +!13 = !DIExpression() +!14 = !DILocation(line: 1, column: 42, scope: !4) diff --git a/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll b/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll new file mode 100644 index 0000000000000..10739df083790 --- /dev/null +++ b/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll @@ -0,0 +1,22 @@ +; RUN: not llc -march=amdgcn < %s 2>&1 | FileCheck %s + +; Make sure that AMDGPUPromoteAlloca doesn't crash if the called +; function is a constantexpr cast of a function. + +declare void @foo(float*) #0 +declare void @foo.varargs(...) #0 + +; CHECK: error: unsupported call to function foo in crash_call_constexpr_cast +define void @crash_call_constexpr_cast() #0 { + %alloca = alloca i32 + call void bitcast (void (float*)* @foo to void (i32*)*)(i32* %alloca) #0 + ret void +} + +define void @crash_call_constexpr_cast_varargs() #0 { + %alloca = alloca i32 + call void bitcast (void (...)* @foo.varargs to void (i32*)*)(i32* %alloca) #0 + ret void +} + +attributes #0 = { nounwind } diff --git a/test/CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll b/test/CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll new file mode 100644 index 0000000000000..2ee98cc3d2d25 --- /dev/null +++ b/test/CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll @@ -0,0 +1,52 @@ +; RUN: llc -march=amdgcn < %s | FileCheck -check-prefix=GCN %s + +; Pointer value is stored in a candidate for LDS usage. + +; GCN-LABEL: {{^}}stored_lds_pointer_value: +; GCN: buffer_store_dword v +define void @stored_lds_pointer_value(float* addrspace(1)* %ptr) #0 { + %tmp = alloca float + store float 0.0, float *%tmp + store float* %tmp, float* addrspace(1)* %ptr + ret void +} + +; GCN-LABEL: {{^}}stored_lds_pointer_value_gep: +; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0 +; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1 +; GCN: buffer_store_dword v +; GCN: buffer_store_dword v +define void @stored_lds_pointer_value_gep(float* addrspace(1)* %ptr, i32 %idx) #0 { +bb: + %tmp = alloca float, i32 16 + store float 0.0, float* %tmp + %tmp2 = getelementptr inbounds float, float* %tmp, i32 %idx + store float* %tmp2, float* addrspace(1)* %ptr + ret void +} + +; Pointer value is stored in a candidate for vector usage +; GCN-LABEL: {{^}}stored_vector_pointer_value: +; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0 +; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1 +; GCN: buffer_store_dword +; GCN: buffer_store_dword +; GCN: buffer_store_dword +; GCN: buffer_store_dword +define void @stored_vector_pointer_value(i32* addrspace(1)* %out, i32 %index) { +entry: + %tmp0 = alloca [4 x i32] + %x = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 0 + %y = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 1 + %z = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 2 + %w = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 3 + store i32 0, i32* %x + store i32 1, i32* %y + store i32 2, i32* %z + store i32 3, i32* %w + %tmp1 = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 %index + store i32* %tmp1, i32* addrspace(1)* %out + ret void +} + +attributes #0 = { nounwind } diff --git a/test/CodeGen/AMDGPU/trunc-store.ll b/test/CodeGen/AMDGPU/trunc-store.ll new file mode 100644 index 0000000000000..4ba815f26690f --- /dev/null +++ b/test/CodeGen/AMDGPU/trunc-store.ll @@ -0,0 +1,48 @@ +; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s +; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s + +; FUNC-LABEL: {{^}}truncstore_arg_v16i32_to_v16i8: +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +define void @truncstore_arg_v16i32_to_v16i8(<16 x i8> addrspace(1)* %out, <16 x i32> %in) { + %trunc = trunc <16 x i32> %in to <16 x i8> + store <16 x i8> %trunc, <16 x i8> addrspace(1)* %out + ret void +} + +; FUNC-LABEL: {{^}}truncstore_arg_v16i64_to_v16i8: +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +; SI: buffer_store_byte +define void @truncstore_arg_v16i64_to_v16i8(<16 x i8> addrspace(1)* %out, <16 x i64> %in) { + %trunc = trunc <16 x i64> %in to <16 x i8> + store <16 x i8> %trunc, <16 x i8> addrspace(1)* %out + ret void +} |
