1 // RUN: %llvmgcc %s -S -o - | FileCheck %s
2 // Exercise various use cases for local asm "register variables".
4 // XTARGET: x86_64,i686,i386
7 // CHECK: %a = alloca i32
9 register int a
asm("rsi")=5;
10 // CHECK: store i32 5, i32* %a, align 4
12 asm volatile("; %0 This asm defines rsi" : "=r"(a
));
13 // CHECK: %asmtmp = call i32 asm sideeffect "; $0 This asm defines rsi", "={rsi}
14 // CHECK: store i32 %asmtmp, i32* %a
17 // CHECK: store i32 42, i32* %a, align 4
19 asm volatile("; %0 This asm uses rsi" : : "r"(a
));
20 // CHECK: %1 = load i32* %a, align 4
21 // CHECK: call void asm sideeffect "", "{rsi}"(i32 %1) nounwind
22 // CHECK: %2 = call i32 asm sideeffect "", "={rsi}"() nounwind
23 // CHECK: call void asm sideeffect "; $0 This asm uses rsi", "{rsi},~{dirflag},~{fpsr},~{flags}"(i32 %2)
26 // CHECK: %3 = load i32* %a, align 4
27 // CHECK: call void asm sideeffect "", "{rsi}"(i32 %3) nounwind
28 // CHECK: %4 = call i32 asm sideeffect "", "={rsi}"() nounwind
29 // CHECK: store i32 %4, i32* %0, align 4
30 // CHECK: %5 = load i32* %0, align 4
31 // CHECK: store i32 %5, i32* %retval, align 4