This makes a line in llvm/test/CodeGen/X86/asm-block-labels.ll pass with `asm inteldialect` too. I don't know if this is something one can hit in practice with inline asm. The test is from 2007 (4646aa3e33) but in 2009 blockaddr was introduced and e.g. `__asm__ __volatile__("brl %0" :: "X"(&&foo) : "memory");` compiles to call void asm sideeffect "brl $0", "X,..."(i8* blockaddress(@func, %1)) nowadays (thanks to jrtc27 for that example!). (6c4d255bf3switched clang to blockaddress on an opt-in basis,e4801f7844added docs for it,31b132c0b7added IR support.) I half-heartedly tried to build clang 2.8 locally, but it didn't just build. And 2.8 didn't have a prebuilt clang binary yet. The motivation is to make EmitGCCInlineAsmStr() and EmitMSInlineAsmStr() more alike, and maybe we should delete this code form EmitGCCInlineAsmStr() instead. But since it's just 3 lines and it's reachable from LLVM IR, let's do the safer thing for now. Differential Revision: https://reviews.llvm.org/D114329
51 lines
1.9 KiB
LLVM
51 lines
1.9 KiB
LLVM
; RUN: opt < %s -O3 | llc -no-integrated-as
|
|
; ModuleID = 'block12.c'
|
|
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
|
|
target triple = "i686-apple-darwin8"
|
|
|
|
define void @bar() {
|
|
entry:
|
|
br label %"LASM$foo"
|
|
|
|
"LASM$foo": ; preds = %entry
|
|
call void asm sideeffect ".file \22block12.c\22", "~{dirflag},~{fpsr},~{flags}"( )
|
|
call void asm sideeffect ".line 1", "~{dirflag},~{fpsr},~{flags}"( )
|
|
call void asm sideeffect "int $$1", "~{dirflag},~{fpsr},~{flags},~{memory}"( )
|
|
call void asm sideeffect ".file \22block12.c\22", "~{dirflag},~{fpsr},~{flags}"( )
|
|
call void asm sideeffect ".line 2", "~{dirflag},~{fpsr},~{flags}"( )
|
|
call void asm sideeffect "brl ${0:l}", "X,~{dirflag},~{fpsr},~{flags},~{memory}"( label %"LASM$foo" )
|
|
br label %return
|
|
|
|
return: ; preds = %"LASM$foo"
|
|
ret void
|
|
}
|
|
|
|
define void @baz() {
|
|
entry:
|
|
call void asm sideeffect ".file \22block12.c\22", "~{dirflag},~{fpsr},~{flags}"( )
|
|
call void asm sideeffect ".line 3", "~{dirflag},~{fpsr},~{flags}"( )
|
|
call void asm sideeffect "brl ${0:l}", "X,~{dirflag},~{fpsr},~{flags},~{memory}"( label %"LASM$foo" )
|
|
call void asm sideeffect ".file \22block12.c\22", "~{dirflag},~{fpsr},~{flags}"( )
|
|
call void asm sideeffect ".line 4", "~{dirflag},~{fpsr},~{flags}"( )
|
|
call void asm sideeffect "int $$1", "~{dirflag},~{fpsr},~{flags},~{memory}"( )
|
|
br label %"LASM$foo"
|
|
|
|
"LASM$foo": ; preds = %entry
|
|
call void asm sideeffect ".file \22block12.c\22", "~{dirflag},~{fpsr},~{flags}"( )
|
|
call void asm sideeffect ".line 5", "~{dirflag},~{fpsr},~{flags}"( )
|
|
call void asm sideeffect "int $$1", "~{dirflag},~{fpsr},~{flags},~{memory}"( )
|
|
br label %return
|
|
|
|
return: ; preds = %"LASM$foo"
|
|
ret void
|
|
}
|
|
|
|
define void @quux() {
|
|
entry:
|
|
call void asm sideeffect inteldialect "brl ${0:l}", "X,~{dirflag},~{fpsr},~{flags},~{memory}"( label %"LASM$foo" )
|
|
br label %"LASM$foo"
|
|
|
|
"LASM$foo": ; preds = %entry
|
|
ret void
|
|
}
|