File: asm-attrs.c

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (33 lines) | stat: -rw-r--r-- 1,221 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// RUN: %clang_cc1 -triple armv7-apple-darwin -emit-llvm %s -o - | FileCheck %s

// CHECK: call i32 asm "foo0", {{.*}} [[READNONE:#[0-9]+]]
// CHECK: call i32 asm "foo1", {{.*}} [[READNONE]]
// CHECK: call i32 asm "foo2", {{.*}} [[NOATTRS:#[0-9]+]]
// CHECK: call i32 asm sideeffect "foo3", {{.*}} [[NOATTRS]]
// CHECK: call i32 asm "foo4", {{.*}} [[READONLY:#[0-9]+]]
// CHECK: call i32 asm "foo5", {{.*}} [[READONLY]]
// CHECK: call i32 asm "foo6", {{.*}} [[NOATTRS]]
// CHECK: call void asm sideeffect "foo7", {{.*}} [[NOATTRS]]
// CHECK: call i32 asm "foo8", {{.*}} [[READNONE]]

// CHECK: attributes [[READNONE]] = { nounwind readnone }
// CHECK: attributes [[NOATTRS]] = { nounwind }
// CHECK: attributes [[READONLY]] = { nounwind readonly }

int g0, g1;

struct S {
  int i;
} g2;

void test_attrs(int a) {
  __asm__ ("foo0" : "=r"(g1) : "r"(a));
  __asm__ ("foo1" : "=r"(g1) : "r"(a) : "cc");
  __asm__ ("foo2" : "=r"(g1) : "r"(a) : "memory");
  __asm__ volatile("foo3" : "=r"(g1) : "r"(a));
  __asm__ ("foo4" : "=r"(g1) : "r"(a), "m"(g0));
  __asm__ ("foo5" : "=r"(g1) : "r"(a), "Q"(g0));
  __asm__ ("foo6" : "=r"(g1), "=m"(g0) : "r"(a));
  __asm__ ("foo7" : : "r"(a));
  __asm__ ("foo8" : "=r"(g2) : "r"(a));
}