brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 8748d0f Raw
30 lines · plain
1; Verify that we accept calls to variables in the program AS:2; RUN: llvm-as -data-layout "P40" %s -o - | llvm-dis - | FileCheck %s3; CHECK: target datalayout = "P40"4 5; We should get a sensible error for a non-program address call:6; RUN: not llvm-as -data-layout "P39" %s -o /dev/null 2>&1 | FileCheck %s -check-prefix ERR-AS397; ERR-AS39: error: '%fnptr' defined with type 'ptr addrspace(40)' but expected 'ptr addrspace(39)'8 9; And also if we don't set a custom program address space:10; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s -check-prefix ERR-AS011; ERR-AS0: error: '%fnptr' defined with type 'ptr addrspace(40)' but expected 'ptr'12 13define void @f_named(i16 %n, ptr addrspace(40) %f) addrspace(40) {14entry:15  %f.addr = alloca ptr addrspace(40), align 116  store ptr addrspace(40) %f, ptr %f.addr17  %fnptr = load ptr addrspace(40), ptr %f.addr18  call void %fnptr(i16 8)19  ret void20}21 22define void @f_numbered(i16 %n, ptr addrspace(40) %f) addrspace(40){23entry:24  %f.addr = alloca ptr addrspace(40), align 125  store ptr addrspace(40) %f, ptr %f.addr26  %0 = load ptr addrspace(40), ptr %f.addr27  call void %0(i16 8)28  ret void29}30