• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
2; RUN: -mattr=-altivec -filetype=obj -o %t.o < %s
3
4; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=32-SYM %s
5
6; RUN: llvm-readobj --relocs --expand-relocs %t.o | FileCheck \
7; RUN: --check-prefix=32-REL %s
8
9; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=32-DIS %s
10
11; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff \
12; RUN:     -mcpu=pwr4 -mattr=-altivec < %s | \
13; RUN:   FileCheck %s
14
15; RUN: not --crash llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff \
16; RUN: -mcpu=pwr4 -mattr=-altivec -filetype=obj < %s 2>&1 | FileCheck \
17; RUN: --check-prefix=64-CHECK %s
18
19; Test verifies:
20; If there exists a user-defined function whose name is the same as the
21; "memcpy" ExternalSymbol's, we pick up the user-defined version, even if this
22; may lead to some undefined behavior.
23
24define dso_local signext i32 @memcpy(i8* %destination, i32 signext %num) {
25entry:
26  ret i32 3
27}
28
29define void @call_memcpy(i8* %p, i8* %q, i32 %n) {
30entry:
31  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %p, i8* %q, i32 %n, i1 false)
32  ret void
33}
34
35declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1)
36
37; This test check
38; 1. The symbol table for .o file to verify .memcpy is a defined external label.
39; 2. There is no relocation associated with the call, since callee is defined.
40; 3. Branch instruction in raw data is branching back to the right callee location.
41
42; CHECK-NOT: .extern .memcpy
43
44; 32-SYM:      Symbol {{[{][[:space:]] *}}Index: [[#Index:]]{{[[:space:]] *}}Name: .memcpy
45; 32-SYM-NEXT:    Value (RelocatableAddress): 0x0
46; 32-SYM-NEXT:    Section: .text
47; 32-SYM-NEXT:    Type: 0x0
48; 32-SYM-NEXT:    StorageClass: C_EXT (0x2)
49; 32-SYM-NEXT:    NumberOfAuxEntries: 1
50; 32-SYM-NEXT:    CSECT Auxiliary Entry {
51; 32-SYM-NEXT:      Index: 3
52; 32-SYM-NEXT:      ContainingCsectSymbolIndex: 0
53; 32-SYM-NEXT:      ParameterHashIndex: 0x0
54; 32-SYM-NEXT:      TypeChkSectNum: 0x0
55; 32-SYM-NEXT:      SymbolAlignmentLog2: 0
56; 32-SYM-NEXT:      SymbolType: XTY_LD (0x2)
57; 32-SYM-NEXT:      StorageMappingClass: XMC_PR (0x0)
58; 32-SYM-NEXT:      StabInfoIndex: 0x0
59; 32-SYM-NEXT:      StabSectNum: 0x0
60; 32-SYM-NEXT:    }
61; 32-SYM-NEXT:  }
62
63; 32-SYM-NOT: .memcpy
64
65; 32-REL:      Relocations [
66; 32-REL-NEXT:  Section (index: 2) .data {
67; 32-REL-NEXT:  Relocation {
68; 32-REL-NEXT:    Virtual Address: 0x34
69; 32-REL-NEXT:    Symbol: .memcpy (2)
70; 32-REL-NEXT:    IsSigned: No
71; 32-REL-NEXT:    FixupBitValue: 0
72; 32-REL-NEXT:    Length: 32
73; 32-REL-NEXT:    Type: R_POS (0x0)
74; 32-REL-NEXT:  }
75; 32-REL-NEXT:  Relocation {
76; 32-REL-NEXT:    Virtual Address: 0x38
77; 32-REL-NEXT:    Symbol: TOC (10)
78; 32-REL-NEXT:    IsSigned: No
79; 32-REL-NEXT:    FixupBitValue: 0
80; 32-REL-NEXT:    Length: 32
81; 32-REL-NEXT:    Type: R_POS (0x0)
82; 32-REL-NEXT:  }
83; 32-REL-NEXT:  Relocation {
84; 32-REL-NEXT:    Virtual Address: 0x40
85; 32-REL-NEXT:    Symbol: .call_memcpy (4)
86; 32-REL-NEXT:    IsSigned: No
87; 32-REL-NEXT:    FixupBitValue: 0
88; 32-REL-NEXT:    Length: 32
89; 32-REL-NEXT:    Type: R_POS (0x0)
90; 32-REL-NEXT:  }
91; 32-REL-NEXT:  Relocation {
92; 32-REL-NEXT:    Virtual Address: 0x44
93; 32-REL-NEXT:    Symbol: TOC (10)
94; 32-REL-NEXT:    IsSigned: No
95; 32-REL-NEXT:    FixupBitValue: 0
96; 32-REL-NEXT:    Length: 32
97; 32-REL-NEXT:    Type: R_POS (0x0)
98; 32-REL-NEXT:  }
99; 32-REL-NEXT:  }
100; 32-REL-NEXT: ]
101
102; 32-REL-NOT:  Type: R_RBR (0x1A)
103
104; 32-DIS:      Disassembly of section .text:
105; 32-DIS:      00000000 <.text>:
106; 32-DIS-NEXT:        0: 38 60 00 03                   li 3, 3
107; 32-DIS-NEXT:        4: 4e 80 00 20                   blr
108; 32-DIS-NEXT:        8: 60 00 00 00                   nop
109; 32-DIS-NEXT:        c: 60 00 00 00                   nop
110; 32-DIS:      00000010 <.call_memcpy>:
111; 32-DIS-NEXT:       10: 7c 08 02 a6                   mflr 0
112; 32-DIS-NEXT:       14: 90 01 00 08                   stw 0, 8(1)
113; 32-DIS-NEXT:       18: 94 21 ff c0                   stwu 1, -64(1)
114; 32-DIS-NEXT:       1c: 4b ff ff e5                   bl 0x0
115; 32-DIS-NEXT:       20: 60 00 00 00                   nop
116; 32-DIS-NEXT:       24: 38 21 00 40                   addi 1, 1, 64
117; 32-DIS-NEXT:       28: 80 01 00 08                   lwz 0, 8(1)
118; 32-DIS-NEXT:       2c: 7c 08 03 a6                   mtlr 0
119; 32-DIS-NEXT:       30: 4e 80 00 20                   blr
120
121; 64-CHECK: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
122