79 lines · plain
1; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=CHECK-PIC-322; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -relocation-model=static | FileCheck %s -check-prefix=CHECK-STATIC-323; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -relocation-model=static | FileCheck %s -check-prefix=CHECK-STATIC-644; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=CHECK-PIC-645; PR33796; XFAIL: *7 8target 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 ; <ptr> [#uses=1]10 11declare void @bar(...)12 13; extern int G;14; void test1() {15; asm("frob %0 x" : : "m"(G));16; asm("frob %P0 x" : : "m"(G));17;}18 19define void @test1() nounwind {20entry:21; P suffix removes (rip) in -static 64-bit mode.22 23; CHECK-PIC-64-LABEL: test1:24; CHECK-PIC-64: movq G@GOTPCREL(%rip), %rax25; CHECK-PIC-64: frob (%rax) x26; CHECK-PIC-64: frob (%rax) x27 28; CHECK-STATIC-64-LABEL: test1:29; CHECK-STATIC-64: frob G(%rip) x30; CHECK-STATIC-64: frob G x31 32; CHECK-PIC-32-LABEL: test1:33; CHECK-PIC-32: frob G x34; CHECK-PIC-32: frob G x35 36; CHECK-STATIC-32-LABEL: test1:37; CHECK-STATIC-32: frob G x38; CHECK-STATIC-32: frob G x39 40 call void asm "frob $0 x", "*m"(ptr @G) nounwind41 call void asm "frob ${0:P} x", "*m"(ptr @G) nounwind42 ret void43}44 45define void @test3() nounwind {46entry:47; CHECK-STATIC-64-LABEL: test3:48; CHECK-STATIC-64: call bar49; CHECK-STATIC-64: call test350; CHECK-STATIC-64: call $bar51; CHECK-STATIC-64: call $test352 53; CHECK-STATIC-32-LABEL: test3:54; CHECK-STATIC-32: call bar55; CHECK-STATIC-32: call test356; CHECK-STATIC-32: call $bar57; CHECK-STATIC-32: call $test358 59; CHECK-PIC-64-LABEL: test3:60; CHECK-PIC-64: call bar@PLT61; CHECK-PIC-64: call test3@PLT62; CHECK-PIC-64: call $bar63; CHECK-PIC-64: call $test364 65; CHECK-PIC-32-LABEL: test3:66; CHECK-PIC-32: call bar@PLT67; CHECK-PIC-32: call test3@PLT68; CHECK-PIC-32: call $bar69; CHECK-PIC-32: call $test370 71 72; asm(" blah %P0" : : "X"(bar));73 tail call void asm sideeffect "call ${0:P}", "X"(ptr @bar) nounwind74 tail call void asm sideeffect "call ${0:P}", "X"(ptr @test3) nounwind75 tail call void asm sideeffect "call $0", "X"(ptr @bar) nounwind76 tail call void asm sideeffect "call $0", "X"(ptr @test3) nounwind77 ret void78}79