1 /* Copyright (c) 2022 Huawei Device Co., Ltd.
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
5 *
6 * http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14
15 #include <stdio.h>
16 #include <string.h>
17 #include "test.h"
18
19 /**
20 * @tc.name : memcpy_0100
21 * @tc.desc : Test __aeabi_memcpy method
22 * @tc.level : Level 1
23 */
24
25 extern void *__aeabi_memcpy(void *__restrict, const void *__restrict, size_t);
26 extern void *__aeabi_memcpy4(void *__restrict, const void *__restrict, size_t);
27 extern void *__aeabi_memcpy8(void *__restrict, const void *__restrict, size_t);
28
memcpy_0100(void)29 void memcpy_0100(void)
30 {
31 int dest[] = {1, 2, 3, 4, 5, 6, 7};
32 int src[] = {4, 5, 6, 7};
33 void *result = __aeabi_memcpy(dest, src, 16);
34 if (result < 0) {
35 t_error("%s __aeabi_memcpy error get result is %d\n", __func__, result);
36 }
37 }
38
39 /**
40 * @tc.name : memcpy_0200
41 * @tc.desc : Test __aeabi_memcpy4 method
42 * @tc.level : Level 1
43 */
memcpy_0200(void)44 void memcpy_0200(void)
45 {
46 int dest[] = {1, 2, 3, 4, 5, 6, 7};
47 int src[] = {4, 5, 6, 7};
48 void *result = __aeabi_memcpy4(dest, src, 16);
49 if (result < 0) {
50 t_error("%s __aeabi_memcpy4 error get result is %d\n", __func__, result);
51 }
52 }
53
54 /**
55 * @tc.name : memcpy_0300
56 * @tc.desc : Test __aeabi_memcpy8 method
57 * @tc.level : Level 1
58 */
memcpy_0300(void)59 void memcpy_0300(void)
60 {
61 int dest[] = {1, 2, 3, 4, 5, 6, 7};
62 int src[] = {4, 5, 6, 7};
63 void *result = __aeabi_memcpy8(dest, src, 16);
64 if (result < 0) {
65 t_error("%s __aeabi_memcpy8 error get result is %d\n", __func__, result);
66 }
67 }
68
main()69 int main()
70 {
71 memcpy_0100();
72 memcpy_0200();
73 memcpy_0300();
74 return t_status;
75 }