blob: 865d1971e8b92d606ba663e0c2cdfe3e58c362f9 [file] [log] [blame]
Eric Christophere3e07a52011-06-17 01:53:34 +00001// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -w -o - %s | FileCheck %s
Eric Christophere3e07a52011-06-17 01:53:34 +00002
Eric Christopher37240202011-06-17 06:16:34 +00003typedef long long int64_t;
4typedef unsigned int uint32_t;
Eric Christophere3e07a52011-06-17 01:53:34 +00005
6int64_t foo(int64_t v, volatile int64_t *p)
7{
8 register uint32_t rl asm("r1");
9 register uint32_t rh asm("r2");
10
11 int64_t r;
12 uint32_t t;
13
14 __asm__ __volatile__( \
15 "ldrexd%[_rl], %[_rh], [%[_p]]" \
16 : [_rl] "=&r" (rl), [_rh] "=&r" (rh) \
17 : [_p] "p" (p) : "memory");
18
Chris Lattner9cbe4f02011-07-09 17:41:47 +000019 // CHECK: call { i32, i32 } asm sideeffect "ldrexd$0, $1, [$2]", "={r1},={r2},r,~{memory}"(i64*
Eric Christophere3e07a52011-06-17 01:53:34 +000020
21 return r;
22}
Eric Christopher43fec872011-06-21 00:07:10 +000023
24// Make sure we translate register names properly.
25void bar (void) {
26 register unsigned int rn asm("r14");
27 register unsigned int d asm("r2");
28
29 // CHECK: call i32 asm sideeffect "sub $1, $1, #32", "={r2},{lr}"
30 asm volatile ("sub %1, %1, #32" : "=r"(d) : "r"(rn));
31}