xref: /llvm-project/clang/test/CodeGen/AArch64/sve-inline-asm.c (revision 207e5ccceec8d3cc3f32723e78f2a142bc61b07d)
1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2p1 \
3 // RUN:   -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK
4 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sve2p1 \
5 // RUN:   -S -o /dev/null
6 
7 void test_sve_asm(void) {
8   asm volatile(
9       "ptrue p0.d\n"
10       "ptrue p15.d\n"
11       "add z0.d, p0/m, z0.d, z0.d\n"
12       "add z31.d, p0/m, z31.d, z31.d\n"
13       :
14       :
15       : "z0", "z31", "p0", "p15");
16   // CHECK-LABEL: @test_sve_asm
17   // CHECK: "~{z0},~{z31},~{p0},~{p15}"
18 }
19 
20 void test_sve2p1_asm(void) {
21   asm("pfalse pn0.b\n"
22       "ptrue pn8.d\n"
23       "ptrue pn15.b\n"
24       "pext p3.b, pn8[1]\n"
25       ::: "pn0", "pn8", "pn15", "p3");
26   // CHECK-LABEL: @test_sve2p1_asm
27   // CHECK: "~{pn0},~{pn8},~{pn15},~{p3}"
28 }
29