Debian Codegraph @

clang/test/CIR/CodeGen/libc.c

raw
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
2 // RUN: FileCheck --input-file=%t.cir %s
3
4 // Note: In the final implementation, we will want these to generate
5 // CIR-specific libc operations. This test is just a placeholder
6 // to make sure we can compile these to normal function calls
7 // until the special handling is implemented.
8
9 void *memcpy(void *, const void *, unsigned long);
10 void testMemcpy(void *dst, const void *src, unsigned long size) {
11 memcpy(dst, src, size);
12 // CHECK: cir.call @memcpy
13 }
14
15 void *memmove(void *, const void *, unsigned long);
16 void testMemmove(void *src, const void *dst, unsigned long size) {
17 memmove(dst, src, size);
18 // CHECK: cir.call @memmove
19 }
20
21 void *memset(void *, int, unsigned long);
22 void testMemset(void *dst, int val, unsigned long size) {
23 memset(dst, val, size);
24 // CHECK: cir.call @memset
25 }
26
27 double fabs(double);
28 double testFabs(double x) {
29 return fabs(x);
30 // CHECK: cir.call @fabs
31 }
32
33 float fabsf(float);
34 float testFabsf(float x) {
35 return fabsf(x);
36 // CHECK: cir.call @fabsf
37 }
38
39 int abs(int);
40 int testAbs(int x) {
41 return abs(x);
42 // CHECK: cir.call @abs
43 }
44
45 long labs(long);
46 long testLabs(long x) {
47 return labs(x);
48 // CHECK: cir.call @labs
49 }
50
51 long long llabs(long long);
52 long long testLlabs(long long x) {
53 return llabs(x);
54 // CHECK: cir.call @llabs
55 }