1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // REQUIRES: aarch64-registered-target
3 // RUN: %clang_cc1 -triple aarch64 -target-feature +sme -O1 -Werror -emit-llvm -o - %s | FileCheck %s
4 // RUN: %clang_cc1 -triple aarch64 -target-feature +sme -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
5 // RUN: %clang_cc1 -triple aarch64 -target-feature +sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
9 // CHECK-LABEL: @test_in_streaming_mode(
11 // CHECK-NEXT: [[TMP0:%.*]] = tail call aarch64_sme_preservemost_from_x2 { i64, i64 } @__arm_sme_state() #[[ATTR3:[0-9]+]]
12 // CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i64 } [[TMP0]], 0
13 // CHECK-NEXT: [[AND_I:%.*]] = and i64 [[TMP1]], 1
14 // CHECK-NEXT: [[TOBOOL_I:%.*]] = icmp ne i64 [[AND_I]], 0
15 // CHECK-NEXT: ret i1 [[TOBOOL_I]]
17 // CPP-CHECK-LABEL: @_Z22test_in_streaming_modev(
18 // CPP-CHECK-NEXT: entry:
19 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call aarch64_sme_preservemost_from_x2 { i64, i64 } @__arm_sme_state() #[[ATTR3:[0-9]+]]
20 // CPP-CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i64 } [[TMP0]], 0
21 // CPP-CHECK-NEXT: [[AND_I:%.*]] = and i64 [[TMP1]], 1
22 // CPP-CHECK-NEXT: [[TOBOOL_I:%.*]] = icmp ne i64 [[AND_I]], 0
23 // CPP-CHECK-NEXT: ret i1 [[TOBOOL_I]]
25 bool test_in_streaming_mode(void) __arm_streaming_compatible
{
26 return __arm_in_streaming_mode();
29 // CHECK-LABEL: @test_za_disable(
31 // CHECK-NEXT: tail call void @__arm_za_disable() #[[ATTR3]]
32 // CHECK-NEXT: ret void
34 // CPP-CHECK-LABEL: @_Z15test_za_disablev(
35 // CPP-CHECK-NEXT: entry:
36 // CPP-CHECK-NEXT: tail call void @__arm_za_disable() #[[ATTR3]]
37 // CPP-CHECK-NEXT: ret void
39 void test_za_disable(void) __arm_streaming_compatible
{
43 // CHECK-LABEL: @test_has_sme(
45 // CHECK-NEXT: [[TMP0:%.*]] = tail call aarch64_sme_preservemost_from_x2 { i64, i64 } @__arm_sme_state() #[[ATTR3]]
46 // CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i64 } [[TMP0]], 0
47 // CHECK-NEXT: [[TOBOOL_I:%.*]] = icmp slt i64 [[TMP1]], 0
48 // CHECK-NEXT: ret i1 [[TOBOOL_I]]
50 // CPP-CHECK-LABEL: @_Z12test_has_smev(
51 // CPP-CHECK-NEXT: entry:
52 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call aarch64_sme_preservemost_from_x2 { i64, i64 } @__arm_sme_state() #[[ATTR3]]
53 // CPP-CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i64 } [[TMP0]], 0
54 // CPP-CHECK-NEXT: [[TOBOOL_I:%.*]] = icmp slt i64 [[TMP1]], 0
55 // CPP-CHECK-NEXT: ret i1 [[TOBOOL_I]]
57 bool test_has_sme(void) __arm_streaming_compatible
{
58 return __arm_has_sme();
61 // CHECK-LABEL: @test_svundef_za(
63 // CHECK-NEXT: ret void
65 // CPP-CHECK-LABEL: @_Z15test_svundef_zav(
66 // CPP-CHECK-NEXT: entry:
67 // CPP-CHECK-NEXT: ret void
69 void test_svundef_za(void) __arm_streaming_compatible
__arm_out("za") {
73 // CHECK-LABEL: @test_sc_memcpy(
75 // CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memcpy(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]]
76 // CHECK-NEXT: ret ptr [[CALL]]
78 // CPP-CHECK-LABEL: @_Z14test_sc_memcpyPvPKvm(
79 // CPP-CHECK-NEXT: entry:
80 // CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memcpy(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]]
81 // CPP-CHECK-NEXT: ret ptr [[CALL]]
83 void *test_sc_memcpy(void *dest
, const void *src
, size_t n
) __arm_streaming_compatible
{
84 return __arm_sc_memcpy(dest
, src
, n
);
87 // CHECK-LABEL: @test_sc_memmove(
89 // CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memmove(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]]
90 // CHECK-NEXT: ret ptr [[CALL]]
92 // CPP-CHECK-LABEL: @_Z15test_sc_memmovePvPKvm(
93 // CPP-CHECK-NEXT: entry:
94 // CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memmove(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]]
95 // CPP-CHECK-NEXT: ret ptr [[CALL]]
97 void *test_sc_memmove(void *dest
, const void *src
, size_t n
) __arm_streaming_compatible
{
98 return __arm_sc_memmove(dest
, src
, n
);
101 // CHECK-LABEL: @test_sc_memset(
102 // CHECK-NEXT: entry:
103 // CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memset(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]]
104 // CHECK-NEXT: ret ptr [[CALL]]
106 // CPP-CHECK-LABEL: @_Z14test_sc_memsetPvim(
107 // CPP-CHECK-NEXT: entry:
108 // CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memset(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]]
109 // CPP-CHECK-NEXT: ret ptr [[CALL]]
111 void *test_sc_memset(void *s
, int c
, size_t n
) __arm_streaming_compatible
{
112 return __arm_sc_memset(s
, c
, n
);
115 // CHECK-LABEL: @test_sc_memchr(
116 // CHECK-NEXT: entry:
117 // CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memchr(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]]
118 // CHECK-NEXT: ret ptr [[CALL]]
120 // CPP-CHECK-LABEL: @_Z14test_sc_memchrPvim(
121 // CPP-CHECK-NEXT: entry:
122 // CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memchr(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]]
123 // CPP-CHECK-NEXT: ret ptr [[CALL]]
125 void *test_sc_memchr(void *s
, int c
, size_t n
) __arm_streaming_compatible
{
126 return __arm_sc_memchr(s
, c
, n
);