1 ; RUN: not llc -march=r600 < %s 2>&1 | FileCheck -check-prefix=ERROR %s
2 ; RUN: llc -march=amdgcn < %s | FileCheck -check-prefix=GCN %s
4 declare hidden i32 @memcmp(ptr addrspace(1) readonly nocapture, ptr addrspace(1) readonly nocapture, i64) #0
5 declare hidden ptr addrspace(1) @memchr(ptr addrspace(1) readonly nocapture, i32, i64) #1
6 declare hidden ptr @strcpy(ptr nocapture, ptr readonly nocapture) #0
7 declare hidden i32 @strlen(ptr nocapture) #1
8 declare hidden i32 @strnlen(ptr nocapture, i32) #1
9 declare hidden i32 @strcmp(ptr nocapture, ptr nocapture) #1
12 ; ERROR: error: <unknown>:0:0: in function test_memcmp void (ptr addrspace(1), ptr addrspace(1), ptr): unsupported call to function memcmp
14 ; GCN: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, memcmp@rel32@lo+4
15 ; GCN: s_addc_u32 s{{[0-9]+}}, s{{[0-9]+}}, memcmp@rel32@hi+12
16 define amdgpu_kernel void @test_memcmp(ptr addrspace(1) %x, ptr addrspace(1) %y, ptr nocapture %p) #0 {
18 %cmp = tail call i32 @memcmp(ptr addrspace(1) %x, ptr addrspace(1) %y, i64 2)
19 store volatile i32 %cmp, ptr addrspace(1) undef
23 ; ERROR: error: <unknown>:0:0: in function test_memchr void (ptr addrspace(1), i32, i64): unsupported call to function memchr
25 ; GCN: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, memchr@rel32@lo+4
26 ; GCN: s_addc_u32 s{{[0-9]+}}, s{{[0-9]+}}, memchr@rel32@hi+12
27 define amdgpu_kernel void @test_memchr(ptr addrspace(1) %src, i32 %char, i64 %len) #0 {
28 %res = call ptr addrspace(1) @memchr(ptr addrspace(1) %src, i32 %char, i64 %len)
29 store volatile ptr addrspace(1) %res, ptr addrspace(1) undef
33 ; ERROR: error: <unknown>:0:0: in function test_strcpy void (ptr, ptr): unsupported call to function strcpy
35 ; GCN: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, strcpy@rel32@lo+4
36 ; GCN: s_addc_u32 s{{[0-9]+}}, s{{[0-9]+}}, strcpy@rel32@hi+12
37 define amdgpu_kernel void @test_strcpy(ptr %dst, ptr %src) #0 {
38 %res = call ptr @strcpy(ptr %dst, ptr %src)
39 store volatile ptr %res, ptr addrspace(1) undef
43 ; ERROR: error: <unknown>:0:0: in function test_strcmp void (ptr, ptr): unsupported call to function strcmp
45 ; GCN: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, strcmp@rel32@lo+4
46 ; GCN: s_addc_u32 s{{[0-9]+}}, s{{[0-9]+}}, strcmp@rel32@hi+12
47 define amdgpu_kernel void @test_strcmp(ptr %src0, ptr %src1) #0 {
48 %res = call i32 @strcmp(ptr %src0, ptr %src1)
49 store volatile i32 %res, ptr addrspace(1) undef
53 ; ERROR: error: <unknown>:0:0: in function test_strlen void (ptr): unsupported call to function strlen
55 ; GCN: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, strlen@rel32@lo+4
56 ; GCN: s_addc_u32 s{{[0-9]+}}, s{{[0-9]+}}, strlen@rel32@hi+12
57 define amdgpu_kernel void @test_strlen(ptr %src) #0 {
58 %res = call i32 @strlen(ptr %src)
59 store volatile i32 %res, ptr addrspace(1) undef
63 ; ERROR: error: <unknown>:0:0: in function test_strnlen void (ptr, i32): unsupported call to function strnlen
65 ; GCN: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, strnlen@rel32@lo+4
66 ; GCN: s_addc_u32 s{{[0-9]+}}, s{{[0-9]+}}, strnlen@rel32@hi+12
67 define amdgpu_kernel void @test_strnlen(ptr %src, i32 %size) #0 {
68 %res = call i32 @strnlen(ptr %src, i32 %size)
69 store volatile i32 %res, ptr addrspace(1) undef
73 attributes #0 = { nounwind }