llvm-capstone/clang/test/CodeGen/bpf-inline-asm.c
Nikita Popov 39db5e1ed8 [CodeGen] Convert tests to opaque pointers (NFC)
Conversion performed using the script at:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

These are only tests where no manual fixup was required.
2022-10-07 14:22:00 +02:00

32 lines
974 B
C

// REQUIRES: bpf-registered-target
// RUN: %clang_cc1 -triple bpf -emit-llvm -target-feature +alu32 %s -o - | FileCheck %s
// RUN: %clang_cc1 -triple bpf -emit-llvm -target-cpu v3 %s -o - | FileCheck %s
void test_generic_constraints(int var32, long var64) {
asm("%0 = %1"
: "=r"(var32)
: "0"(var32));
// CHECK: [[R32_ARG:%[a-zA-Z0-9]+]] = load i32, ptr
// CHECK: call i32 asm "$0 = $1", "=r,0"(i32 [[R32_ARG]])
asm("%0 = %1"
: "=r"(var64)
: "0"(var64));
// CHECK: [[R64_ARG:%[a-zA-Z0-9]+]] = load i64, ptr
// CHECK: call i64 asm "$0 = $1", "=r,0"(i64 [[R64_ARG]])
asm("%0 = %1"
: "=r"(var64)
: "r"(var64));
// CHECK: [[R64_ARG:%[a-zA-Z0-9]+]] = load i64, ptr
// CHECK: call i64 asm "$0 = $1", "=r,r"(i64 [[R64_ARG]])
}
void test_constraint_w(int a) {
asm("%0 = %1"
: "=w"(a)
: "w"(a));
// CHECK: [[R32_ARG:%[a-zA-Z0-9]+]] = load i32, ptr
// CHECK: call i32 asm "$0 = $1", "=w,w"(i32 [[R32_ARG]])
}