[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / test / MC / ELF / type-propagate.s
blob17b4c0a5721c57cac76a540ef066eaff7cdd76a2
1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj --symbols - | FileCheck %s
3 // This tests that types are propagated from symbols to their aliases. Our
4 // behavior is a bit different than gas. If the type of a symbol changes,
5 // gas will update the type of the aliases only if those aliases were declare
6 // at a point in the file where the aliased symbol was already define.
8 // The lines marked with GAS illustrate this difference.
11 .type sym01, @object
12 sym01:
13 .type sym02, @function
14 sym02:
16 sym03 = sym01
17 sym04 = sym03
18 .type sym03, @function
19 sym05 = sym03
20 sym06 = sym01 - sym02
21 sym07 = sym02 - sym01
23 sym08 = sym10
24 sym09 = sym10 + 1
25 .type sym10, @object
26 sym10:
28 sym11 = sym10
29 sym12 = sym10 + 1
30 .type sym10, @function
32 // CHECK: Symbol {
33 // CHECK: Name: sym01
34 // CHECK-NEXT: Value: 0x0
35 // CHECK-NEXT: Size: 0
36 // CHECK-NEXT: Binding: Local (0x0)
37 // CHECK-NEXT: Type: Object (0x1)
38 // CHECK-NEXT: Other: 0
39 // CHECK-NEXT: Section: .text
40 // CHECK-NEXT: }
41 // CHECK-NEXT: Symbol {
42 // CHECK-NEXT: Name: sym02
43 // CHECK-NEXT: Value: 0x0
44 // CHECK-NEXT: Size: 0
45 // CHECK-NEXT: Binding: Local (0x0)
46 // CHECK-NEXT: Type: Function (0x2)
47 // CHECK-NEXT: Other: 0
48 // CHECK-NEXT: Section: .text
49 // CHECK-NEXT: }
50 // CHECK-NEXT: Symbol {
51 // CHECK-NEXT: Name: sym03
52 // CHECK-NEXT: Value: 0x0
53 // CHECK-NEXT: Size: 0
54 // CHECK-NEXT: Binding: Local (0x0)
55 // CHECK-NEXT: Type: Function (0x2)
56 // CHECK-NEXT: Other: 0
57 // CHECK-NEXT: Section: .text
58 // CHECK-NEXT: }
59 // CHECK-NEXT: Symbol {
60 // CHECK-NEXT: Name: sym04
61 // CHECK-NEXT: Value: 0x0
62 // CHECK-NEXT: Size: 0
63 // CHECK-NEXT: Binding: Local (0x0)
64 // CHECK-NEXT: Type: Object (0x1)
65 // CHECK-NEXT: Other: 0
66 // CHECK-NEXT: Section: .text
67 // CHECK-NEXT: }
68 // CHECK-NEXT: Symbol {
69 // CHECK-NEXT: Name: sym05
70 // CHECK-NEXT: Value: 0x0
71 // CHECK-NEXT: Size: 0
72 // CHECK-NEXT: Binding: Local (0x0)
74 // GAS: Type: Function (0x2)
75 // CHECK-NEXT: Type: Object (0x1)
77 // CHECK-NEXT: Other: 0
78 // CHECK-NEXT: Section: .text
79 // CHECK-NEXT: }
80 // CHECK-NEXT: Symbol {
81 // CHECK-NEXT: Name: sym06
82 // CHECK-NEXT: Value: 0x0
83 // CHECK-NEXT: Size: 0
84 // CHECK-NEXT: Binding: Local (0x0)
85 // CHECK-NEXT: Type: None (0x0)
86 // CHECK-NEXT: Other: 0
87 // CHECK-NEXT: Section: Absolute (0xFFF1)
88 // CHECK-NEXT: }
89 // CHECK-NEXT: Symbol {
90 // CHECK-NEXT: Name: sym07
91 // CHECK-NEXT: Value: 0x0
92 // CHECK-NEXT: Size: 0
93 // CHECK-NEXT: Binding: Local (0x0)
94 // CHECK-NEXT: Type: None (0x0)
95 // CHECK-NEXT: Other: 0
96 // CHECK-NEXT: Section: Absolute (0xFFF1)
97 // CHECK-NEXT: }
98 // CHECK-NEXT: Symbol {
99 // CHECK-NEXT: Name: sym08
100 // CHECK-NEXT: Value: 0x0
101 // CHECK-NEXT: Size: 0
102 // CHECK-NEXT: Binding: Local (0x0)
103 // CHECK-NEXT: Type: Function (0x2)
104 // CHECK-NEXT: Other: 0
105 // CHECK-NEXT: Section: .text
106 // CHECK-NEXT: }
107 // CHECK-NEXT: Symbol {
108 // CHECK-NEXT: Name: sym10
109 // CHECK-NEXT: Value: 0x0
110 // CHECK-NEXT: Size: 0
111 // CHECK-NEXT: Binding: Local (0x0)
112 // CHECK-NEXT: Type: Function (0x2)
113 // CHECK-NEXT: Other: 0
114 // CHECK-NEXT: Section: .text
115 // CHECK-NEXT: }
116 // CHECK-NEXT: Symbol {
117 // CHECK-NEXT: Name: sym09
118 // CHECK-NEXT: Value: 0x1
119 // CHECK-NEXT: Size: 0
120 // CHECK-NEXT: Binding: Local (0x0)
122 // GAS: Type: None (0x0)
123 // CHECK-NEXT: Type: Function (0x2)
125 // CHECK-NEXT: Other: 0
126 // CHECK-NEXT: Section: .text
127 // CHECK-NEXT: }
128 // CHECK-NEXT: Symbol {
129 // CHECK-NEXT: Name: sym11
130 // CHECK-NEXT: Value: 0x0
131 // CHECK-NEXT: Size: 0
132 // CHECK-NEXT: Binding: Local (0x0)
134 // GAS: Type: Object (0x1)
135 // CHECK-NEXT: Type: Function (0x2)
137 // CHECK-NEXT: Other: 0
138 // CHECK-NEXT: Section: .text
139 // CHECK-NEXT: }
140 // CHECK-NEXT: Symbol {
141 // CHECK-NEXT: Name: sym12
142 // CHECK-NEXT: Value: 0x1
143 // CHECK-NEXT: Size: 0
144 // CHECK-NEXT: Binding: Local (0x0)
146 // GAS: Type: Object (0x1)
147 // CHECK-NEXT: Type: Function (0x2)
149 // CHECK-NEXT: Other: 0
150 // CHECK-NEXT: Section: .text
151 // CHECK-NEXT: }