xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/asm_arm64.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -o - %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc // rdar://9167275
4*0a6a1f1dSLionel Sambuc 
t1()5*0a6a1f1dSLionel Sambuc int t1()
6*0a6a1f1dSLionel Sambuc {
7*0a6a1f1dSLionel Sambuc   int x;
8*0a6a1f1dSLionel Sambuc   __asm__("mov %0, 7" : "=r" (x));
9*0a6a1f1dSLionel Sambuc   return x;
10*0a6a1f1dSLionel Sambuc }
11*0a6a1f1dSLionel Sambuc 
t2()12*0a6a1f1dSLionel Sambuc long t2()
13*0a6a1f1dSLionel Sambuc {
14*0a6a1f1dSLionel Sambuc   long x;
15*0a6a1f1dSLionel Sambuc   __asm__("mov %0, 7" : "=r" (x));
16*0a6a1f1dSLionel Sambuc   return x;
17*0a6a1f1dSLionel Sambuc }
18*0a6a1f1dSLionel Sambuc 
t3()19*0a6a1f1dSLionel Sambuc long t3()
20*0a6a1f1dSLionel Sambuc {
21*0a6a1f1dSLionel Sambuc   long x;
22*0a6a1f1dSLionel Sambuc   __asm__("mov %w0, 7" : "=r" (x));
23*0a6a1f1dSLionel Sambuc   return x;
24*0a6a1f1dSLionel Sambuc }
25*0a6a1f1dSLionel Sambuc 
26*0a6a1f1dSLionel Sambuc // rdar://9281206
27*0a6a1f1dSLionel Sambuc 
t4(long op)28*0a6a1f1dSLionel Sambuc void t4(long op) {
29*0a6a1f1dSLionel Sambuc   long x1;
30*0a6a1f1dSLionel Sambuc   asm ("mov x0, %1; svc #0;" : "=r"(x1) :"r"(op),"r"(x1) :"x0" );
31*0a6a1f1dSLionel Sambuc }
32*0a6a1f1dSLionel Sambuc 
33*0a6a1f1dSLionel Sambuc // rdar://9394290
34*0a6a1f1dSLionel Sambuc 
t5(float x)35*0a6a1f1dSLionel Sambuc float t5(float x) {
36*0a6a1f1dSLionel Sambuc   __asm__("fadd %0, %0, %0" : "+w" (x));
37*0a6a1f1dSLionel Sambuc   return x;
38*0a6a1f1dSLionel Sambuc }
39*0a6a1f1dSLionel Sambuc 
40*0a6a1f1dSLionel Sambuc // rdar://9865712
t6(void * f,int g)41*0a6a1f1dSLionel Sambuc void t6 (void *f, int g) {
42*0a6a1f1dSLionel Sambuc   // CHECK: t6
43*0a6a1f1dSLionel Sambuc   // CHECK: call void asm "str $1, $0", "=*Q,r"
44*0a6a1f1dSLionel Sambuc   asm("str %1, %0" : "=Q"(f) : "r"(g));
45*0a6a1f1dSLionel Sambuc }
46