Eric Christopher | e3e07a5 | 2011-06-17 01:53:34 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -w -o - %s | FileCheck %s |
Eric Christopher | e3e07a5 | 2011-06-17 01:53:34 +0000 | [diff] [blame] | 2 | |
Eric Christopher | 3724020 | 2011-06-17 06:16:34 +0000 | [diff] [blame] | 3 | typedef long long int64_t; |
| 4 | typedef unsigned int uint32_t; |
Eric Christopher | e3e07a5 | 2011-06-17 01:53:34 +0000 | [diff] [blame] | 5 | |
| 6 | int64_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 | |
Eric Christopher | 8837d74 | 2011-06-17 17:04:30 +0000 | [diff] [blame] | 19 | // CHECK: call %0 asm sideeffect "ldrexd$0, $1, [$2]", "={r1},={r2},r,~{memory}"(i64* |
Eric Christopher | e3e07a5 | 2011-06-17 01:53:34 +0000 | [diff] [blame] | 20 | |
| 21 | return r; |
| 22 | } |
Eric Christopher | 43fec87 | 2011-06-21 00:07:10 +0000 | [diff] [blame^] | 23 | |
| 24 | // Make sure we translate register names properly. |
| 25 | void 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 | } |