2010-09-09 12:43:44 +00:00
|
|
|
// RUN: %llvmgcc %s -S -o - | FileCheck %s
|
2010-08-31 23:43:55 +00:00
|
|
|
// Exercise various use cases for local asm "register variables".
|
|
|
|
// XFAIL: *
|
2010-09-01 05:19:06 +00:00
|
|
|
// XTARGET: x86_64,i686,i386
|
2010-08-31 23:43:55 +00:00
|
|
|
|
|
|
|
int foo() {
|
|
|
|
// CHECK: %a = alloca i32
|
|
|
|
|
|
|
|
register int a asm("rsi")=5;
|
|
|
|
// CHECK: store i32 5, i32* %a, align 4
|
|
|
|
|
|
|
|
asm volatile("; %0 This asm defines rsi" : "=r"(a));
|
2011-07-15 20:58:16 +00:00
|
|
|
// CHECK: %1 = call i32 asm sideeffect "; $0 This asm defines rsi", "={rsi}
|
2011-07-16 00:26:07 +00:00
|
|
|
// CHECK: store i32 %1, i32* %a
|
2010-08-31 23:43:55 +00:00
|
|
|
|
|
|
|
a = 42;
|
|
|
|
// CHECK: store i32 42, i32* %a, align 4
|
|
|
|
|
|
|
|
asm volatile("; %0 This asm uses rsi" : : "r"(a));
|
2011-07-16 07:28:35 +00:00
|
|
|
// CHECK: %2 = load i32* %a, align 4
|
|
|
|
// CHECK: call void asm sideeffect "", "{rsi}"(i32 %2) nounwind
|
|
|
|
// CHECK: %3 = call i32 asm sideeffect "", "={rsi}"() nounwind
|
|
|
|
// CHECK: call void asm sideeffect "; $0 This asm uses rsi", "{rsi},~{dirflag},~{fpsr},~{flags}"(i32 %3)
|
2010-08-31 23:43:55 +00:00
|
|
|
|
|
|
|
return a;
|
2011-07-16 07:28:35 +00:00
|
|
|
// CHECK: %4 = load i32* %a, align 4
|
|
|
|
// CHECK: call void asm sideeffect "", "{rsi}"(i32 %4) nounwind
|
|
|
|
// CHECK: %5 = call i32 asm sideeffect "", "={rsi}"() nounwind
|
|
|
|
// CHECK: store i32 %5, i32* %0, align 4
|
|
|
|
// CHECK: %6 = load i32* %0, align 4
|
|
|
|
// CHECK: store i32 %6, i32* %retval, align 4
|
2010-08-31 23:43:55 +00:00
|
|
|
}
|