1 ; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=CHECK-PIC-32
2 ; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -relocation-model=static | FileCheck %s -check-prefix=CHECK-STATIC-32
3 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -relocation-model=static | FileCheck %s -check-prefix=CHECK-STATIC-64
4 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=CHECK-PIC-64
8 target 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 @G = external global i32 ; <i32*> [#uses=1]
11 declare void @bar(...)
15 ; asm("frob %0 x" : : "m"(G));
16 ; asm("frob %P0 x" : : "m"(G));
19 define void @test1() nounwind {
21 ; P suffix removes (rip) in -static 64-bit mode.
23 ; CHECK-PIC-64-LABEL: test1:
24 ; CHECK-PIC-64: movq G@GOTPCREL(%rip), %rax
25 ; CHECK-PIC-64: frob (%rax) x
26 ; CHECK-PIC-64: frob (%rax) x
28 ; CHECK-STATIC-64-LABEL: test1:
29 ; CHECK-STATIC-64: frob G(%rip) x
30 ; CHECK-STATIC-64: frob G x
32 ; CHECK-PIC-32-LABEL: test1:
33 ; CHECK-PIC-32: frob G x
34 ; CHECK-PIC-32: frob G x
36 ; CHECK-STATIC-32-LABEL: test1:
37 ; CHECK-STATIC-32: frob G x
38 ; CHECK-STATIC-32: frob G x
40 call void asm "frob $0 x", "*m"(i32* @G) nounwind
41 call void asm "frob ${0:P} x", "*m"(i32* @G) nounwind
45 define void @test3() nounwind {
47 ; CHECK-STATIC-64-LABEL: test3:
48 ; CHECK-STATIC-64: call bar
49 ; CHECK-STATIC-64: call test3
50 ; CHECK-STATIC-64: call $bar
51 ; CHECK-STATIC-64: call $test3
53 ; CHECK-STATIC-32-LABEL: test3:
54 ; CHECK-STATIC-32: call bar
55 ; CHECK-STATIC-32: call test3
56 ; CHECK-STATIC-32: call $bar
57 ; CHECK-STATIC-32: call $test3
59 ; CHECK-PIC-64-LABEL: test3:
60 ; CHECK-PIC-64: call bar@PLT
61 ; CHECK-PIC-64: call test3@PLT
62 ; CHECK-PIC-64: call $bar
63 ; CHECK-PIC-64: call $test3
65 ; CHECK-PIC-32-LABEL: test3:
66 ; CHECK-PIC-32: call bar@PLT
67 ; CHECK-PIC-32: call test3@PLT
68 ; CHECK-PIC-32: call $bar
69 ; CHECK-PIC-32: call $test3
72 ; asm(" blah %P0" : : "X"(bar));
73 tail call void asm sideeffect "call ${0:P}", "X"(void (...)* @bar) nounwind
74 tail call void asm sideeffect "call ${0:P}", "X"(void (...)* bitcast (void ()* @test3 to void (...)*)) nounwind
75 tail call void asm sideeffect "call $0", "X"(void (...)* @bar) nounwind
76 tail call void asm sideeffect "call $0", "X"(void (...)* bitcast (void ()* @test3 to void (...)*)) nounwind