1;RUN: llc -mtriple=x86_64-unknown-unknown -filetype=asm -x86-asm-syntax=intel < %s | FileCheck %s --check-prefix=CHECK 2;PR34617 3 4;Compile it with: "clang -O1 -emit-llvm" 5;char X[4]; 6;volatile char* PX; 7;char Y[4]; 8;volatile char* PY; 9;char Z[4]; 10;volatile char* PZ; 11;char* test057(long long x) { 12; asm ("movq %1, %%rax;" 13; "movq %%rax, %0;" 14; "pushq $Y;" 15; "popq %%rcx;" 16; "movq %%rcx, PY;" 17; "movq $X, %%rdx;" 18; "movq %%rdx, PX;" 19; :"=r"(PZ) 20; :"p"(Z) 21; :"%rax", "%rcx", "%rdx" 22; ); 23; return (char*)PZ; 24;} 25 26; CHECK: mov rax, offset Z 27; CHECK: push offset Y 28; CHECK: pop rcx 29; CHECK: mov qword ptr [PY], rcx 30; CHECK: mov rdx, offset X 31; CHECK: mov qword ptr [PX], rdx 32 33@PZ = common global i8* null, align 8 34@Z = common global [4 x i8] zeroinitializer, align 1 35@X = common global [4 x i8] zeroinitializer, align 1 36@PX = common global i8* null, align 8 37@Y = common global [4 x i8] zeroinitializer, align 1 38@PY = common global i8* null, align 8 39 40define i8* @test057(i64 %x) { 41entry: 42 %x.addr = alloca i64, align 8 43 store i64 %x, i64* %x.addr, align 8 44 %0 = call i8* asm "movq $1, %rax;movq %rax, $0;pushq $$Y;popq %rcx;movq %rcx, PY;movq $$X, %rdx;movq %rdx, PX;", "=r,im,~{rax},~{rcx},~{rdx},~{dirflag},~{fpsr},~{flags}"(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @Z, i32 0, i32 0)) 45 store i8* %0, i8** @PZ, align 8 46 %1 = load i8*, i8** @PZ, align 8 47 ret i8* %1 48} 49 50