xref: /llvm-project/llvm/test/ThinLTO/X86/asm.ll (revision d5d3eb16b7ab72529c83dacb2889811491e48909)
1584cb67dSFangrui Song; RUN: split-file %s %t
2584cb67dSFangrui Song; RUN: opt -module-summary %t/a.s -o %t/a.bc
3584cb67dSFangrui Song; RUN: opt -module-summary %t/b.s -o %t/b.bc
4584cb67dSFangrui Song; RUN: llvm-nm %t/a.bc | FileCheck %s --check-prefix=NM
5584cb67dSFangrui Song
6584cb67dSFangrui Song; RUN: llvm-lto2 run %t/a.bc %t/b.bc -o %t/out -save-temps -r=%t/a.bc,ref,plx -r=%t/b.bc,ff_h264_cabac_tables,pl
7584cb67dSFangrui Song; RUN: llvm-dis < %t/out.2.2.internalize.bc | FileCheck %s
8584cb67dSFangrui Song
9584cb67dSFangrui Song;--- a.s
10584cb67dSFangrui Song;; IR symtab does not track inline asm symbols, so we don't know
11584cb67dSFangrui Song;; ff_h264_cabac_tables is undefined.
12584cb67dSFangrui Song; NM-NOT: {{.}}
13584cb67dSFangrui Song; NM:     ---------------- T ref
14584cb67dSFangrui Song; NM-NOT: {{.}}
15584cb67dSFangrui Songtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
16584cb67dSFangrui Songtarget triple = "x86_64-unknown-linux-gnu"
17584cb67dSFangrui Song
18*d5d3eb16SFangrui Songdefine ptr @ref() {
19584cb67dSFangrui Songentry:
20*d5d3eb16SFangrui Song  %0 = tail call ptr asm sideeffect "lea ff_h264_cabac_tables(%rip), $0", "=&r,~{dirflag},~{fpsr},~{flags}"()
21*d5d3eb16SFangrui Song  ret ptr %0
22584cb67dSFangrui Song}
23584cb67dSFangrui Song
24584cb67dSFangrui Song;--- b.s
25584cb67dSFangrui Songtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
26584cb67dSFangrui Songtarget triple = "x86_64-unknown-linux-gnu"
27584cb67dSFangrui Song
28584cb67dSFangrui Song;; ff_h264_cabac_tables has __attribute__((used)) in the source code, which means
29584cb67dSFangrui Song;; its definition must be retained because there can be references the compiler
30584cb67dSFangrui Song;; cannot see (inline asm reference). Test we don't internalize it.
31584cb67dSFangrui Song; CHECK: @ff_h264_cabac_tables = dso_local constant [1 x i8] c"\09"
32584cb67dSFangrui Song@ff_h264_cabac_tables = dso_local constant [1 x i8] c"\09"
33584cb67dSFangrui Song
34*d5d3eb16SFangrui Song@llvm.compiler.used = appending global [1 x ptr] [ptr @ff_h264_cabac_tables], section "llvm.metadata"
35