1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 -mtriple=i686-unknown-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=CHECK-PIC-32 2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 -mtriple=i686-unknown-linux-gnu -relocation-model=static | FileCheck %s -check-prefix=CHECK-STATIC-32 3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86-64 -relocation-model=static | FileCheck %s -check-prefix=CHECK-STATIC-64 4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86-64 -relocation-model=pic | FileCheck %s -check-prefix=CHECK-PIC-64 5*9880d681SAndroid Build Coastguard Worker; PR3379 6*9880d681SAndroid Build Coastguard Worker; XFAIL: * 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" 9*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu" 10*9880d681SAndroid Build Coastguard Worker@G = external global i32 ; <i32*> [#uses=1] 11*9880d681SAndroid Build Coastguard Worker 12*9880d681SAndroid Build Coastguard Workerdeclare void @bar(...) 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker; extern int G; 15*9880d681SAndroid Build Coastguard Worker; void test1() { 16*9880d681SAndroid Build Coastguard Worker; asm("frob %0 x" : : "m"(G)); 17*9880d681SAndroid Build Coastguard Worker; asm("frob %P0 x" : : "m"(G)); 18*9880d681SAndroid Build Coastguard Worker;} 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Workerdefine void @test1() nounwind { 21*9880d681SAndroid Build Coastguard Workerentry: 22*9880d681SAndroid Build Coastguard Worker; P suffix removes (rip) in -static 64-bit mode. 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-64-LABEL: test1: 25*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-64: movq G@GOTPCREL(%rip), %rax 26*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-64: frob (%rax) x 27*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-64: frob (%rax) x 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-64-LABEL: test1: 30*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-64: frob G(%rip) x 31*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-64: frob G x 32*9880d681SAndroid Build Coastguard Worker 33*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-32-LABEL: test1: 34*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-32: frob G x 35*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-32: frob G x 36*9880d681SAndroid Build Coastguard Worker 37*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-32-LABEL: test1: 38*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-32: frob G x 39*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-32: frob G x 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker call void asm "frob $0 x", "*m"(i32* @G) nounwind 42*9880d681SAndroid Build Coastguard Worker call void asm "frob ${0:P} x", "*m"(i32* @G) nounwind 43*9880d681SAndroid Build Coastguard Worker ret void 44*9880d681SAndroid Build Coastguard Worker} 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Workerdefine void @test3() nounwind { 47*9880d681SAndroid Build Coastguard Workerentry: 48*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-64-LABEL: test3: 49*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-64: call bar 50*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-64: call test3 51*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-64: call $bar 52*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-64: call $test3 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-32-LABEL: test3: 55*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-32: call bar 56*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-32: call test3 57*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-32: call $bar 58*9880d681SAndroid Build Coastguard Worker; CHECK-STATIC-32: call $test3 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-64-LABEL: test3: 61*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-64: call bar@PLT 62*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-64: call test3@PLT 63*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-64: call $bar 64*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-64: call $test3 65*9880d681SAndroid Build Coastguard Worker 66*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-32-LABEL: test3: 67*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-32: call bar@PLT 68*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-32: call test3@PLT 69*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-32: call $bar 70*9880d681SAndroid Build Coastguard Worker; CHECK-PIC-32: call $test3 71*9880d681SAndroid Build Coastguard Worker 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Worker; asm(" blah %P0" : : "X"(bar)); 74*9880d681SAndroid Build Coastguard Worker tail call void asm sideeffect "call ${0:P}", "X"(void (...)* @bar) nounwind 75*9880d681SAndroid Build Coastguard Worker tail call void asm sideeffect "call ${0:P}", "X"(void (...)* bitcast (void ()* @test3 to void (...)*)) nounwind 76*9880d681SAndroid Build Coastguard Worker tail call void asm sideeffect "call $0", "X"(void (...)* @bar) nounwind 77*9880d681SAndroid Build Coastguard Worker tail call void asm sideeffect "call $0", "X"(void (...)* bitcast (void ()* @test3 to void (...)*)) nounwind 78*9880d681SAndroid Build Coastguard Worker ret void 79*9880d681SAndroid Build Coastguard Worker} 80