[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / bpf-inline-asm.c
bloba29000fa107eab4124e1fdf5ca5fd12b3496b909
1 // REQUIRES: bpf-registered-target
2 // RUN: %clang_cc1 -triple bpf -emit-llvm -target-feature +alu32 %s -o - | FileCheck %s
3 // RUN: %clang_cc1 -triple bpf -emit-llvm -target-cpu v3 %s -o - | FileCheck %s
5 void test_generic_constraints(int var32, long var64) {
6 asm("%0 = %1"
7 : "=r"(var32)
8 : "0"(var32));
9 // CHECK: [[R32_ARG:%[a-zA-Z0-9]+]] = load i32, ptr
10 // CHECK: call i32 asm "$0 = $1", "=r,0"(i32 [[R32_ARG]])
12 asm("%0 = %1"
13 : "=r"(var64)
14 : "0"(var64));
15 // CHECK: [[R64_ARG:%[a-zA-Z0-9]+]] = load i64, ptr
16 // CHECK: call i64 asm "$0 = $1", "=r,0"(i64 [[R64_ARG]])
18 asm("%0 = %1"
19 : "=r"(var64)
20 : "r"(var64));
21 // CHECK: [[R64_ARG:%[a-zA-Z0-9]+]] = load i64, ptr
22 // CHECK: call i64 asm "$0 = $1", "=r,r"(i64 [[R64_ARG]])
25 void test_constraint_w(int a) {
26 asm("%0 = %1"
27 : "=w"(a)
28 : "w"(a));
29 // CHECK: [[R32_ARG:%[a-zA-Z0-9]+]] = load i32, ptr
30 // CHECK: call i32 asm "$0 = $1", "=w,w"(i32 [[R32_ARG]])