brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 8dbb244 Raw
45 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; RUN: opt -mtriple=amdgcn-- -passes=amdgpu-printf-runtime-binding -mcpu=gfx90a -S < %s | FileCheck --check-prefix=GCN %s3 4@str = private unnamed_addr constant [10 x i8] c"string %d\00", align 15 6define void @caller(i32 %n) {7; GCN-LABEL: define void @caller8; GCN-SAME: (i32 [[N:%.*]]) #[[ATTR0:[0-9]+]] {9; GCN-NEXT:  entry:10; GCN-NEXT:    [[CALL:%.*]] = call i32 (ptr, ...) @printf(ptr @str, i32 [[N]]) #[[ATTR2:[0-9]+]]11; GCN-NEXT:    ret void12;13entry:14  %call = call i32 (ptr, ...) @printf(ptr @str, i32 %n) #015  ret void16}17 18define void @caller_builtin(i32 %n) {19; GCN-LABEL: define void @caller_builtin20; GCN-SAME: (i32 [[N:%.*]]) #[[ATTR0]] {21; GCN-NEXT:  entry:22; GCN-NEXT:    [[PRINTF_ALLOC_FN:%.*]] = call ptr addrspace(1) @__printf_alloc(i32 8)23; GCN-NEXT:    br label [[ENTRY_SPLIT:%.*]]24; GCN:       entry.split:25; GCN-NEXT:    [[TMP0:%.*]] = icmp ne ptr addrspace(1) [[PRINTF_ALLOC_FN]], null26; GCN-NEXT:    br i1 [[TMP0]], label [[TMP1:%.*]], label [[TMP2:%.*]]27; GCN:       1:28; GCN-NEXT:    [[PRINTBUFFID:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 029; GCN-NEXT:    [[PRINTBUFFIDCAST:%.*]] = bitcast ptr addrspace(1) [[PRINTBUFFID]] to ptr addrspace(1)30; GCN-NEXT:    store i32 1, ptr addrspace(1) [[PRINTBUFFIDCAST]], align 431; GCN-NEXT:    [[PRINTBUFFGEP:%.*]] = getelementptr i8, ptr addrspace(1) [[PRINTF_ALLOC_FN]], i32 432; GCN-NEXT:    store i32 [[N]], ptr addrspace(1) [[PRINTBUFFGEP]], align 433; GCN-NEXT:    br label [[TMP2]]34; GCN:       2:35; GCN-NEXT:    ret void36;37entry:38  %call = call i32 (ptr, ...) @printf(ptr @str, i32 %n)39  ret void40}41 42declare i32 @printf(ptr, ...)43 44attributes #0 = { nobuiltin }45