]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/linker-optimization-hints/Makefile
ld64-236.3.tar.gz
[apple/ld64.git] / unit-tests / test-cases / linker-optimization-hints / Makefile
1 ##
2 # Copyright (c) 2013 Apple Inc. All rights reserved.
3 #
4 # @APPLE_LICENSE_HEADER_START@
5 #
6 # This file contains Original Code and/or Modifications of Original Code
7 # as defined in and that are subject to the Apple Public Source License
8 # Version 2.0 (the 'License'). You may not use this file except in
9 # compliance with the License. Please obtain a copy of the License at
10 # http://www.opensource.apple.com/apsl/ and read it before using this
11 # file.
12 #
13 # The Original Code and all software distributed under the License are
14 # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 # Please see the License for the specific language governing rights and
19 # limitations under the License.
20 #
21 # @APPLE_LICENSE_HEADER_END@
22 ##
23 TESTROOT = ../..
24 include ${TESTROOT}/include/common.makefile
25
26 #
27 # Check that linker does/doesnot apply optimization hints
28 #
29
30 all: all-${ARCH}
31
32 all-i386: skip
33 all-x86_64: skip
34 all-armv6: skip
35 all-armv7: skip
36
37 all-arm64: AdrpAdd AdrpAddLdr AdrpLdr AdrpLdrGotLdr AdrpAddStr AdrpLdrGotStr AdrpLdrGot
38
39 main.o:
40 ${CC} ${CCFLAGS} main.s -c -o main.o
41
42 AdrpAdd: main.o
43 # test ADRP/ADD -> ADR when target is in __TEXT
44 ${CC} ${CCFLAGS} AdrpAdd.s -c -o AdrpAdd1.o -DFOO_AS_CONST=1
45 ${CC} ${CCFLAGS} AdrpAdd1.o main.o -o AdrpAdd1.exe
46 ${OTOOL} -tV AdrpAdd1.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
47 ${OTOOL} -tV AdrpAdd1.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
48 ${OTOOL} -tV AdrpAdd1.exe | grep 'add x0' | ${FAIL_IF_STDIN}
49 # test ADRP/ADD -> ADR when target is in __DATA and main executable
50 ${CC} ${CCFLAGS} AdrpAdd.s -c -o AdrpAdd2.o -DFOO_AS_DATA=1
51 ${CC} ${CCFLAGS} AdrpAdd2.o main.o -o AdrpAdd2.exe
52 ${OTOOL} -tV AdrpAdd2.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
53 ${OTOOL} -tV AdrpAdd2.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
54 ${OTOOL} -tV AdrpAdd2.exe | grep 'add x0' | ${FAIL_IF_STDIN}
55 # test ADRP/ADD -> ADR when target is in __DATA and dylib
56 ${CC} ${CCFLAGS} AdrpAdd.s -c -o AdrpAdd3.o -DFOO_AS_DATA=1
57 ${CC} ${CCFLAGS} AdrpAdd3.o -dynamiclib -o AdrpAdd3.dylib
58 ${OTOOL} -tV AdrpAdd3.dylib | grep 'adr x0' | ${FAIL_IF_EMPTY}
59 ${OTOOL} -tV AdrpAdd3.dylib | grep 'adrp x0' | ${FAIL_IF_STDIN}
60 ${OTOOL} -tV AdrpAdd3.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
61 # test ADRP/ADD !-> when target is in __DATA and dylib in shared region
62 ${CC} ${CCFLAGS} AdrpAdd.s -c -o AdrpAdd4.o -DFOO_AS_DATA=1
63 ${CC} ${CCFLAGS} AdrpAdd4.o -dynamiclib -o AdrpAdd4.dylib -install_name /usr/lib/libjunk.dylib
64 ${OTOOL} -tV AdrpAdd4.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
65 ${OTOOL} -tV AdrpAdd4.dylib | grep 'add x0' | ${FAIL_IF_EMPTY}
66 ${OTOOL} -tV AdrpAdd4.dylib | grep 'adr x0' | ${FAIL_IF_STDIN}
67 # test ADRP/ADD !-> when target is in __TEXT but too far
68 ${CC} ${CCFLAGS} AdrpAdd.s -c -o AdrpAdd5.o -DFOO_AS_CONST=1 -DPADDING
69 ${CC} ${CCFLAGS} AdrpAdd5.o main.o -o AdrpAdd5.exe
70 ${OTOOL} -tV AdrpAdd5.exe | grep 'adrp x0' | ${FAIL_IF_EMPTY}
71 ${OTOOL} -tV AdrpAdd5.exe | grep 'add x0' | ${FAIL_IF_EMPTY}
72 ${OTOOL} -tV AdrpAdd5.exe | grep 'adr x0' | ${FAIL_IF_STDIN}
73
74
75
76 AdrpAddLdr: AdrpAddLdr-ldr AdrpAddLdr-far AdrpAddLdr-seg AdrpAddLdr-align AdrpAddLdr-addend
77 true
78
79 AdrpAddLdr-ldr: main.o
80 # test ADRP/ADD/LD -> ADR/LDR when target is in __TEXT for 8-bit load
81 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-ldr-g8.o -DFOO_AS_CONST -DLOAD_GPR_8
82 ${CC} ${CCFLAGS} AdrpAddLdr-ldr-g8.o main.o -o AdrpAddLdr-ldr-g8.exe
83 ${OTOOL} -tV AdrpAddLdr-ldr-g8.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
84 ${OTOOL} -tV AdrpAddLdr-ldr-g8.exe | grep 'ldr\tb1, \[x0\]' | ${FAIL_IF_EMPTY}
85 ${OTOOL} -tV AdrpAddLdr-ldr-g8.exe | grep 'add x0' | ${FAIL_IF_STDIN}
86
87 # test ADRP/ADD/LD -> ADR/LDR when target is in __TEXT for 16-bit load
88 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-ldr-g16.o -DFOO_AS_CONST -DLOAD_GPR_16
89 ${CC} ${CCFLAGS} AdrpAddLdr-ldr-g16.o main.o -o AdrpAddLdr-ldr-g16.exe
90 ${OTOOL} -tV AdrpAddLdr-ldr-g16.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
91 ${OTOOL} -tV AdrpAddLdr-ldr-g16.exe | grep 'ldr\th1, \[x0\]' | ${FAIL_IF_EMPTY}
92 ${OTOOL} -tV AdrpAddLdr-ldr-g16.exe | grep 'add x0' | ${FAIL_IF_STDIN}
93
94 # test ADRP/ADD/LD -> LDR when target is in __TEXT for 32-bit load
95 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-ldr-g32.o -DFOO_AS_CONST -DLOAD_GPR_32
96 ${CC} ${CCFLAGS} AdrpAddLdr-ldr-g32.o main.o -o AdrpAddLdr-ldr-g32.exe
97 ${OTOOL} -tV AdrpAddLdr-ldr-g32.exe | grep 'ldr w1, _foo' | ${FAIL_IF_EMPTY}
98 ${OTOOL} -tV AdrpAddLdr-ldr-g32.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
99 ${OTOOL} -tV AdrpAddLdr-ldr-g32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
100
101 # test ADRP/ADD/LD -> LDR when target is in __TEXT for 64-bit load
102 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-ldr-g64.o -DFOO_AS_CONST -DLOAD_GPR_64
103 ${CC} ${CCFLAGS} AdrpAddLdr-ldr-g64.o main.o -o AdrpAddLdr-ldr-g64.exe
104 ${OTOOL} -tV AdrpAddLdr-ldr-g64.exe | grep 'ldr x1, _foo' | ${FAIL_IF_EMPTY}
105 ${OTOOL} -tV AdrpAddLdr-ldr-g64.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
106 ${OTOOL} -tV AdrpAddLdr-ldr-g64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
107
108 # test ADRP/ADD/LD -> LDR when target is in __TEXT for 32-bit fp load
109 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-ldr-f32.o -DFOO_AS_CONST -DLOAD_FPR_32
110 ${CC} ${CCFLAGS} AdrpAddLdr-ldr-f32.o main.o -o AdrpAddLdr-ldr-f32.exe
111 ${OTOOL} -tV AdrpAddLdr-ldr-f32.exe | grep 'ldr s1, _foo' | ${FAIL_IF_EMPTY}
112 ${OTOOL} -tV AdrpAddLdr-ldr-f32.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
113 ${OTOOL} -tV AdrpAddLdr-ldr-f32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
114
115 # test ADRP/ADD/LD -> LDR when target is in __TEXT for 64-bit fp load
116 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-ldr-f64.o -DFOO_AS_CONST -DLOAD_FPR_64
117 ${CC} ${CCFLAGS} AdrpAddLdr-ldr-f64.o main.o -o AdrpAddLdr-ldr-f64.exe
118 ${OTOOL} -tV AdrpAddLdr-ldr-f64.exe | grep 'ldr d1, _foo' | ${FAIL_IF_EMPTY}
119 ${OTOOL} -tV AdrpAddLdr-ldr-f64.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
120 ${OTOOL} -tV AdrpAddLdr-ldr-f64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
121
122 # test ADRP/ADD/LD -> LDR when target is in __TEXT for 128-bit vec load
123 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-ldr-v128.o -DFOO_AS_CONST -DLOAD_VEC_128
124 ${CC} ${CCFLAGS} AdrpAddLdr-ldr-v128.o main.o -o AdrpAddLdr-ldr-v128.exe
125 ${OTOOL} -tV AdrpAddLdr-ldr-v128.exe | grep 'ldr q1, _foo' | ${FAIL_IF_EMPTY}
126 ${OTOOL} -tV AdrpAddLdr-ldr-v128.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
127 ${OTOOL} -tV AdrpAddLdr-ldr-v128.exe | grep 'add x0' | ${FAIL_IF_STDIN}
128
129
130 AdrpAddLdr-far: main.o
131 # test ADRP/ADD/LD -> ADRP/LD when target is far for 8-bit load
132 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-far-g8.o -DFOO_AS_CONST -DLOAD_GPR_8 -DPADDING
133 ${CC} ${CCFLAGS} AdrpAddLdr-far-g8.o main.o -o AdrpAddLdr-far-g8.exe
134 ${OTOOL} -tV AdrpAddLdr-far-g8.exe | grep 'ldr b1, \[x0, ' | ${FAIL_IF_EMPTY}
135 ${OTOOL} -tV AdrpAddLdr-far-g8.exe | grep 'add x0' | ${FAIL_IF_STDIN}
136
137 # test ADRP/ADD/LD -> ADRP/LD when target is far for 16-bit load
138 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-far-g16.o -DFOO_AS_CONST -DLOAD_GPR_16 -DPADDING
139 ${CC} ${CCFLAGS} AdrpAddLdr-far-g16.o main.o -o AdrpAddLdr-far-g16.exe
140 ${OTOOL} -tV AdrpAddLdr-far-g16.exe | grep 'ldr h1, \[x0, ' | ${FAIL_IF_EMPTY}
141 ${OTOOL} -tV AdrpAddLdr-far-g16.exe | grep 'add x0' | ${FAIL_IF_STDIN}
142
143 # test ADRP/ADD/LD -> ADRP/LD when target is far for 32-bit load
144 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-far-g32.o -DFOO_AS_CONST -DLOAD_GPR_32 -DPADDING
145 ${CC} ${CCFLAGS} AdrpAddLdr-far-g32.o main.o -o AdrpAddLdr-far-g32.exe
146 ${OTOOL} -tV AdrpAddLdr-far-g32.exe | grep 'ldr w1, \[x0, ' | ${FAIL_IF_EMPTY}
147 ${OTOOL} -tV AdrpAddLdr-far-g32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
148
149 # test ADRP/ADD/LD -> ADRP/LD when target is far for 64-bit load
150 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-far-g64.o -DFOO_AS_CONST -DLOAD_GPR_64 -DPADDING
151 ${CC} ${CCFLAGS} AdrpAddLdr-far-g64.o main.o -o AdrpAddLdr-far-g64.exe
152 ${OTOOL} -tV AdrpAddLdr-far-g64.exe | grep 'ldr x1, \[x0, ' | ${FAIL_IF_EMPTY}
153 ${OTOOL} -tV AdrpAddLdr-far-g64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
154
155 # test ADRP/ADD/LD -> ADRP/LD when target is far for 32-bit fp load
156 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-far-f32.o -DFOO_AS_CONST -DLOAD_FPR_32 -DPADDING
157 ${CC} ${CCFLAGS} AdrpAddLdr-far-f32.o main.o -o AdrpAddLdr-far-f32.exe
158 ${OTOOL} -tV AdrpAddLdr-far-f32.exe | grep 'ldr s1, \[x0, ' | ${FAIL_IF_EMPTY}
159 ${OTOOL} -tV AdrpAddLdr-far-f32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
160
161 # test ADRP/ADD/LD -> ADRP/LD when target is far for 64-bit fp load
162 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-far-f64.o -DFOO_AS_CONST -DLOAD_FPR_64 -DPADDING
163 ${CC} ${CCFLAGS} AdrpAddLdr-far-f64.o main.o -o AdrpAddLdr-far-f64.exe
164 ${OTOOL} -tV AdrpAddLdr-far-f64.exe | grep 'ldr d1, \[x0, ' | ${FAIL_IF_EMPTY}
165 ${OTOOL} -tV AdrpAddLdr-far-f64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
166
167 # test ADRP/ADD/LD -> ADRP/LD when target is far for 128-bit vec load
168 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-far-v128.o -DFOO_AS_CONST -DLOAD_VEC_128 -DPADDING
169 ${CC} ${CCFLAGS} AdrpAddLdr-far-v128.o main.o -o AdrpAddLdr-far-v128.exe
170 ${OTOOL} -tV AdrpAddLdr-far-v128.exe | grep 'ldr q1, \[x0, ' | ${FAIL_IF_EMPTY}
171 ${OTOOL} -tV AdrpAddLdr-far-v128.exe | grep 'add x0' | ${FAIL_IF_STDIN}
172
173
174
175 AdrpAddLdr-align: main.o
176 # test ADRP/ADD/LD -> ADR/LD when target is for 8-bit load
177 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-align-g8.o -DFOO_AS_DATA -DLOAD_GPR_8 -DMISALIGN_DATA
178 ${CC} ${CCFLAGS} AdrpAddLdr-align-g8.o main.o -o AdrpAddLdr-align-g8.exe
179 ${OTOOL} -tV AdrpAddLdr-align-g8.exe | grep 'adr x0,' | ${FAIL_IF_EMPTY}
180 ${OTOOL} -tV AdrpAddLdr-align-g8.exe | grep 'ldr\tb1, \[x0\]' | ${FAIL_IF_EMPTY}
181 ${OTOOL} -tV AdrpAddLdr-align-g8.exe | grep 'add x0' | ${FAIL_IF_STDIN}
182
183 # test ADRP/ADD/LD -> ADR/LD when target is not aligned for 16-bit load
184 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-align-g16.o -DFOO_AS_DATA -DLOAD_GPR_16 -DMISALIGN_DATA
185 ${CC} ${CCFLAGS} AdrpAddLdr-align-g16.o main.o -o AdrpAddLdr-align-g16.exe
186 ${OTOOL} -tV AdrpAddLdr-align-g16.exe | grep 'adr x0,' | ${FAIL_IF_EMPTY}
187 ${OTOOL} -tV AdrpAddLdr-align-g16.exe | grep 'ldr h1, \[x0\]' | ${FAIL_IF_EMPTY}
188 ${OTOOL} -tV AdrpAddLdr-align-g16.exe | grep 'add x0' | ${FAIL_IF_STDIN}
189
190 # test ADRP/ADD/LD -> ADR/LD when target is not aligned for 32-bit load
191 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-align-g32.o -DFOO_AS_DATA -DLOAD_GPR_32 -DMISALIGN_DATA
192 ${CC} ${CCFLAGS} AdrpAddLdr-align-g32.o main.o -o AdrpAddLdr-align-g32.exe
193 ${OTOOL} -tV AdrpAddLdr-align-g32.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
194 ${OTOOL} -tV AdrpAddLdr-align-g32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
195 ${OTOOL} -tV AdrpAddLdr-align-g32.exe | grep 'ldr w1, \[x0\]' | ${FAIL_IF_EMPTY}
196
197 # test ADRP/ADD/LD -> ADR/LD when target is not aligned for 64-bit load
198 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-align-g64.o -DFOO_AS_DATA -DLOAD_GPR_64 -DMISALIGN_DATA
199 ${CC} ${CCFLAGS} AdrpAddLdr-align-g64.o main.o -o AdrpAddLdr-align-g64.exe
200 ${OTOOL} -tV AdrpAddLdr-align-g64.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
201 ${OTOOL} -tV AdrpAddLdr-align-g64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
202 ${OTOOL} -tV AdrpAddLdr-align-g64.exe | grep 'ldr x1, \[x0\]' | ${FAIL_IF_EMPTY}
203
204 # test ADRP/ADD/LD -> ADR/LD when target is not aligned for 32-bit fp load
205 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-align-f32.o -DFOO_AS_DATA -DLOAD_FPR_32 -DMISALIGN_DATA
206 ${CC} ${CCFLAGS} AdrpAddLdr-align-f32.o main.o -o AdrpAddLdr-align-f32.exe
207 ${OTOOL} -tV AdrpAddLdr-align-f32.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
208 ${OTOOL} -tV AdrpAddLdr-align-f32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
209 ${OTOOL} -tV AdrpAddLdr-align-f32.exe | grep 'ldr s1, \[x0\]' | ${FAIL_IF_EMPTY}
210
211 # test ADRP/ADD/LD -> ADR/LD when target is not aligned for 64-bit fp load
212 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-align-f64.o -DFOO_AS_DATA -DLOAD_FPR_64 -DMISALIGN_DATA
213 ${CC} ${CCFLAGS} AdrpAddLdr-align-f64.o main.o -o AdrpAddLdr-align-f64.exe
214 ${OTOOL} -tV AdrpAddLdr-align-f64.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
215 ${OTOOL} -tV AdrpAddLdr-align-f64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
216 ${OTOOL} -tV AdrpAddLdr-align-f64.exe | grep 'ldr d1, \[x0\]' | ${FAIL_IF_EMPTY}
217
218 # test ADRP/ADD/LD -> ADR/LD when target is not aligned for 128-bit vec load
219 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-align-v128.o -DFOO_AS_DATA -DLOAD_VEC_128 -DMISALIGN_DATA
220 ${CC} ${CCFLAGS} AdrpAddLdr-align-v128.o main.o -o AdrpAddLdr-align-v128.exe
221 ${OTOOL} -tV AdrpAddLdr-align-v128.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
222 ${OTOOL} -tV AdrpAddLdr-align-v128.exe | grep 'add x0' | ${FAIL_IF_STDIN}
223 ${OTOOL} -tV AdrpAddLdr-align-v128.exe | grep 'ldr q1, \[x0\]' | ${FAIL_IF_EMPTY}
224
225
226
227 AdrpAddLdr-seg:
228 # test ADRP/ADD/LD -> ADRP/LD when target is in movable segment for 8-bit load
229 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-seg-g8.o -DFOO_AS_DATA -DLOAD_GPR_8
230 ${CC} ${CCFLAGS} AdrpAddLdr-seg-g8.o -dynamiclib -o AdrpAddLdr-seg-g8.dylib -install_name /usr/lib/libjunk.dylib
231 ${OTOOL} -tV AdrpAddLdr-seg-g8.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
232 ${OTOOL} -tV AdrpAddLdr-seg-g8.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
233 ${OTOOL} -tV AdrpAddLdr-seg-g8.dylib | grep 'ldr b1, \[x0,' | ${FAIL_IF_EMPTY}
234
235 # test ADRP/ADD/LD -> ADRP/LD when target is in movable segment for 16-bit load
236 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-seg-g16.o -DFOO_AS_DATA -DLOAD_GPR_16
237 ${CC} ${CCFLAGS} AdrpAddLdr-seg-g16.o -dynamiclib -o AdrpAddLdr-seg-g16.dylib -install_name /usr/lib/libjunk.dylib
238 ${OTOOL} -tV AdrpAddLdr-seg-g16.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
239 ${OTOOL} -tV AdrpAddLdr-seg-g16.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
240 ${OTOOL} -tV AdrpAddLdr-seg-g16.dylib | grep 'ldr h1, \[x0,' | ${FAIL_IF_EMPTY}
241
242 # test ADRP/ADD/LD -> ADRP/LD when target is in movable segment for 32-bit load
243 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-seg-g32.o -DFOO_AS_DATA -DLOAD_GPR_32
244 ${CC} ${CCFLAGS} AdrpAddLdr-seg-g32.o -dynamiclib -o AdrpAddLdr-seg-g32.dylib -install_name /usr/lib/libjunk.dylib
245 ${OTOOL} -tV AdrpAddLdr-seg-g32.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
246 ${OTOOL} -tV AdrpAddLdr-seg-g32.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
247 ${OTOOL} -tV AdrpAddLdr-seg-g32.dylib | grep 'ldr w1, \[x0,' | ${FAIL_IF_EMPTY}
248
249 # test ADRP/ADD/LD -> ADRP/LD when target is in movable segment for 64-bit load
250 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-seg-g64.o -DFOO_AS_DATA -DLOAD_GPR_64
251 ${CC} ${CCFLAGS} AdrpAddLdr-seg-g64.o -dynamiclib -o AdrpAddLdr-seg-g64.dylib -install_name /usr/lib/libjunk.dylib
252 ${OTOOL} -tV AdrpAddLdr-seg-g64.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
253 ${OTOOL} -tV AdrpAddLdr-seg-g64.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
254 ${OTOOL} -tV AdrpAddLdr-seg-g64.dylib | grep 'ldr x1, \[x0,' | ${FAIL_IF_EMPTY}
255
256 # test ADRP/ADD/LD -> ADRP/LD when target is in movable segment for 32-bit fp load
257 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-seg-f32.o -DFOO_AS_DATA -DLOAD_FPR_32
258 ${CC} ${CCFLAGS} AdrpAddLdr-seg-f32.o -dynamiclib -o AdrpAddLdr-seg-f32.dylib -install_name /usr/lib/libjunk.dylib
259 ${OTOOL} -tV AdrpAddLdr-seg-f32.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
260 ${OTOOL} -tV AdrpAddLdr-seg-f32.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
261 ${OTOOL} -tV AdrpAddLdr-seg-f32.dylib | grep 'ldr s1, \[x0,' | ${FAIL_IF_EMPTY}
262
263 # test ADRP/ADD/LD -> ADRP/LD when target is in movable segment for 64-bit fp load
264 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-seg-f64.o -DFOO_AS_DATA -DLOAD_FPR_64
265 ${CC} ${CCFLAGS} AdrpAddLdr-seg-f64.o -dynamiclib -o AdrpAddLdr-seg-f64.dylib -install_name /usr/lib/libjunk.dylib
266 ${OTOOL} -tV AdrpAddLdr-seg-f64.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
267 ${OTOOL} -tV AdrpAddLdr-seg-f64.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
268 ${OTOOL} -tV AdrpAddLdr-seg-f64.dylib | grep 'ldr d1, \[x0,' | ${FAIL_IF_EMPTY}
269
270 # test ADRP/ADD/LD -> ADRP/LD when target is in movable segmentfor 128-bit vec load
271 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-seg-v128.o -DFOO_AS_DATA -DLOAD_VEC_128
272 ${CC} ${CCFLAGS} AdrpAddLdr-seg-v128.o -dynamiclib -o AdrpAddLdr-seg-v128.dylib -install_name /usr/lib/libjunk.dylib
273 ${OTOOL} -tV AdrpAddLdr-seg-v128.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
274 ${OTOOL} -tV AdrpAddLdr-seg-v128.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
275 ${OTOOL} -tV AdrpAddLdr-seg-v128.dylib | grep 'ldr q1, \[x0,' | ${FAIL_IF_EMPTY}
276
277
278
279 AdrpAddLdr-addend:
280 # test ADRP/ADD/LD -> ADRP/LD when target is in __TEXT for 8-bit load
281 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-addend-g8.o -DFOO_AS_CONST -DLOAD_GPR_8 -DADDEND=8
282 ${CC} ${CCFLAGS} AdrpAddLdr-addend-g8.o main.o -o AdrpAddLdr-addend-g8.exe
283 ${OTOOL} -tV AdrpAddLdr-addend-g8.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
284 ${OTOOL} -tV AdrpAddLdr-addend-g8.exe | grep 'ldr\tb1, \[x0\]' | ${FAIL_IF_EMPTY}
285 ${OTOOL} -tV AdrpAddLdr-addend-g8.exe | grep 'add x0' | ${FAIL_IF_STDIN}
286
287 # test ADRP/ADD/LD -> ADRP/LD when target is in __TEXT for 16-bit load
288 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-addend-g16.o -DFOO_AS_CONST -DLOAD_GPR_16 -DADDEND=8
289 ${CC} ${CCFLAGS} AdrpAddLdr-addend-g16.o main.o -o AdrpAddLdr-addend-g16.exe
290 ${OTOOL} -tV AdrpAddLdr-addend-g16.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
291 ${OTOOL} -tV AdrpAddLdr-addend-g16.exe | grep 'ldr\th1, \[x0\]' | ${FAIL_IF_EMPTY}
292 ${OTOOL} -tV AdrpAddLdr-addend-g16.exe | grep 'add x0' | ${FAIL_IF_STDIN}
293
294 # test ADRP/ADD/LD -> LDR when target is in __TEXT for 32-bit load
295 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-addend-g32.o -DFOO_AS_CONST -DLOAD_GPR_32 -DADDEND=8
296 ${CC} ${CCFLAGS} AdrpAddLdr-addend-g32.o main.o -o AdrpAddLdr-addend-g32.exe
297 ${OTOOL} -tV AdrpAddLdr-addend-g32.exe | grep 'ldr w1, _8foo8' | ${FAIL_IF_EMPTY}
298 ${OTOOL} -tV AdrpAddLdr-addend-g32.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
299 ${OTOOL} -tV AdrpAddLdr-addend-g32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
300
301 # test ADRP/ADD/LD -> LDR when target is in __TEXT for 64-bit load
302 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-addend-g64.o -DFOO_AS_CONST -DLOAD_GPR_64 -DADDEND=8
303 ${CC} ${CCFLAGS} AdrpAddLdr-addend-g64.o main.o -o AdrpAddLdr-addend-g64.exe
304 ${OTOOL} -tV AdrpAddLdr-addend-g64.exe | grep 'ldr x1, _8foo8' | ${FAIL_IF_EMPTY}
305 ${OTOOL} -tV AdrpAddLdr-addend-g64.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
306 ${OTOOL} -tV AdrpAddLdr-addend-g64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
307
308 # test ADRP/ADD/LD -> LDR when target is in __TEXT for 32-bit fp load
309 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-addend-f32.o -DFOO_AS_CONST -DLOAD_FPR_32 -DADDEND=8
310 ${CC} ${CCFLAGS} AdrpAddLdr-addend-f32.o main.o -o AdrpAddLdr-addend-f32.exe
311 ${OTOOL} -tV AdrpAddLdr-addend-f32.exe | grep 'ldr s1, _8foo8' | ${FAIL_IF_EMPTY}
312 ${OTOOL} -tV AdrpAddLdr-addend-f32.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
313 ${OTOOL} -tV AdrpAddLdr-addend-f32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
314
315 # test ADRP/ADD/LD -> LDR when target is in __TEXT for 64-bit fp load
316 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-addend-f64.o -DFOO_AS_CONST -DLOAD_FPR_64 -DADDEND=8
317 ${CC} ${CCFLAGS} AdrpAddLdr-addend-f64.o main.o -o AdrpAddLdr-addend-f64.exe
318 ${OTOOL} -tV AdrpAddLdr-addend-f64.exe | grep 'ldr d1, _8foo8' | ${FAIL_IF_EMPTY}
319 ${OTOOL} -tV AdrpAddLdr-addend-f64.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
320 ${OTOOL} -tV AdrpAddLdr-addend-f64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
321
322 # test ADRP/ADD/LD -> LDR when target is in __TEXT for 128-bit vec load
323 ${CC} ${CCFLAGS} AdrpAddLdr.s -c -o AdrpAddLdr-addend-v128.o -DFOO_AS_CONST -DLOAD_VEC_128 -DADDEND=16
324 ${CC} ${CCFLAGS} AdrpAddLdr-addend-v128.o main.o -o AdrpAddLdr-addend-v128.exe
325 ${OTOOL} -tV AdrpAddLdr-addend-v128.exe | grep 'ldr q1, _16foo16' | ${FAIL_IF_EMPTY}
326 ${OTOOL} -tV AdrpAddLdr-addend-v128.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
327 ${OTOOL} -tV AdrpAddLdr-addend-v128.exe | grep 'add x0' | ${FAIL_IF_STDIN}
328
329
330
331
332 AdrpLdr: AdrpLdr-ldr AdrpLdr-seg AdrpLdr-addend
333 true
334
335 AdrpLdr-ldr: main.o
336 # test ADRP/LDR left untouched when target is in __TEXT for 8-bit load
337 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-g8.o -DFOO_AS_CONST -DLOAD_GPR_8
338 ${CC} ${CCFLAGS} AdrpLdr-ldr-g8.o main.o -o AdrpLdr-ldr-g8.exe
339 ${OTOOL} -tV AdrpLdr-ldr-g8.exe | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
340 ${OTOOL} -tV AdrpLdr-ldr-g8.exe | grep 'ldr\tb1, \[x0,' | ${FAIL_IF_EMPTY}
341
342 # test ADRP/LDR left untouched when target is in __TEXT for 16-bit load
343 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-g16.o -DFOO_AS_CONST -DLOAD_GPR_16
344 ${CC} ${CCFLAGS} AdrpLdr-ldr-g16.o main.o -o AdrpLdr-ldr-g16.exe
345 ${OTOOL} -tV AdrpLdr-ldr-g16.exe | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
346 ${OTOOL} -tV AdrpLdr-ldr-g16.exe | grep 'ldr\th1, \[x0,' | ${FAIL_IF_EMPTY}
347
348 # test ADRP/LDR -> LDR when target is in __TEXT for 32-bit load
349 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-g32.o -DFOO_AS_CONST -DLOAD_GPR_32
350 ${CC} ${CCFLAGS} AdrpLdr-ldr-g32.o main.o -o AdrpLdr-ldr-g32.exe
351 ${OTOOL} -tV AdrpLdr-ldr-g32.exe | grep 'ldr w1, _foo' | ${FAIL_IF_EMPTY}
352 ${OTOOL} -tV AdrpLdr-ldr-g32.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
353 ${OTOOL} -tV AdrpLdr-ldr-g32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
354
355 # test ADRP/LDR left untouched when target is in __TEXT for 32-bit load from signed 8-bit value
356 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-g32s8.o -DFOO_AS_CONST -DLOAD_GPR_32_S8
357 ${CC} ${CCFLAGS} AdrpLdr-ldr-g32s8.o main.o -o AdrpLdr-ldr-g32s8.exe
358 ${OTOOL} -tV AdrpLdr-ldr-g32s8.exe | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
359 ${OTOOL} -tV AdrpLdr-ldr-g32s8.exe | grep 'ldrsb\tw1, \[x0,' | ${FAIL_IF_EMPTY}
360
361 # test ADRP/LDR -> LDR when target is in __TEXT for 32-bit load from signed 16-bit value
362 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-g32s16.o -DFOO_AS_CONST -DLOAD_GPR_32_S16
363 ${CC} ${CCFLAGS} AdrpLdr-ldr-g32s16.o main.o -o AdrpLdr-ldr-g32s16.exe
364 ${OTOOL} -tV AdrpLdr-ldr-g32s16.exe | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
365 ${OTOOL} -tV AdrpLdr-ldr-g32s16.exe | grep 'ldrsh\tw1, \[x0,' | ${FAIL_IF_EMPTY}
366
367 # test ADRP/LDR -> LDR when target is in __TEXT for 64-bit load
368 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-g64.o -DFOO_AS_CONST -DLOAD_GPR_64
369 ${CC} ${CCFLAGS} AdrpLdr-ldr-g64.o main.o -o AdrpLdr-ldr-g64.exe
370 ${OTOOL} -tV AdrpLdr-ldr-g64.exe | grep 'ldr x1, _foo' | ${FAIL_IF_EMPTY}
371 ${OTOOL} -tV AdrpLdr-ldr-g64.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
372 ${OTOOL} -tV AdrpLdr-ldr-g64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
373
374 # test ADRP/LDR left untouched when target is in __TEXT for 64-bit load from signed 8-bit value
375 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-g64s8.o -DFOO_AS_CONST -DLOAD_GPR_64_S8
376 ${CC} ${CCFLAGS} AdrpLdr-ldr-g64s8.o main.o -o AdrpLdr-ldr-g64s8.exe
377 ${OTOOL} -tV AdrpLdr-ldr-g64s8.exe | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
378 ${OTOOL} -tV AdrpLdr-ldr-g64s8.exe | grep 'ldrsb\tx1, \[x0,' | ${FAIL_IF_EMPTY}
379
380 # test ADRP/LDR left untouched when target is in __TEXT for 64-bit load from signed 16-bit value
381 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-g64s16.o -DFOO_AS_CONST -DLOAD_GPR_64_S16
382 ${CC} ${CCFLAGS} AdrpLdr-ldr-g64s16.o main.o -o AdrpLdr-ldr-g64s16.exe
383 ${OTOOL} -tV AdrpLdr-ldr-g64s16.exe | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
384 ${OTOOL} -tV AdrpLdr-ldr-g64s16.exe | grep 'ldrsh\tx1, \[x0,' | ${FAIL_IF_EMPTY}
385
386 # test ADRP/LDR -> LDR when target is in __TEXT for 64-bit load from signed 32-bit value
387 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-g64s32.o -DFOO_AS_CONST -DLOAD_GPR_64_S32
388 ${CC} ${CCFLAGS} AdrpLdr-ldr-g64s32.o main.o -o AdrpLdr-ldr-g64s32.exe
389 ${OTOOL} -tV AdrpLdr-ldr-g64s32.exe | grep 'ldrsw x1, _foo' | ${FAIL_IF_EMPTY}
390 ${OTOOL} -tV AdrpLdr-ldr-g64s32.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
391 ${OTOOL} -tV AdrpLdr-ldr-g64s32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
392
393 # test ADRP/LDR -> LDR when target is in __TEXT for 32-bit fp load
394 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-f32.o -DFOO_AS_CONST -DLOAD_FPR_32
395 ${CC} ${CCFLAGS} AdrpLdr-ldr-f32.o main.o -o AdrpLdr-ldr-f32.exe
396 ${OTOOL} -tV AdrpLdr-ldr-f32.exe | grep 'ldr s1, _foo' | ${FAIL_IF_EMPTY}
397 ${OTOOL} -tV AdrpLdr-ldr-f32.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
398 ${OTOOL} -tV AdrpLdr-ldr-f32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
399
400 # test ADRP/LDR -> LDR when target is in __TEXT for 64-bit fp load
401 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-f64.o -DFOO_AS_CONST -DLOAD_FPR_64
402 ${CC} ${CCFLAGS} AdrpLdr-ldr-f64.o main.o -o AdrpLdr-ldr-f64.exe
403 ${OTOOL} -tV AdrpLdr-ldr-f64.exe | grep 'ldr d1, _foo' | ${FAIL_IF_EMPTY}
404 ${OTOOL} -tV AdrpLdr-ldr-f64.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
405 ${OTOOL} -tV AdrpLdr-ldr-f64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
406
407 # test ADRP/LDR -> LDR when target is in __TEXT for 128-bit vec load
408 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-ldr-v128.o -DFOO_AS_CONST -DLOAD_VEC_128
409 ${CC} ${CCFLAGS} AdrpLdr-ldr-v128.o main.o -o AdrpLdr-ldr-v128.exe
410 ${OTOOL} -tV AdrpLdr-ldr-v128.exe | grep 'ldr q1, _foo' | ${FAIL_IF_EMPTY}
411 ${OTOOL} -tV AdrpLdr-ldr-v128.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
412 ${OTOOL} -tV AdrpLdr-ldr-v128.exe | grep 'add x0' | ${FAIL_IF_STDIN}
413
414 AdrpLdr-seg:
415 # test ADRP/LDR left untouched when target is in __TEXT for 8-bit load
416 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-seg-g8.o -DFOO_AS_DATA -DLOAD_GPR_8
417 ${CC} ${CCFLAGS} AdrpLdr-seg-g8.o -dynamiclib -o AdrpLdr-seg-g8.dylib -install_name /usr/lib/libjunk.dylib
418 ${OTOOL} -tV AdrpLdr-seg-g8.dylib | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
419 ${OTOOL} -tV AdrpLdr-seg-g8.dylib | grep 'ldr\tb1, \[x0,' | ${FAIL_IF_EMPTY}
420
421 # test ADRP/LDR left untouched when target is in __TEXT for 16-bit load
422 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-seg-g16.o -DFOO_AS_DATA -DLOAD_GPR_16
423 ${CC} ${CCFLAGS} AdrpLdr-seg-g16.o -dynamiclib -o AdrpLdr-seg-g16.dylib -install_name /usr/lib/libjunk.dylib
424 ${OTOOL} -tV AdrpLdr-seg-g16.dylib | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
425 ${OTOOL} -tV AdrpLdr-seg-g16.dylib | grep 'ldr\th1, \[x0,' | ${FAIL_IF_EMPTY}
426
427 # test ADRP/LDR -> LDR when target is in __TEXT for 32-bit load
428 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-seg-g32.o -DFOO_AS_DATA -DLOAD_GPR_32
429 ${CC} ${CCFLAGS} AdrpLdr-seg-g32.o -dynamiclib -o AdrpLdr-seg-g32.dylib -install_name /usr/lib/libjunk.dylib
430 ${OTOOL} -tV AdrpLdr-seg-g32.dylib | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
431 ${OTOOL} -tV AdrpLdr-seg-g32.dylib | grep 'ldr\tw1, \[x0,' | ${FAIL_IF_EMPTY}
432
433 # test ADRP/LDR -> LDR when target is in __TEXT for 64-bit load
434 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-seg-g64.o -DFOO_AS_DATA -DLOAD_GPR_64
435 ${CC} ${CCFLAGS} AdrpLdr-seg-g64.o -dynamiclib -o AdrpLdr-seg-g64.dylib -install_name /usr/lib/libjunk.dylib
436 ${OTOOL} -tV AdrpLdr-seg-g64.dylib | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
437 ${OTOOL} -tV AdrpLdr-seg-g64.dylib | grep 'ldr\tx1, \[x0,' | ${FAIL_IF_EMPTY}
438
439 # test ADRP/LDR -> LDR when target is in __TEXT for 32-bit fp load
440 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-seg-f32.o -DFOO_AS_DATA -DLOAD_FPR_32
441 ${CC} ${CCFLAGS} AdrpLdr-seg-f32.o -dynamiclib -o AdrpLdr-seg-f32.dylib -install_name /usr/lib/libjunk.dylib
442 ${OTOOL} -tV AdrpLdr-seg-f32.dylib | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
443 ${OTOOL} -tV AdrpLdr-seg-f32.dylib | grep 'ldr\ts1, \[x0,' | ${FAIL_IF_EMPTY}
444
445 # test ADRP/LDR -> LDR when target is in __TEXT for 64-bit fp load
446 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-seg-f64.o -DFOO_AS_DATA -DLOAD_FPR_64
447 ${CC} ${CCFLAGS} AdrpLdr-seg-f64.o -dynamiclib -o AdrpLdr-seg-f64.dylib -install_name /usr/lib/libjunk.dylib
448 ${OTOOL} -tV AdrpLdr-seg-f64.dylib | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
449 ${OTOOL} -tV AdrpLdr-seg-f64.dylib | grep 'ldr\td1, \[x0,' | ${FAIL_IF_EMPTY}
450
451 # test ADRP/LDR -> LDR when target is in __TEXT for 128-bit vec load
452 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-seg-v128.o -DFOO_AS_DATA -DLOAD_VEC_128
453 ${CC} ${CCFLAGS} AdrpLdr-seg-v128.o -dynamiclib -o AdrpLdr-seg-v128.dylib -install_name /usr/lib/libjunk.dylib
454 ${OTOOL} -tV AdrpLdr-seg-v128.dylib | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
455 ${OTOOL} -tV AdrpLdr-seg-v128.dylib | grep 'ldr\tq1, \[x0,' | ${FAIL_IF_EMPTY}
456
457 AdrpLdr-addend: main.o
458 # test ADRP/LDR left untouched when target is in __TEXT for 8-bit load
459 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-addend-g8.o -DFOO_AS_DATA -DLOAD_GPR_8 -DADDEND=+8
460 ${CC} ${CCFLAGS} AdrpLdr-addend-g8.o main.o -o AdrpLdr-addend-g8.exe
461 ${OTOOL} -tV AdrpLdr-addend-g8.exe | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
462 ${OTOOL} -tV AdrpLdr-addend-g8.exe | grep 'ldr\tb1, \[x0,' | ${FAIL_IF_EMPTY}
463
464 # test ADRP/LDR left untouched when target is in __TEXT for 16-bit load
465 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-addend-g16.o -DFOO_AS_DATA -DLOAD_GPR_16 -DADDEND=+8
466 ${CC} ${CCFLAGS} AdrpLdr-addend-g16.o main.o -o AdrpLdr-addend-g16.exe
467 ${OTOOL} -tV AdrpLdr-addend-g16.exe | grep 'adrp\tx0,' | ${FAIL_IF_EMPTY}
468 ${OTOOL} -tV AdrpLdr-addend-g16.exe | grep 'ldr\th1, \[x0,' | ${FAIL_IF_EMPTY}
469
470 # test ADRP/LDR -> LDR when target is in __TEXT for 32-bit load
471 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-addend-g32.o -DFOO_AS_DATA -DLOAD_GPR_32 -DADDEND=+8
472 ${CC} ${CCFLAGS} AdrpLdr-addend-g32.o main.o -o AdrpLdr-addend-g32.exe
473 ${OTOOL} -tV AdrpLdr-addend-g32.exe | grep 'ldr w1, _8foo8' | ${FAIL_IF_EMPTY}
474 ${OTOOL} -tV AdrpLdr-addend-g32.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
475 ${OTOOL} -tV AdrpLdr-addend-g32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
476
477 # test ADRP/LDR -> LDR when target is in __TEXT for 64-bit load
478 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-addend-g64.o -DFOO_AS_DATA -DLOAD_GPR_64 -DADDEND=+8
479 ${CC} ${CCFLAGS} AdrpLdr-addend-g64.o main.o -o AdrpLdr-addend-g64.exe
480 ${OTOOL} -tV AdrpLdr-addend-g64.exe | grep 'ldr x1, _8foo8' | ${FAIL_IF_EMPTY}
481 ${OTOOL} -tV AdrpLdr-addend-g64.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
482 ${OTOOL} -tV AdrpLdr-addend-g64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
483
484 # test ADRP/LDR -> LDR when target is in __TEXT for 32-bit fp load
485 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-addend-f32.o -DFOO_AS_DATA -DLOAD_FPR_32 -DADDEND=+8
486 ${CC} ${CCFLAGS} AdrpLdr-addend-f32.o main.o -o AdrpLdr-addend-f32.exe
487 ${OTOOL} -tV AdrpLdr-addend-f32.exe | grep 'ldr s1, _8foo8' | ${FAIL_IF_EMPTY}
488 ${OTOOL} -tV AdrpLdr-addend-f32.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
489 ${OTOOL} -tV AdrpLdr-addend-f32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
490
491 # test ADRP/LDR -> LDR when target is in __TEXT for 64-bit fp load
492 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-addend-f64.o -DFOO_AS_DATA -DLOAD_FPR_64 -DADDEND=+8
493 ${CC} ${CCFLAGS} AdrpLdr-addend-f64.o main.o -o AdrpLdr-addend-f64.exe
494 ${OTOOL} -tV AdrpLdr-addend-f64.exe | grep 'ldr d1, _8foo8' | ${FAIL_IF_EMPTY}
495 ${OTOOL} -tV AdrpLdr-addend-f64.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
496 ${OTOOL} -tV AdrpLdr-addend-f64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
497
498 # test ADRP/LDR -> LDR when target is in __TEXT for 128-bit vec load
499 ${CC} ${CCFLAGS} AdrpLdr.s -c -o AdrpLdr-addend-v128.o -DFOO_AS_DATA -DLOAD_VEC_128 -DADDEND=+16
500 ${CC} ${CCFLAGS} AdrpLdr-addend-v128.o main.o -o AdrpLdr-addend-v128.exe
501 ${OTOOL} -tV AdrpLdr-addend-v128.exe | grep 'ldr q1, _16foo16' | ${FAIL_IF_EMPTY}
502 ${OTOOL} -tV AdrpLdr-addend-v128.exe | grep 'adrp x0' | ${FAIL_IF_STDIN}
503 ${OTOOL} -tV AdrpLdr-addend-v128.exe | grep 'add x0' | ${FAIL_IF_STDIN}
504
505
506 AdrpLdrGotLdr: AdrpLdrGotLdr-extern AdrpLdrGotLdr-externfargot AdrpLdrGotLdr-near AdrpLdrGotLdr-far AdrpLdrGotLdr-nearunaligned AdrpLdrGotLdr-farunaligned
507 true
508
509 AdrpLdrGotLdr-extern: main.o
510 # test ADRP/LDR/LDR -> LDR/LDR when GOT slot is close for 8-bit load
511 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-extern-g8.o -DFOO_AS_CONST -DLOAD_GPR_8 -DTARGET=_malloc
512 ${CC} ${CCFLAGS} AdrpLdrGotLdr-extern-g8.o main.o -o AdrpLdrGotLdr-extern-g8.exe
513 ${OTOOL} -tV AdrpLdrGotLdr-extern-g8.exe | grep 'adrp' | ${FAIL_IF_STDIN}
514 ${OTOOL} -tV AdrpLdrGotLdr-extern-g8.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
515 ${OTOOL} -tV AdrpLdrGotLdr-extern-g8.exe | grep 'ldr\tb2, \[x1\]' | ${FAIL_IF_EMPTY}
516
517 # test ADRP/LDR/LDR -> LDR/LDR when GOT slot is close for 16-bit load
518 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-extern-g16.o -DFOO_AS_CONST -DLOAD_GPR_16 -DTARGET=_malloc
519 ${CC} ${CCFLAGS} AdrpLdrGotLdr-extern-g16.o main.o -o AdrpLdrGotLdr-extern-g16.exe
520 ${OTOOL} -tV AdrpLdrGotLdr-extern-g16.exe | grep 'adrp' | ${FAIL_IF_STDIN}
521 ${OTOOL} -tV AdrpLdrGotLdr-extern-g16.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
522 ${OTOOL} -tV AdrpLdrGotLdr-extern-g16.exe | grep 'ldr\th2, \[x1\]' | ${FAIL_IF_EMPTY}
523
524 # test ADRP/LDR/LDR -> LDR/LDR when GOT slot is close for 32-bit load
525 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-extern-g32.o -DFOO_AS_CONST -DLOAD_GPR_32 -DTARGET=_malloc
526 ${CC} ${CCFLAGS} AdrpLdrGotLdr-extern-g32.o main.o -o AdrpLdrGotLdr-extern-g32.exe
527 ${OTOOL} -tV AdrpLdrGotLdr-extern-g32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
528 ${OTOOL} -tV AdrpLdrGotLdr-extern-g32.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
529 ${OTOOL} -tV AdrpLdrGotLdr-extern-g32.exe | grep 'ldr\tw2, \[x1\]' | ${FAIL_IF_EMPTY}
530
531 # test ADRP/LDR/LDR -> LDR/LDR when GOT slot is close for 64-bit load
532 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-extern-g64.o -DFOO_AS_CONST -DLOAD_GPR_64 -DTARGET=_malloc
533 ${CC} ${CCFLAGS} AdrpLdrGotLdr-extern-g64.o main.o -o AdrpLdrGotLdr-extern-g64.exe
534 ${OTOOL} -tV AdrpLdrGotLdr-extern-g64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
535 ${OTOOL} -tV AdrpLdrGotLdr-extern-g64.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
536 ${OTOOL} -tV AdrpLdrGotLdr-extern-g64.exe | grep 'ldr\tx2, \[x1\]' | ${FAIL_IF_EMPTY}
537
538 # test ADRP/LDR/LDR -> LDR/LDR when GOT slot is close for 32-bit fp load
539 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-extern-f32.o -DFOO_AS_CONST -DLOAD_FPR_32 -DTARGET=_malloc
540 ${CC} ${CCFLAGS} AdrpLdrGotLdr-extern-f32.o main.o -o AdrpLdrGotLdr-extern-f32.exe
541 ${OTOOL} -tV AdrpLdrGotLdr-extern-f32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
542 ${OTOOL} -tV AdrpLdrGotLdr-extern-f32.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
543 ${OTOOL} -tV AdrpLdrGotLdr-extern-f32.exe | grep 'ldr\ts2, \[x1\]' | ${FAIL_IF_EMPTY}
544
545 # test ADRP/LDR/LDR -> LDR/LDR when GOT slot is close for 64-bit fp load
546 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-extern-f64.o -DFOO_AS_CONST -DLOAD_FPR_64 -DTARGET=_malloc
547 ${CC} ${CCFLAGS} AdrpLdrGotLdr-extern-f64.o main.o -o AdrpLdrGotLdr-extern-f64.exe
548 ${OTOOL} -tV AdrpLdrGotLdr-extern-f64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
549 ${OTOOL} -tV AdrpLdrGotLdr-extern-f64.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
550 ${OTOOL} -tV AdrpLdrGotLdr-extern-f64.exe | grep 'ldr\td2, \[x1\]' | ${FAIL_IF_EMPTY}
551
552 # test ADRP/LDR/LDR -> LDR/LDR when GOT slot is close for 128-bit vec load
553 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-extern-v128.o -DFOO_AS_CONST -DLOAD_VEC_128 -DTARGET=_malloc
554 ${CC} ${CCFLAGS} AdrpLdrGotLdr-extern-v128.o main.o -o AdrpLdrGotLdr-extern-v128.exe
555 ${OTOOL} -tV AdrpLdrGotLdr-extern-v128.exe | grep 'adrp' | ${FAIL_IF_STDIN}
556 ${OTOOL} -tV AdrpLdrGotLdr-extern-v128.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
557 ${OTOOL} -tV AdrpLdrGotLdr-extern-v128.exe | grep 'ldr\tq2, \[x1\]' | ${FAIL_IF_EMPTY}
558
559
560 AdrpLdrGotLdr-externfargot: main.o
561 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 8-bit load
562 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-externfargot-g8.o -DFOO_AS_CONST -DLOAD_GPR_8 -DTARGET=_malloc -DPADDING
563 ${CC} ${CCFLAGS} AdrpLdrGotLdr-externfargot-g8.o main.o -o AdrpLdrGotLdr-externfargot-g8.exe
564 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g8.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
565 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g8.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
566 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g8.exe | grep 'ldr\tb2, \[x1\]' | ${FAIL_IF_EMPTY}
567
568 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 16-bit load
569 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-externfargot-g16.o -DFOO_AS_CONST -DLOAD_GPR_16 -DTARGET=_malloc -DPADDING
570 ${CC} ${CCFLAGS} AdrpLdrGotLdr-externfargot-g16.o main.o -o AdrpLdrGotLdr-externfargot-g16.exe
571 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g16.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
572 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g16.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
573 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g16.exe | grep 'ldr\th2, \[x1\]' | ${FAIL_IF_EMPTY}
574
575 # test ADRP/LDR/LDR left untouched when target is external and GOT slot farfor 32-bit load
576 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-externfargot-g32.o -DFOO_AS_CONST -DLOAD_GPR_32 -DTARGET=_malloc -DPADDING
577 ${CC} ${CCFLAGS} AdrpLdrGotLdr-externfargot-g32.o main.o -o AdrpLdrGotLdr-externfargot-g32.exe
578 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g32.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
579 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g32.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
580 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g32.exe | grep 'ldr\tw2, \[x1\]' | ${FAIL_IF_EMPTY}
581
582 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit load
583 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-externfargot-g64.o -DFOO_AS_CONST -DLOAD_GPR_64 -DTARGET=_malloc -DPADDING
584 ${CC} ${CCFLAGS} AdrpLdrGotLdr-externfargot-g64.o main.o -o AdrpLdrGotLdr-externfargot-g64.exe
585 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g64.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
586 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g64.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
587 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-g64.exe | grep 'ldr\tx2, \[x1\]' | ${FAIL_IF_EMPTY}
588
589 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 32-bit fp load
590 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-externfargot-f32.o -DFOO_AS_CONST -DLOAD_FPR_32 -DTARGET=_malloc -DPADDING
591 ${CC} ${CCFLAGS} AdrpLdrGotLdr-externfargot-f32.o main.o -o AdrpLdrGotLdr-externfargot-f32.exe
592 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-f32.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
593 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-f32.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
594 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-f32.exe | grep 'ldr\ts2, \[x1\]' | ${FAIL_IF_EMPTY}
595
596 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit fp load
597 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-externfargot-f64.o -DFOO_AS_CONST -DLOAD_FPR_64 -DTARGET=_malloc -DPADDING
598 ${CC} ${CCFLAGS} AdrpLdrGotLdr-externfargot-f64.o main.o -o AdrpLdrGotLdr-externfargot-f64.exe
599 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-f64.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
600 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-f64.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
601 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-f64.exe | grep 'ldr\td2, \[x1\]' | ${FAIL_IF_EMPTY}
602
603 # test ADRP/LDR/LDR -left untouched when target is external and GOT slot far for 128-bit vec load
604 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-externfargot-v128.o -DFOO_AS_CONST -DLOAD_VEC_128 -DTARGET=_malloc -DPADDING
605 ${CC} ${CCFLAGS} AdrpLdrGotLdr-externfargot-v128.o main.o -o AdrpLdrGotLdr-externfargot-v128.exe
606 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-v128.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
607 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-v128.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
608 ${OTOOL} -tV AdrpLdrGotLdr-externfargot-v128.exe | grep 'ldr\tq2, \[x1\]' | ${FAIL_IF_EMPTY}
609
610
611 AdrpLdrGotLdr-near: main.o
612 # test ADRP/LDR left untouched when target is in __TEXT for 8-bit load
613 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-near-g8.o -DFOO_AS_CONST -DLOAD_GPR_8
614 ${CC} ${CCFLAGS} AdrpLdrGotLdr-near-g8.o main.o -o AdrpLdrGotLdr-near-g8.exe
615 ${OTOOL} -tV AdrpLdrGotLdr-near-g8.exe | grep 'adrp' | ${FAIL_IF_STDIN}
616 ${OTOOL} -tV AdrpLdrGotLdr-near-g8.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
617 ${OTOOL} -tV AdrpLdrGotLdr-near-g8.exe | grep 'ldr\tb2, \[x1\]' | ${FAIL_IF_EMPTY}
618
619 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 16-bit load
620 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-near-g16.o -DFOO_AS_CONST -DLOAD_GPR_16
621 ${CC} ${CCFLAGS} AdrpLdrGotLdr-near-g16.o main.o -o AdrpLdrGotLdr-near-g16.exe
622 ${OTOOL} -tV AdrpLdrGotLdr-near-g16.exe | grep 'adrp' | ${FAIL_IF_STDIN}
623 ${OTOOL} -tV AdrpLdrGotLdr-near-g16.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
624 ${OTOOL} -tV AdrpLdrGotLdr-near-g16.exe | grep 'ldr\th2, \[x1\]' | ${FAIL_IF_EMPTY}
625
626 # test ADRP/LDR/LDR -> LDR literal when target close for 32-bit load
627 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-near-g32.o -DFOO_AS_CONST -DLOAD_GPR_32
628 ${CC} ${CCFLAGS} AdrpLdrGotLdr-near-g32.o main.o -o AdrpLdrGotLdr-near-g32.exe
629 ${OTOOL} -tV AdrpLdrGotLdr-near-g32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
630 ${OTOOL} -tV AdrpLdrGotLdr-near-g32.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_STDIN}
631 ${OTOOL} -tV AdrpLdrGotLdr-near-g32.exe | grep 'ldr\tw2, _foo' | ${FAIL_IF_EMPTY}
632
633 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit load
634 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-near-g64.o -DFOO_AS_CONST -DLOAD_GPR_64
635 ${CC} ${CCFLAGS} AdrpLdrGotLdr-near-g64.o main.o -o AdrpLdrGotLdr-near-g64.exe
636 ${OTOOL} -tV AdrpLdrGotLdr-near-g64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
637 ${OTOOL} -tV AdrpLdrGotLdr-near-g64.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_STDIN}
638 ${OTOOL} -tV AdrpLdrGotLdr-near-g64.exe | grep 'ldr\tx2, _foo' | ${FAIL_IF_EMPTY}
639
640 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 32-bit fp load
641 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-near-f32.o -DFOO_AS_CONST -DLOAD_FPR_32
642 ${CC} ${CCFLAGS} AdrpLdrGotLdr-near-f32.o main.o -o AdrpLdrGotLdr-near-f32.exe
643 ${OTOOL} -tV AdrpLdrGotLdr-near-f32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
644 ${OTOOL} -tV AdrpLdrGotLdr-near-f32.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_STDIN}
645 ${OTOOL} -tV AdrpLdrGotLdr-near-f32.exe | grep 'ldr\ts2, _foo' | ${FAIL_IF_EMPTY}
646
647 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit fp load
648 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-near-f64.o -DFOO_AS_CONST -DLOAD_FPR_64
649 ${CC} ${CCFLAGS} AdrpLdrGotLdr-near-f64.o main.o -o AdrpLdrGotLdr-near-f64.exe
650 ${OTOOL} -tV AdrpLdrGotLdr-near-f64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
651 ${OTOOL} -tV AdrpLdrGotLdr-near-f64.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_STDIN}
652 ${OTOOL} -tV AdrpLdrGotLdr-near-f64.exe | grep 'ldr\td2, _foo' | ${FAIL_IF_EMPTY}
653
654 # test ADRP/LDR/LDR -left untouched when target is external and GOT slot far for 128-bit vec load
655 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-near-v128.o -DFOO_AS_CONST -DLOAD_VEC_128
656 ${CC} ${CCFLAGS} AdrpLdrGotLdr-near-v128.o main.o -o AdrpLdrGotLdr-near-v128.exe
657 ${OTOOL} -tV AdrpLdrGotLdr-near-v128.exe | grep 'adrp' | ${FAIL_IF_STDIN}
658 ${OTOOL} -tV AdrpLdrGotLdr-near-v128.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_STDIN}
659 ${OTOOL} -tV AdrpLdrGotLdr-near-v128.exe | grep 'ldr\tq2, _foo' | ${FAIL_IF_EMPTY}
660
661
662 AdrpLdrGotLdr-nearunaligned: main.o
663 # test ADRP/LDR left untouched when target is in __TEXT for 8-bit load
664 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-nearunaligned-g8.o -DFOO_AS_CONST -DLOAD_GPR_8 -DMISALIGN_DATA
665 ${CC} ${CCFLAGS} AdrpLdrGotLdr-nearunaligned-g8.o main.o -o AdrpLdrGotLdr-nearunaligned-g8.exe
666 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g8.exe | grep 'adrp' | ${FAIL_IF_STDIN}
667 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g8.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
668 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g8.exe | grep 'ldr\tb2, \[x1\]' | ${FAIL_IF_EMPTY}
669
670 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 16-bit load
671 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-nearunaligned-g16.o -DFOO_AS_CONST -DLOAD_GPR_16 -DMISALIGN_DATA
672 ${CC} ${CCFLAGS} AdrpLdrGotLdr-nearunaligned-g16.o main.o -o AdrpLdrGotLdr-nearunaligned-g16.exe
673 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g16.exe | grep 'adrp' | ${FAIL_IF_STDIN}
674 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g16.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
675 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g16.exe | grep 'ldr\th2, \[x1\]' | ${FAIL_IF_EMPTY}
676
677 # test ADRP/LDR/LDR -> LDR literal when target close for 32-bit load
678 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-nearunaligned-g32.o -DFOO_AS_CONST -DLOAD_GPR_32 -DMISALIGN_DATA
679 ${CC} ${CCFLAGS} AdrpLdrGotLdr-nearunaligned-g32.o main.o -o AdrpLdrGotLdr-nearunaligned-g32.exe
680 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
681 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g32.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
682 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g32.exe | grep 'ldr\tw2, \[x1\]' | ${FAIL_IF_EMPTY}
683
684 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit load
685 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-nearunaligned-g64.o -DFOO_AS_CONST -DLOAD_GPR_64 -DMISALIGN_DATA
686 ${CC} ${CCFLAGS} AdrpLdrGotLdr-nearunaligned-g64.o main.o -o AdrpLdrGotLdr-nearunaligned-g64.exe
687 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
688 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g64.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
689 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-g64.exe | grep 'ldr\tx2, \[x1\]' | ${FAIL_IF_EMPTY}
690
691 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 32-bit fp load
692 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-nearunaligned-f32.o -DFOO_AS_CONST -DLOAD_FPR_32 -DMISALIGN_DATA
693 ${CC} ${CCFLAGS} AdrpLdrGotLdr-nearunaligned-f32.o main.o -o AdrpLdrGotLdr-nearunaligned-f32.exe
694 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-f32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
695 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-f32.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
696 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-f32.exe | grep 'ldr\ts2, \[x1\]' | ${FAIL_IF_EMPTY}
697
698 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit fp load
699 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-nearunaligned-f64.o -DFOO_AS_CONST -DLOAD_FPR_64 -DMISALIGN_DATA
700 ${CC} ${CCFLAGS} AdrpLdrGotLdr-nearunaligned-f64.o main.o -o AdrpLdrGotLdr-nearunaligned-f64.exe
701 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-f64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
702 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-f64.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
703 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-f64.exe | grep 'ldr\td2, \[x1\]' | ${FAIL_IF_EMPTY}
704
705 # test ADRP/LDR/LDR -left untouched when target is external and GOT slot far for 128-bit vec load
706 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-nearunaligned-v128.o -DFOO_AS_CONST -DLOAD_VEC_128 -DMISALIGN_DATA
707 ${CC} ${CCFLAGS} AdrpLdrGotLdr-nearunaligned-v128.o main.o -o AdrpLdrGotLdr-nearunaligned-v128.exe
708 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-v128.exe | grep 'adrp' | ${FAIL_IF_STDIN}
709 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-v128.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
710 ${OTOOL} -tV AdrpLdrGotLdr-nearunaligned-v128.exe | grep 'ldr\tq2, \[x1\]' | ${FAIL_IF_EMPTY}
711
712
713 AdrpLdrGotLdr-far: main.o
714 # test ADRP/LDR left untouched when target is in __TEXT for 8-bit load
715 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-far-g8.o -DFOO_AS_CONST -DLOAD_GPR_8 -DPADDING
716 ${CC} ${CCFLAGS} AdrpLdrGotLdr-far-g8.o main.o -o AdrpLdrGotLdr-far-g8.exe
717 ${OTOOL} -tV AdrpLdrGotLdr-far-g8.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
718 ${OTOOL} -tV AdrpLdrGotLdr-far-g8.exe | grep 'add\t' | ${FAIL_IF_STDIN}
719 ${OTOOL} -tV AdrpLdrGotLdr-far-g8.exe | grep 'ldr\tb2, \[x0,' | ${FAIL_IF_EMPTY}
720
721 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 16-bit load
722 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-far-g16.o -DFOO_AS_CONST -DLOAD_GPR_16 -DPADDING
723 ${CC} ${CCFLAGS} AdrpLdrGotLdr-far-g16.o main.o -o AdrpLdrGotLdr-far-g16.exe
724 ${OTOOL} -tV AdrpLdrGotLdr-far-g16.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
725 ${OTOOL} -tV AdrpLdrGotLdr-far-g16.exe | grep 'add\t' | ${FAIL_IF_STDIN}
726 ${OTOOL} -tV AdrpLdrGotLdr-far-g16.exe | grep 'ldr\th2, \[x0,' | ${FAIL_IF_EMPTY}
727
728 # test ADRP/LDR/LDR -> LDR literal when target close for 32-bit load
729 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-far-g32.o -DFOO_AS_CONST -DLOAD_GPR_32 -DPADDING
730 ${CC} ${CCFLAGS} AdrpLdrGotLdr-far-g32.o main.o -o AdrpLdrGotLdr-far-g32.exe
731 ${OTOOL} -tV AdrpLdrGotLdr-far-g32.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
732 ${OTOOL} -tV AdrpLdrGotLdr-far-g32.exe | grep 'add\t' | ${FAIL_IF_STDIN}
733 ${OTOOL} -tV AdrpLdrGotLdr-far-g32.exe | grep 'ldr\tw2, \[x0,' | ${FAIL_IF_EMPTY}
734
735 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit load
736 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-far-g64.o -DFOO_AS_CONST -DLOAD_GPR_64 -DPADDING
737 ${CC} ${CCFLAGS} AdrpLdrGotLdr-far-g64.o main.o -o AdrpLdrGotLdr-far-g64.exe
738 ${OTOOL} -tV AdrpLdrGotLdr-far-g64.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
739 ${OTOOL} -tV AdrpLdrGotLdr-far-g64.exe | grep 'add\t' | ${FAIL_IF_STDIN}
740 ${OTOOL} -tV AdrpLdrGotLdr-far-g64.exe | grep 'ldr\tx2, \[x0,' | ${FAIL_IF_EMPTY}
741
742 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 32-bit fp load
743 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-far-f32.o -DFOO_AS_CONST -DLOAD_FPR_32 -DPADDING
744 ${CC} ${CCFLAGS} AdrpLdrGotLdr-far-f32.o main.o -o AdrpLdrGotLdr-far-f32.exe
745 ${OTOOL} -tV AdrpLdrGotLdr-far-f32.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
746 ${OTOOL} -tV AdrpLdrGotLdr-far-f32.exe | grep 'add\t' | ${FAIL_IF_STDIN}
747 ${OTOOL} -tV AdrpLdrGotLdr-far-f32.exe | grep 'ldr\ts2, \[x0,' | ${FAIL_IF_EMPTY}
748
749 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit fp load
750 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-far-f64.o -DFOO_AS_CONST -DLOAD_FPR_64 -DPADDING
751 ${CC} ${CCFLAGS} AdrpLdrGotLdr-far-f64.o main.o -o AdrpLdrGotLdr-far-f64.exe
752 ${OTOOL} -tV AdrpLdrGotLdr-far-f64.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
753 ${OTOOL} -tV AdrpLdrGotLdr-far-f64.exe | grep 'add\t' | ${FAIL_IF_STDIN}
754 ${OTOOL} -tV AdrpLdrGotLdr-far-f64.exe | grep 'ldr\td2, \[x0,' | ${FAIL_IF_EMPTY}
755
756 # test ADRP/LDR/LDR -left untouched when target is external and GOT slot far for 128-bit vec load
757 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-far-v128.o -DFOO_AS_CONST -DLOAD_VEC_128 -DPADDING
758 ${CC} ${CCFLAGS} AdrpLdrGotLdr-far-v128.o main.o -o AdrpLdrGotLdr-far-v128.exe
759 ${OTOOL} -tV AdrpLdrGotLdr-far-v128.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
760 ${OTOOL} -tV AdrpLdrGotLdr-far-v128.exe | grep 'add\t' | ${FAIL_IF_STDIN}
761 ${OTOOL} -tV AdrpLdrGotLdr-far-v128.exe | grep 'ldr\tq2, \[x0,' | ${FAIL_IF_EMPTY}
762
763
764 AdrpLdrGotLdr-farunaligned: main.o
765 # test ADRP/LDR left untouched when target is in __TEXT for 8-bit load
766 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-farunaligned-g8.o -DFOO_AS_CONST -DLOAD_GPR_8 -DMISALIGN_DATA -DPADDING
767 ${CC} ${CCFLAGS} AdrpLdrGotLdr-farunaligned-g8.o main.o -o AdrpLdrGotLdr-farunaligned-g8.exe
768 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g8.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
769 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g8.exe | grep 'add\t' | ${FAIL_IF_STDIN}
770 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g8.exe | grep 'ldr\tb2, \[x0,' | ${FAIL_IF_EMPTY}
771
772 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 16-bit load
773 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-farunaligned-g16.o -DFOO_AS_CONST -DLOAD_GPR_16 -DMISALIGN_DATA -DPADDING
774 ${CC} ${CCFLAGS} AdrpLdrGotLdr-farunaligned-g16.o main.o -o AdrpLdrGotLdr-farunaligned-g16.exe
775 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g16.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
776 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g16.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
777 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g16.exe | grep 'ldr\th2, \[x1\]' | ${FAIL_IF_EMPTY}
778
779 # test ADRP/LDR/LDR -> LDR literal when target close for 32-bit load
780 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-farunaligned-g32.o -DFOO_AS_CONST -DLOAD_GPR_32 -DMISALIGN_DATA -DPADDING
781 ${CC} ${CCFLAGS} AdrpLdrGotLdr-farunaligned-g32.o main.o -o AdrpLdrGotLdr-farunaligned-g32.exe
782 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g32.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
783 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g32.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
784 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g32.exe | grep 'ldr\tw2, \[x1\]' | ${FAIL_IF_EMPTY}
785
786 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit load
787 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-farunaligned-g64.o -DFOO_AS_CONST -DLOAD_GPR_64 -DMISALIGN_DATA -DPADDING
788 ${CC} ${CCFLAGS} AdrpLdrGotLdr-farunaligned-g64.o main.o -o AdrpLdrGotLdr-farunaligned-g64.exe
789 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g64.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
790 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g64.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
791 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-g64.exe | grep 'ldr\tx2, \[x1\]' | ${FAIL_IF_EMPTY}
792
793 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 32-bit fp load
794 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-farunaligned-f32.o -DFOO_AS_CONST -DLOAD_FPR_32 -DMISALIGN_DATA -DPADDING
795 ${CC} ${CCFLAGS} AdrpLdrGotLdr-farunaligned-f32.o main.o -o AdrpLdrGotLdr-farunaligned-f32.exe
796 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-f32.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
797 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-f32.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
798 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-f32.exe | grep 'ldr\ts2, \[x1\]' | ${FAIL_IF_EMPTY}
799
800 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit fp load
801 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-farunaligned-f64.o -DFOO_AS_CONST -DLOAD_FPR_64 -DMISALIGN_DATA -DPADDING
802 ${CC} ${CCFLAGS} AdrpLdrGotLdr-farunaligned-f64.o main.o -o AdrpLdrGotLdr-farunaligned-f64.exe
803 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-f64.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
804 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-f64.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
805 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-f64.exe | grep 'ldr\td2, \[x1\]' | ${FAIL_IF_EMPTY}
806
807 # test ADRP/LDR/LDR -left untouched when target is external and GOT slot far for 128-bit vec load
808 ${CC} ${CCFLAGS} AdrpLdrGotLdr.s -c -o AdrpLdrGotLdr-farunaligned-v128.o -DFOO_AS_CONST -DLOAD_VEC_128 -DMISALIGN_DATA -DPADDING
809 ${CC} ${CCFLAGS} AdrpLdrGotLdr-farunaligned-v128.o main.o -o AdrpLdrGotLdr-farunaligned-v128.exe
810 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-v128.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
811 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-v128.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
812 ${OTOOL} -tV AdrpLdrGotLdr-farunaligned-v128.exe | grep 'ldr\tq2, \[x1\]' | ${FAIL_IF_EMPTY}
813
814
815 AdrpAddStr: AdrpAddStr-base AdrpAddStr-seg AdrpAddStr-align AdrpAddStr-addend AdrpAddStr-faraddend
816 true
817
818 AdrpAddStr-base: main.o
819 # test ADRP/ADD/STR -> ADR/STR for 8-bit store
820 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-base-g8.o -DLOAD_GPR_8
821 ${CC} ${CCFLAGS} AdrpAddStr-base-g8.o main.o -o AdrpAddStr-base-g8.exe
822 ${OTOOL} -tV AdrpAddStr-base-g8.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
823 ${OTOOL} -tV AdrpAddStr-base-g8.exe | grep 'str\tb1, \[x0\]' | ${FAIL_IF_EMPTY}
824 ${OTOOL} -tV AdrpAddStr-base-g8.exe | grep 'add x0' | ${FAIL_IF_STDIN}
825
826 # test ADRP/ADD/STR -> ADR/STR for 16-bit store
827 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-base-g16.o -DLOAD_GPR_16
828 ${CC} ${CCFLAGS} AdrpAddStr-base-g16.o main.o -o AdrpAddStr-base-g16.exe
829 ${OTOOL} -tV AdrpAddStr-base-g16.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
830 ${OTOOL} -tV AdrpAddStr-base-g16.exe | grep 'str\th1, \[x0\]' | ${FAIL_IF_EMPTY}
831 ${OTOOL} -tV AdrpAddStr-base-g16.exe | grep 'add x0' | ${FAIL_IF_STDIN}
832
833 # test ADRP/ADD/STR -> ADR/STR for 32-bit store
834 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-base-g32.o -DLOAD_GPR_32
835 ${CC} ${CCFLAGS} AdrpAddStr-base-g32.o main.o -o AdrpAddStr-base-g32.exe
836 ${OTOOL} -tV AdrpAddStr-base-g32.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
837 ${OTOOL} -tV AdrpAddStr-base-g32.exe | grep 'str\tw1, \[x0\]' | ${FAIL_IF_EMPTY}
838 ${OTOOL} -tV AdrpAddStr-base-g32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
839
840 # test ADRP/ADD/STR -> ADR/STR for 64-bit store
841 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-base-g64.o -DLOAD_GPR_64
842 ${CC} ${CCFLAGS} AdrpAddStr-base-g64.o main.o -o AdrpAddStr-base-g64.exe
843 ${OTOOL} -tV AdrpAddStr-base-g64.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
844 ${OTOOL} -tV AdrpAddStr-base-g64.exe | grep 'str\tx1, \[x0\]' | ${FAIL_IF_EMPTY}
845 ${OTOOL} -tV AdrpAddStr-base-g64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
846
847 # test ADRP/ADD/STR -> ADR/STR for 32-bit fp store
848 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-base-f32.o -DLOAD_FPR_32
849 ${CC} ${CCFLAGS} AdrpAddStr-base-f32.o main.o -o AdrpAddStr-base-f32.exe
850 ${OTOOL} -tV AdrpAddStr-base-f32.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
851 ${OTOOL} -tV AdrpAddStr-base-f32.exe | grep 'str\ts1, \[x0\]' | ${FAIL_IF_EMPTY}
852 ${OTOOL} -tV AdrpAddStr-base-f32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
853
854 # test ADRP/ADD/STR -> ADR/STR for 64-bit fp store
855 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-base-f64.o -DLOAD_FPR_64
856 ${CC} ${CCFLAGS} AdrpAddStr-base-f64.o main.o -o AdrpAddStr-base-f64.exe
857 ${OTOOL} -tV AdrpAddStr-base-f64.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
858 ${OTOOL} -tV AdrpAddStr-base-f64.exe | grep 'str\td1, \[x0\]' | ${FAIL_IF_EMPTY}
859 ${OTOOL} -tV AdrpAddStr-base-f64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
860
861 # test ADRP/ADD/STR -> ADR/STR for 128-bit vec store
862 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-base-v128.o -DLOAD_VEC_128
863 ${CC} ${CCFLAGS} AdrpAddStr-base-v128.o main.o -o AdrpAddStr-base-v128.exe
864 ${OTOOL} -tV AdrpAddStr-base-v128.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
865 ${OTOOL} -tV AdrpAddStr-base-v128.exe | grep 'str\tq1, \[x0\]' | ${FAIL_IF_EMPTY}
866 ${OTOOL} -tV AdrpAddStr-base-v128.exe | grep 'add x0' | ${FAIL_IF_STDIN}
867
868
869 AdrpAddStr-seg: main.o
870 # test ADRP/ADD/STR -> ADRP/STR for 8-bit store
871 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-seg-g8.o -DLOAD_GPR_8
872 ${CC} ${CCFLAGS} AdrpAddStr-seg-g8.o -o AdrpAddStr-seg-g8.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
873 ${OTOOL} -tV AdrpAddStr-seg-g8.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
874 ${OTOOL} -tV AdrpAddStr-seg-g8.dylib | grep 'str\tb1, \[x0' | ${FAIL_IF_EMPTY}
875 ${OTOOL} -tV AdrpAddStr-seg-g8.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
876
877 # test ADRP/ADD/STR -> ADRP/STR for 16-bit v
878 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-seg-g16.o -DLOAD_GPR_16
879 ${CC} ${CCFLAGS} AdrpAddStr-seg-g16.o -o AdrpAddStr-seg-g16.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
880 ${OTOOL} -tV AdrpAddStr-seg-g16.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
881 ${OTOOL} -tV AdrpAddStr-seg-g16.dylib | grep 'str\th1, \[x0' | ${FAIL_IF_EMPTY}
882 ${OTOOL} -tV AdrpAddStr-seg-g16.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
883
884 # test ADRP/ADD/STR -> ADRP/STR for 32-bit store
885 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-seg-g32.o -DLOAD_GPR_32
886 ${CC} ${CCFLAGS} AdrpAddStr-seg-g32.o -o AdrpAddStr-seg-g32.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
887 ${OTOOL} -tV AdrpAddStr-seg-g32.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
888 ${OTOOL} -tV AdrpAddStr-seg-g32.dylib | grep 'str\tw1, \[x0' | ${FAIL_IF_EMPTY}
889 ${OTOOL} -tV AdrpAddStr-seg-g32.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
890
891 # test ADRP/ADD/STR -> ADRP/STR for 64-bit store
892 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-seg-g64.o -DLOAD_GPR_64
893 ${CC} ${CCFLAGS} AdrpAddStr-seg-g64.o -o AdrpAddStr-seg-g64.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
894 ${OTOOL} -tV AdrpAddStr-seg-g64.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
895 ${OTOOL} -tV AdrpAddStr-seg-g64.dylib | grep 'str\tx1, \[x0' | ${FAIL_IF_EMPTY}
896 ${OTOOL} -tV AdrpAddStr-seg-g64.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
897
898 # test ADRP/ADD/STR -> ADRP/STR for 32-bit fp store
899 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-seg-f32.o -DLOAD_FPR_32
900 ${CC} ${CCFLAGS} AdrpAddStr-seg-f32.o -o AdrpAddStr-seg-f32.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
901 ${OTOOL} -tV AdrpAddStr-seg-f32.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
902 ${OTOOL} -tV AdrpAddStr-seg-f32.dylib | grep 'str\ts1, \[x0' | ${FAIL_IF_EMPTY}
903 ${OTOOL} -tV AdrpAddStr-seg-f32.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
904
905 # test ADRP/ADD/STR -> ADRP/STR for 64-bit fp store
906 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-seg-f64.o -DLOAD_FPR_64
907 ${CC} ${CCFLAGS} AdrpAddStr-seg-f64.o -o AdrpAddStr-seg-f64.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
908 ${OTOOL} -tV AdrpAddStr-seg-f64.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
909 ${OTOOL} -tV AdrpAddStr-seg-f64.dylib | grep 'str\td1, \[x0' | ${FAIL_IF_EMPTY}
910 ${OTOOL} -tV AdrpAddStr-seg-f64.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
911
912 # test ADRP/ADD/STR -> ADRP/STR for 128-bit vec store
913 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-seg-v128.o -DLOAD_VEC_128
914 ${CC} ${CCFLAGS} AdrpAddStr-seg-v128.o -o AdrpAddStr-seg-v128.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
915 ${OTOOL} -tV AdrpAddStr-seg-v128.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
916 ${OTOOL} -tV AdrpAddStr-seg-v128.dylib | grep 'str\tq1, \[x0' | ${FAIL_IF_EMPTY}
917 ${OTOOL} -tV AdrpAddStr-seg-v128.dylib | grep 'add x0' | ${FAIL_IF_STDIN}
918
919
920 AdrpAddStr-align: main.o
921 # test ADRP/ADD/STR -> ADR/STR when target is for 8-bit load
922 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-align-g8.o -DLOAD_GPR_8 -DMISALIGN_DATA
923 ${CC} ${CCFLAGS} AdrpAddStr-align-g8.o main.o -o AdrpAddStr-align-g8.exe
924 ${OTOOL} -tV AdrpAddStr-align-g8.exe | grep 'adr x0,' | ${FAIL_IF_EMPTY}
925 ${OTOOL} -tV AdrpAddStr-align-g8.exe | grep 'str\tb1, \[x0\]' | ${FAIL_IF_EMPTY}
926 ${OTOOL} -tV AdrpAddStr-align-g8.exe | grep 'add x0' | ${FAIL_IF_STDIN}
927
928 # test ADRP/ADD/STR -> ADR/STR when target is not aligned for 16-bit load
929 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-align-g16.o -DLOAD_GPR_16 -DMISALIGN_DATA
930 ${CC} ${CCFLAGS} AdrpAddStr-align-g16.o main.o -o AdrpAddStr-align-g16.exe
931 ${OTOOL} -tV AdrpAddStr-align-g16.exe | grep 'adr x0,' | ${FAIL_IF_EMPTY}
932 ${OTOOL} -tV AdrpAddStr-align-g16.exe | grep 'str h1, \[x0\]' | ${FAIL_IF_EMPTY}
933 ${OTOOL} -tV AdrpAddStr-align-g16.exe | grep 'add x0' | ${FAIL_IF_STDIN}
934
935 # test ADRP/ADD/STR -> ADR/STR when target is not aligned for 32-bit load
936 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-align-g32.o -DLOAD_GPR_32 -DMISALIGN_DATA
937 ${CC} ${CCFLAGS} AdrpAddStr-align-g32.o main.o -o AdrpAddStr-align-g32.exe
938 ${OTOOL} -tV AdrpAddStr-align-g32.exe | grep 'adr x0,' | ${FAIL_IF_EMPTY}
939 ${OTOOL} -tV AdrpAddStr-align-g32.exe | grep 'str w1, \[x0\]' | ${FAIL_IF_EMPTY}
940 ${OTOOL} -tV AdrpAddStr-align-g32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
941
942 # test ADRP/ADD/STR -> ADR/STR when target is not aligned for 64-bit load
943 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-align-g64.o -DLOAD_GPR_64 -DMISALIGN_DATA
944 ${CC} ${CCFLAGS} AdrpAddStr-align-g64.o main.o -o AdrpAddStr-align-g64.exe
945 ${OTOOL} -tV AdrpAddStr-align-g64.exe | grep 'adr x0,' | ${FAIL_IF_EMPTY}
946 ${OTOOL} -tV AdrpAddStr-align-g64.exe | grep 'str x1, \[x0\]' | ${FAIL_IF_EMPTY}
947 ${OTOOL} -tV AdrpAddStr-align-g64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
948
949 # test ADRP/ADD/STR -> ADR/STR when target is not aligned for 32-bit fp load
950 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-align-f32.o -DLOAD_FPR_32 -DMISALIGN_DATA
951 ${CC} ${CCFLAGS} AdrpAddStr-align-f32.o main.o -o AdrpAddStr-align-f32.exe
952 ${OTOOL} -tV AdrpAddStr-align-f32.exe | grep 'adr x0,' | ${FAIL_IF_EMPTY}
953 ${OTOOL} -tV AdrpAddStr-align-f32.exe | grep 'str s1, \[x0\]' | ${FAIL_IF_EMPTY}
954 ${OTOOL} -tV AdrpAddStr-align-f32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
955
956 # test ADRP/ADD/STR -> ADR/STR when target is not aligned for 64-bit fp load
957 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-align-f64.o -DLOAD_FPR_64 -DMISALIGN_DATA
958 ${CC} ${CCFLAGS} AdrpAddStr-align-f64.o main.o -o AdrpAddStr-align-f64.exe
959 ${OTOOL} -tV AdrpAddStr-align-f64.exe | grep 'adr x0,' | ${FAIL_IF_EMPTY}
960 ${OTOOL} -tV AdrpAddStr-align-f64.exe | grep 'str d1, \[x0\]' | ${FAIL_IF_EMPTY}
961 ${OTOOL} -tV AdrpAddStr-align-f64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
962
963 # test ADRP/ADD/STR -> ADR/STR when target is not aligned for 128-bit vec load
964 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-align-v128.o -DLOAD_VEC_128 -DMISALIGN_DATA
965 ${CC} ${CCFLAGS} AdrpAddStr-align-v128.o main.o -o AdrpAddStr-align-v128.exe
966 ${OTOOL} -tV AdrpAddStr-align-v128.exe | grep 'adr x0,' | ${FAIL_IF_EMPTY}
967 ${OTOOL} -tV AdrpAddStr-align-v128.exe | grep 'str q1, \[x0\]' | ${FAIL_IF_EMPTY}
968 ${OTOOL} -tV AdrpAddStr-align-v128.exe | grep 'add x0' | ${FAIL_IF_STDIN}
969
970
971
972 AdrpAddStr-addend:
973 # test ADRP/ADD/STR -> ADRP/LD when target is in __TEXT for 8-bit load
974 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-addend-g8.o -DLOAD_GPR_8 -DADDEND=8
975 ${CC} ${CCFLAGS} AdrpAddStr-addend-g8.o main.o -o AdrpAddStr-addend-g8.exe
976 ${OTOOL} -tV AdrpAddStr-addend-g8.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
977 ${OTOOL} -tV AdrpAddStr-addend-g8.exe | grep 'str\tb1, \[x0\]' | ${FAIL_IF_EMPTY}
978 ${OTOOL} -tV AdrpAddStr-addend-g8.exe | grep 'add x0' | ${FAIL_IF_STDIN}
979
980 # test ADRP/ADD/STR -> ADRP/LD when target is in __TEXT for 16-bit load
981 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-addend-g16.o -DLOAD_GPR_16 -DADDEND=8
982 ${CC} ${CCFLAGS} AdrpAddStr-addend-g16.o main.o -o AdrpAddStr-addend-g16.exe
983 ${OTOOL} -tV AdrpAddStr-addend-g16.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
984 ${OTOOL} -tV AdrpAddStr-addend-g16.exe | grep 'str\th1, \[x0\]' | ${FAIL_IF_EMPTY}
985 ${OTOOL} -tV AdrpAddStr-addend-g16.exe | grep 'add x0' | ${FAIL_IF_STDIN}
986
987 # test ADRP/ADD/STR -> LDR when target is in __TEXT for 32-bit load
988 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-addend-g32.o -DLOAD_GPR_32 -DADDEND=8
989 ${CC} ${CCFLAGS} AdrpAddStr-addend-g32.o main.o -o AdrpAddStr-addend-g32.exe
990 ${OTOOL} -tV AdrpAddStr-addend-g32.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
991 ${OTOOL} -tV AdrpAddStr-addend-g32.exe | grep 'str\tw1, \[x0\]' | ${FAIL_IF_EMPTY}
992 ${OTOOL} -tV AdrpAddStr-addend-g32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
993
994 # test ADRP/ADD/STR -> LDR when target is in __TEXT for 64-bit load
995 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-addend-g64.o -DLOAD_GPR_64 -DADDEND=8
996 ${CC} ${CCFLAGS} AdrpAddStr-addend-g64.o main.o -o AdrpAddStr-addend-g64.exe
997 ${OTOOL} -tV AdrpAddStr-addend-g64.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
998 ${OTOOL} -tV AdrpAddStr-addend-g64.exe | grep 'str\tx1, \[x0\]' | ${FAIL_IF_EMPTY}
999 ${OTOOL} -tV AdrpAddStr-addend-g64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
1000
1001 # test ADRP/ADD/STR -> LDR when target is in __TEXT for 32-bit fp load
1002 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-addend-f32.o -DLOAD_FPR_32 -DADDEND=8
1003 ${CC} ${CCFLAGS} AdrpAddStr-addend-f32.o main.o -o AdrpAddStr-addend-f32.exe
1004 ${OTOOL} -tV AdrpAddStr-addend-f32.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
1005 ${OTOOL} -tV AdrpAddStr-addend-f32.exe | grep 'str\ts1, \[x0\]' | ${FAIL_IF_EMPTY}
1006 ${OTOOL} -tV AdrpAddStr-addend-f32.exe | grep 'add x0' | ${FAIL_IF_STDIN}
1007
1008 # test ADRP/ADD/STR -> LDR when target is in __TEXT for 64-bit fp load
1009 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-addend-f64.o -DLOAD_FPR_64 -DADDEND=8
1010 ${CC} ${CCFLAGS} AdrpAddStr-addend-f64.o main.o -o AdrpAddStr-addend-f64.exe
1011 ${OTOOL} -tV AdrpAddStr-addend-f64.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
1012 ${OTOOL} -tV AdrpAddStr-addend-f64.exe | grep 'str\td1, \[x0\]' | ${FAIL_IF_EMPTY}
1013 ${OTOOL} -tV AdrpAddStr-addend-f64.exe | grep 'add x0' | ${FAIL_IF_STDIN}
1014
1015 # test ADRP/ADD/STR -> LDR when target is in __TEXT for 128-bit vec load
1016 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-addend-v128.o -DLOAD_VEC_128 -DADDEND=16
1017 ${CC} ${CCFLAGS} AdrpAddStr-addend-v128.o main.o -o AdrpAddStr-addend-v128.exe
1018 ${OTOOL} -tV AdrpAddStr-addend-v128.exe | grep 'adr x0' | ${FAIL_IF_EMPTY}
1019 ${OTOOL} -tV AdrpAddStr-addend-v128.exe | grep 'str\tq1, \[x0\]' | ${FAIL_IF_EMPTY}
1020 ${OTOOL} -tV AdrpAddStr-addend-v128.exe | grep 'add x0' | ${FAIL_IF_STDIN}
1021
1022
1023 AdrpAddStr-faraddend:
1024 # test ADRP/ADD/STR -> ADRP/LD when target is in __TEXT for 8-bit load
1025 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-faraddend-g8.o -DLOAD_GPR_8 -DADDEND=8
1026 ${CC} ${CCFLAGS} AdrpAddStr-faraddend-g8.o -o AdrpAddStr-faraddend-g8.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
1027 ${OTOOL} -tV AdrpAddStr-faraddend-g8.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
1028 ${OTOOL} -tV AdrpAddStr-faraddend-g8.dylib | grep 'add x0' | ${FAIL_IF_EMPTY}
1029 ${OTOOL} -tV AdrpAddStr-faraddend-g8.dylib | grep 'str\tb1, \[x0' | ${FAIL_IF_EMPTY}
1030
1031 # test ADRP/ADD/STR -> ADRP/LD when target is in __TEXT for 16-bit load
1032 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-faraddend-g16.o -DLOAD_GPR_16 -DADDEND=8
1033 ${CC} ${CCFLAGS} AdrpAddStr-faraddend-g16.o -o AdrpAddStr-faraddend-g16.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
1034 ${OTOOL} -tV AdrpAddStr-faraddend-g16.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
1035 ${OTOOL} -tV AdrpAddStr-faraddend-g16.dylib | grep 'add x0' | ${FAIL_IF_EMPTY}
1036 ${OTOOL} -tV AdrpAddStr-faraddend-g16.dylib | grep 'str\th1, \[x0' | ${FAIL_IF_EMPTY}
1037
1038 # test ADRP/ADD/STR -> LDR when target is in __TEXT for 32-bit load
1039 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-faraddend-g32.o -DLOAD_GPR_32 -DADDEND=8
1040 ${CC} ${CCFLAGS} AdrpAddStr-faraddend-g32.o -o AdrpAddStr-faraddend-g32.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
1041 ${OTOOL} -tV AdrpAddStr-faraddend-g32.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
1042 ${OTOOL} -tV AdrpAddStr-faraddend-g32.dylib | grep 'add x0' | ${FAIL_IF_EMPTY}
1043 ${OTOOL} -tV AdrpAddStr-faraddend-g32.dylib | grep 'str\tw1, \[x0' | ${FAIL_IF_EMPTY}
1044
1045 # test ADRP/ADD/STR -> LDR when target is in __TEXT for 64-bit load
1046 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-faraddend-g64.o -DLOAD_GPR_64 -DADDEND=8
1047 ${CC} ${CCFLAGS} AdrpAddStr-faraddend-g64.o -o AdrpAddStr-faraddend-g64.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
1048 ${OTOOL} -tV AdrpAddStr-faraddend-g64.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
1049 ${OTOOL} -tV AdrpAddStr-faraddend-g64.dylib | grep 'add x0' | ${FAIL_IF_EMPTY}
1050 ${OTOOL} -tV AdrpAddStr-faraddend-g64.dylib | grep 'str\tx1, \[x0' | ${FAIL_IF_EMPTY}
1051
1052 # test ADRP/ADD/STR -> LDR when target is in __TEXT for 32-bit fp load
1053 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-faraddend-f32.o -DLOAD_FPR_32 -DADDEND=8
1054 ${CC} ${CCFLAGS} AdrpAddStr-faraddend-f32.o -o AdrpAddStr-faraddend-f32.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
1055 ${OTOOL} -tV AdrpAddStr-faraddend-f32.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
1056 ${OTOOL} -tV AdrpAddStr-faraddend-f32.dylib | grep 'add x0' | ${FAIL_IF_EMPTY}
1057 ${OTOOL} -tV AdrpAddStr-faraddend-f32.dylib | grep 'str\ts1, \[x0' | ${FAIL_IF_EMPTY}
1058
1059 # test ADRP/ADD/STR -> LDR when target is in __TEXT for 64-bit fp load
1060 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-faraddend-f64.o -DLOAD_FPR_64 -DADDEND=8
1061 ${CC} ${CCFLAGS} AdrpAddStr-faraddend-f64.o -o AdrpAddStr-faraddend-f64.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
1062 ${OTOOL} -tV AdrpAddStr-faraddend-f64.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
1063 ${OTOOL} -tV AdrpAddStr-faraddend-f64.dylib | grep 'add x0' | ${FAIL_IF_EMPTY}
1064 ${OTOOL} -tV AdrpAddStr-faraddend-f64.dylib | grep 'str\td1, \[x0' | ${FAIL_IF_EMPTY}
1065
1066 # test ADRP/ADD/STR -> LDR when target is in __TEXT for 128-bit vec load
1067 ${CC} ${CCFLAGS} AdrpAddStr.s -c -o AdrpAddStr-faraddend-v128.o -DLOAD_VEC_128 -DADDEND=16
1068 ${CC} ${CCFLAGS} AdrpAddStr-faraddend-v128.o -o AdrpAddStr-faraddend-v128.dylib -dynamiclib -install_name /usr/lib/libjunk.dylib
1069 ${OTOOL} -tV AdrpAddStr-faraddend-v128.dylib | grep 'adrp x0' | ${FAIL_IF_EMPTY}
1070 ${OTOOL} -tV AdrpAddStr-faraddend-v128.dylib | grep 'add x0' | ${FAIL_IF_EMPTY}
1071 ${OTOOL} -tV AdrpAddStr-faraddend-v128.dylib | grep 'str\tq1, \[x0' | ${FAIL_IF_EMPTY}
1072
1073
1074
1075 AdrpLdrGotStr: AdrpLdrGotStr-extern AdrpLdrGotStr-externfargot AdrpLdrGotStr-near AdrpLdrGotStr-far AdrpLdrGotStr-nearunaligned AdrpLdrGotStr-farunaligned
1076 true
1077
1078 AdrpLdrGotStr-extern: main.o
1079 # test ADRP/LDR/LDR -> LDR/STR when GOT slot is close for 8-bit load
1080 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-extern-g8.o -DFOO_AS_CONST -DLOAD_GPR_8 -DTARGET=_malloc
1081 ${CC} ${CCFLAGS} AdrpLdrGotStr-extern-g8.o main.o -o AdrpLdrGotStr-extern-g8.exe
1082 ${OTOOL} -tV AdrpLdrGotStr-extern-g8.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1083 ${OTOOL} -tV AdrpLdrGotStr-extern-g8.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
1084 ${OTOOL} -tV AdrpLdrGotStr-extern-g8.exe | grep 'str\tb2, \[x1\]' | ${FAIL_IF_EMPTY}
1085
1086 # test ADRP/LDR/LDR -> LDR/STR when GOT slot is close for 16-bit load
1087 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-extern-g16.o -DFOO_AS_CONST -DLOAD_GPR_16 -DTARGET=_malloc
1088 ${CC} ${CCFLAGS} AdrpLdrGotStr-extern-g16.o main.o -o AdrpLdrGotStr-extern-g16.exe
1089 ${OTOOL} -tV AdrpLdrGotStr-extern-g16.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1090 ${OTOOL} -tV AdrpLdrGotStr-extern-g16.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
1091 ${OTOOL} -tV AdrpLdrGotStr-extern-g16.exe | grep 'str\th2, \[x1\]' | ${FAIL_IF_EMPTY}
1092
1093 # test ADRP/LDR/LDR -> LDR/STR when GOT slot is close for 32-bit load
1094 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-extern-g32.o -DFOO_AS_CONST -DLOAD_GPR_32 -DTARGET=_malloc
1095 ${CC} ${CCFLAGS} AdrpLdrGotStr-extern-g32.o main.o -o AdrpLdrGotStr-extern-g32.exe
1096 ${OTOOL} -tV AdrpLdrGotStr-extern-g32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1097 ${OTOOL} -tV AdrpLdrGotStr-extern-g32.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
1098 ${OTOOL} -tV AdrpLdrGotStr-extern-g32.exe | grep 'str\tw2, \[x1\]' | ${FAIL_IF_EMPTY}
1099
1100 # test ADRP/LDR/LDR -> LDR/STR when GOT slot is close for 64-bit load
1101 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-extern-g64.o -DFOO_AS_CONST -DLOAD_GPR_64 -DTARGET=_malloc
1102 ${CC} ${CCFLAGS} AdrpLdrGotStr-extern-g64.o main.o -o AdrpLdrGotStr-extern-g64.exe
1103 ${OTOOL} -tV AdrpLdrGotStr-extern-g64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1104 ${OTOOL} -tV AdrpLdrGotStr-extern-g64.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
1105 ${OTOOL} -tV AdrpLdrGotStr-extern-g64.exe | grep 'str\tx2, \[x1\]' | ${FAIL_IF_EMPTY}
1106
1107 # test ADRP/LDR/LDR -> LDR/STR when GOT slot is close for 32-bit fp load
1108 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-extern-f32.o -DFOO_AS_CONST -DLOAD_FPR_32 -DTARGET=_malloc
1109 ${CC} ${CCFLAGS} AdrpLdrGotStr-extern-f32.o main.o -o AdrpLdrGotStr-extern-f32.exe
1110 ${OTOOL} -tV AdrpLdrGotStr-extern-f32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1111 ${OTOOL} -tV AdrpLdrGotStr-extern-f32.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
1112 ${OTOOL} -tV AdrpLdrGotStr-extern-f32.exe | grep 'str\ts2, \[x1\]' | ${FAIL_IF_EMPTY}
1113
1114 # test ADRP/LDR/LDR -> LDR/STR when GOT slot is close for 64-bit fp load
1115 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-extern-f64.o -DFOO_AS_CONST -DLOAD_FPR_64 -DTARGET=_malloc
1116 ${CC} ${CCFLAGS} AdrpLdrGotStr-extern-f64.o main.o -o AdrpLdrGotStr-extern-f64.exe
1117 ${OTOOL} -tV AdrpLdrGotStr-extern-f64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1118 ${OTOOL} -tV AdrpLdrGotStr-extern-f64.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
1119 ${OTOOL} -tV AdrpLdrGotStr-extern-f64.exe | grep 'str\td2, \[x1\]' | ${FAIL_IF_EMPTY}
1120
1121 # test ADRP/LDR/LDR -> LDR/STR when GOT slot is close for 128-bit vec load
1122 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-extern-v128.o -DFOO_AS_CONST -DLOAD_VEC_128 -DTARGET=_malloc
1123 ${CC} ${CCFLAGS} AdrpLdrGotStr-extern-v128.o main.o -o AdrpLdrGotStr-extern-v128.exe
1124 ${OTOOL} -tV AdrpLdrGotStr-extern-v128.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1125 ${OTOOL} -tV AdrpLdrGotStr-extern-v128.exe | grep 'ldr\tx1,' | ${FAIL_IF_EMPTY}
1126 ${OTOOL} -tV AdrpLdrGotStr-extern-v128.exe | grep 'str\tq2, \[x1\]' | ${FAIL_IF_EMPTY}
1127
1128
1129 AdrpLdrGotStr-externfargot: main.o
1130 # test ADRP/LDR/STR left untouched when target is external and GOT slot far for 8-bit load
1131 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-externfargot-g8.o -DFOO_AS_CONST -DLOAD_GPR_8 -DTARGET=_malloc -DPADDING
1132 ${CC} ${CCFLAGS} AdrpLdrGotStr-externfargot-g8.o main.o -o AdrpLdrGotStr-externfargot-g8.exe
1133 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g8.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1134 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g8.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
1135 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g8.exe | grep 'str\tb2, \[x1\]' | ${FAIL_IF_EMPTY}
1136
1137 # test ADRP/LDR/STR left untouched when target is external and GOT slot far for 16-bit load
1138 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-externfargot-g16.o -DFOO_AS_CONST -DLOAD_GPR_16 -DTARGET=_malloc -DPADDING
1139 ${CC} ${CCFLAGS} AdrpLdrGotStr-externfargot-g16.o main.o -o AdrpLdrGotStr-externfargot-g16.exe
1140 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g16.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1141 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g16.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
1142 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g16.exe | grep 'str\th2, \[x1\]' | ${FAIL_IF_EMPTY}
1143
1144 # test ADRP/LDR/STR left untouched when target is external and GOT slot farfor 32-bit load
1145 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-externfargot-g32.o -DFOO_AS_CONST -DLOAD_GPR_32 -DTARGET=_malloc -DPADDING
1146 ${CC} ${CCFLAGS} AdrpLdrGotStr-externfargot-g32.o main.o -o AdrpLdrGotStr-externfargot-g32.exe
1147 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g32.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1148 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g32.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
1149 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g32.exe | grep 'str\tw2, \[x1\]' | ${FAIL_IF_EMPTY}
1150
1151 # test ADRP/LDR/STR left untouched when target is external and GOT slot far for 64-bit load
1152 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-externfargot-g64.o -DFOO_AS_CONST -DLOAD_GPR_64 -DTARGET=_malloc -DPADDING
1153 ${CC} ${CCFLAGS} AdrpLdrGotStr-externfargot-g64.o main.o -o AdrpLdrGotStr-externfargot-g64.exe
1154 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g64.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1155 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g64.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
1156 ${OTOOL} -tV AdrpLdrGotStr-externfargot-g64.exe | grep 'str\tx2, \[x1\]' | ${FAIL_IF_EMPTY}
1157
1158 # test ADRP/LDR/STR left untouched when target is external and GOT slot far for 32-bit fp load
1159 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-externfargot-f32.o -DFOO_AS_CONST -DLOAD_FPR_32 -DTARGET=_malloc -DPADDING
1160 ${CC} ${CCFLAGS} AdrpLdrGotStr-externfargot-f32.o main.o -o AdrpLdrGotStr-externfargot-f32.exe
1161 ${OTOOL} -tV AdrpLdrGotStr-externfargot-f32.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1162 ${OTOOL} -tV AdrpLdrGotStr-externfargot-f32.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
1163 ${OTOOL} -tV AdrpLdrGotStr-externfargot-f32.exe | grep 'str\ts2, \[x1\]' | ${FAIL_IF_EMPTY}
1164
1165 # test ADRP/LDR/STR left untouched when target is external and GOT slot far for 64-bit fp load
1166 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-externfargot-f64.o -DFOO_AS_CONST -DLOAD_FPR_64 -DTARGET=_malloc -DPADDING
1167 ${CC} ${CCFLAGS} AdrpLdrGotStr-externfargot-f64.o main.o -o AdrpLdrGotStr-externfargot-f64.exe
1168 ${OTOOL} -tV AdrpLdrGotStr-externfargot-f64.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1169 ${OTOOL} -tV AdrpLdrGotStr-externfargot-f64.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
1170 ${OTOOL} -tV AdrpLdrGotStr-externfargot-f64.exe | grep 'str\td2, \[x1\]' | ${FAIL_IF_EMPTY}
1171
1172 # test ADRP/LDR/STR -left untouched when target is external and GOT slot far for 128-bit vec load
1173 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-externfargot-v128.o -DFOO_AS_CONST -DLOAD_VEC_128 -DTARGET=_malloc -DPADDING
1174 ${CC} ${CCFLAGS} AdrpLdrGotStr-externfargot-v128.o main.o -o AdrpLdrGotStr-externfargot-v128.exe
1175 ${OTOOL} -tV AdrpLdrGotStr-externfargot-v128.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1176 ${OTOOL} -tV AdrpLdrGotStr-externfargot-v128.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
1177 ${OTOOL} -tV AdrpLdrGotStr-externfargot-v128.exe | grep 'str\tq2, \[x1\]' | ${FAIL_IF_EMPTY}
1178
1179
1180 AdrpLdrGotStr-near: main.o
1181 # test ADRP/LDR/STR -> ADR/STR when target close for 8-bit load
1182 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-near-g8.o -DLOAD_GPR_8
1183 ${CC} ${CCFLAGS} AdrpLdrGotStr-near-g8.o main.o -o AdrpLdrGotStr-near-g8.exe
1184 ${OTOOL} -tV AdrpLdrGotStr-near-g8.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1185 ${OTOOL} -tV AdrpLdrGotStr-near-g8.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
1186 ${OTOOL} -tV AdrpLdrGotStr-near-g8.exe | grep 'str\tb2, \[x1\]' | ${FAIL_IF_EMPTY}
1187
1188 # test ADRP/LDR/STR -> ADR/STR when target close for 16-bit load
1189 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-near-g16.o -DLOAD_GPR_16
1190 ${CC} ${CCFLAGS} AdrpLdrGotStr-near-g16.o main.o -o AdrpLdrGotStr-near-g16.exe
1191 ${OTOOL} -tV AdrpLdrGotStr-near-g16.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1192 ${OTOOL} -tV AdrpLdrGotStr-near-g16.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
1193 ${OTOOL} -tV AdrpLdrGotStr-near-g16.exe | grep 'str\th2, \[x1\]' | ${FAIL_IF_EMPTY}
1194
1195 # test ADRP/LDR/STR -> ADR/STR when target close for 32-bit load
1196 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-near-g32.o -DLOAD_GPR_32
1197 ${CC} ${CCFLAGS} AdrpLdrGotStr-near-g32.o main.o -o AdrpLdrGotStr-near-g32.exe
1198 ${OTOOL} -tV AdrpLdrGotStr-near-g32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1199 ${OTOOL} -tV AdrpLdrGotStr-near-g32.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_STDIN}
1200 ${OTOOL} -tV AdrpLdrGotStr-near-g32.exe | grep 'str\tw2, \[x1\]' | ${FAIL_IF_EMPTY}
1201
1202 # test ADRP/LDR/STR -> ADR/STR when target close for 64-bit load
1203 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-near-g64.o -DLOAD_GPR_64
1204 ${CC} ${CCFLAGS} AdrpLdrGotStr-near-g64.o main.o -o AdrpLdrGotStr-near-g64.exe
1205 ${OTOOL} -tV AdrpLdrGotStr-near-g64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1206 ${OTOOL} -tV AdrpLdrGotStr-near-g64.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_STDIN}
1207 ${OTOOL} -tV AdrpLdrGotStr-near-g64.exe | grep 'str\tx2, \[x1\]' | ${FAIL_IF_EMPTY}
1208
1209 # test ADRP/LDR/STR -> ADR/STR when target close for 32-bit fp load
1210 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-near-f32.o -DLOAD_FPR_32
1211 ${CC} ${CCFLAGS} AdrpLdrGotStr-near-f32.o main.o -o AdrpLdrGotStr-near-f32.exe
1212 ${OTOOL} -tV AdrpLdrGotStr-near-f32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1213 ${OTOOL} -tV AdrpLdrGotStr-near-f32.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_STDIN}
1214 ${OTOOL} -tV AdrpLdrGotStr-near-f32.exe | grep 'str\ts2, \[x1\]' | ${FAIL_IF_EMPTY}
1215
1216 # test ADRP/LDR/STR -> ADR/STR when target close for 64-bit fp load
1217 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-near-f64.o -DLOAD_FPR_64
1218 ${CC} ${CCFLAGS} AdrpLdrGotStr-near-f64.o main.o -o AdrpLdrGotStr-near-f64.exe
1219 ${OTOOL} -tV AdrpLdrGotStr-near-f64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1220 ${OTOOL} -tV AdrpLdrGotStr-near-f64.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_STDIN}
1221 ${OTOOL} -tV AdrpLdrGotStr-near-f64.exe | grep 'str\td2, \[x1\]' | ${FAIL_IF_EMPTY}
1222
1223 # test ADRP/LDR/STR -> ADR/STR when target close for 128-bit vec load
1224 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-near-v128.o -DLOAD_VEC_128
1225 ${CC} ${CCFLAGS} AdrpLdrGotStr-near-v128.o main.o -o AdrpLdrGotStr-near-v128.exe
1226 ${OTOOL} -tV AdrpLdrGotStr-near-v128.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1227 ${OTOOL} -tV AdrpLdrGotStr-near-v128.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_STDIN}
1228 ${OTOOL} -tV AdrpLdrGotStr-near-v128.exe | grep 'str\tq2, \[x1\]' | ${FAIL_IF_EMPTY}
1229
1230
1231 AdrpLdrGotStr-nearunaligned: main.o
1232 # test ADRP/LDR left untouched when target is in __TEXT for 8-bit load
1233 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-nearunaligned-g8.o -DLOAD_GPR_8 -DMISALIGN_DATA
1234 ${CC} ${CCFLAGS} AdrpLdrGotStr-nearunaligned-g8.o main.o -o AdrpLdrGotStr-nearunaligned-g8.exe
1235 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g8.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1236 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g8.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
1237 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g8.exe | grep 'str\tb2, \[x1\]' | ${FAIL_IF_EMPTY}
1238
1239 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 16-bit load
1240 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-nearunaligned-g16.o -DLOAD_GPR_16 -DMISALIGN_DATA
1241 ${CC} ${CCFLAGS} AdrpLdrGotStr-nearunaligned-g16.o main.o -o AdrpLdrGotStr-nearunaligned-g16.exe
1242 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g16.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1243 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g16.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
1244 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g16.exe | grep 'str\th2, \[x1\]' | ${FAIL_IF_EMPTY}
1245
1246 # test ADRP/LDR/LDR -> LDR literal when target close for 32-bit load
1247 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-nearunaligned-g32.o -DLOAD_GPR_32 -DMISALIGN_DATA
1248 ${CC} ${CCFLAGS} AdrpLdrGotStr-nearunaligned-g32.o main.o -o AdrpLdrGotStr-nearunaligned-g32.exe
1249 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1250 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g32.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
1251 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g32.exe | grep 'str\tw2, \[x1\]' | ${FAIL_IF_EMPTY}
1252
1253 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit load
1254 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-nearunaligned-g64.o -DLOAD_GPR_64 -DMISALIGN_DATA
1255 ${CC} ${CCFLAGS} AdrpLdrGotStr-nearunaligned-g64.o main.o -o AdrpLdrGotStr-nearunaligned-g64.exe
1256 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1257 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g64.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
1258 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-g64.exe | grep 'str\tx2, \[x1\]' | ${FAIL_IF_EMPTY}
1259
1260 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 32-bit fp load
1261 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-nearunaligned-f32.o -DLOAD_FPR_32 -DMISALIGN_DATA
1262 ${CC} ${CCFLAGS} AdrpLdrGotStr-nearunaligned-f32.o main.o -o AdrpLdrGotStr-nearunaligned-f32.exe
1263 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-f32.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1264 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-f32.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
1265 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-f32.exe | grep 'str\ts2, \[x1\]' | ${FAIL_IF_EMPTY}
1266
1267 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit fp load
1268 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-nearunaligned-f64.o -DLOAD_FPR_64 -DMISALIGN_DATA
1269 ${CC} ${CCFLAGS} AdrpLdrGotStr-nearunaligned-f64.o main.o -o AdrpLdrGotStr-nearunaligned-f64.exe
1270 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-f64.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1271 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-f64.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
1272 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-f64.exe | grep 'str\td2, \[x1\]' | ${FAIL_IF_EMPTY}
1273
1274 # test ADRP/LDR/LDR -left untouched when target is external and GOT slot far for 128-bit vec load
1275 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-nearunaligned-v128.o -DLOAD_VEC_128 -DMISALIGN_DATA
1276 ${CC} ${CCFLAGS} AdrpLdrGotStr-nearunaligned-v128.o main.o -o AdrpLdrGotStr-nearunaligned-v128.exe
1277 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-v128.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1278 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-v128.exe | grep 'adr\tx1,' | ${FAIL_IF_EMPTY}
1279 ${OTOOL} -tV AdrpLdrGotStr-nearunaligned-v128.exe | grep 'str\tq2, \[x1\]' | ${FAIL_IF_EMPTY}
1280
1281
1282 AdrpLdrGotStr-far: main.o
1283 # test ADRP/LDR left untouched when target is in __TEXT for 8-bit load
1284 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-far-g8.o -DFOO_AS_CONST -DLOAD_GPR_8 -DPADDING
1285 ${CC} ${CCFLAGS} AdrpLdrGotStr-far-g8.o main.o -o AdrpLdrGotStr-far-g8.exe
1286 ${OTOOL} -tV AdrpLdrGotStr-far-g8.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
1287 ${OTOOL} -tV AdrpLdrGotStr-far-g8.exe | grep 'add\t' | ${FAIL_IF_STDIN}
1288 ${OTOOL} -tV AdrpLdrGotStr-far-g8.exe | grep 'str\tb2, \[x0,' | ${FAIL_IF_EMPTY}
1289
1290 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 16-bit load
1291 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-far-g16.o -DFOO_AS_CONST -DLOAD_GPR_16 -DPADDING
1292 ${CC} ${CCFLAGS} AdrpLdrGotStr-far-g16.o main.o -o AdrpLdrGotStr-far-g16.exe
1293 ${OTOOL} -tV AdrpLdrGotStr-far-g16.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
1294 ${OTOOL} -tV AdrpLdrGotStr-far-g16.exe | grep 'add\t' | ${FAIL_IF_STDIN}
1295 ${OTOOL} -tV AdrpLdrGotStr-far-g16.exe | grep 'str\th2, \[x0,' | ${FAIL_IF_EMPTY}
1296
1297 # test ADRP/LDR/LDR -> LDR literal when target close for 32-bit load
1298 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-far-g32.o -DFOO_AS_CONST -DLOAD_GPR_32 -DPADDING
1299 ${CC} ${CCFLAGS} AdrpLdrGotStr-far-g32.o main.o -o AdrpLdrGotStr-far-g32.exe
1300 ${OTOOL} -tV AdrpLdrGotStr-far-g32.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
1301 ${OTOOL} -tV AdrpLdrGotStr-far-g32.exe | grep 'add\t' | ${FAIL_IF_STDIN}
1302 ${OTOOL} -tV AdrpLdrGotStr-far-g32.exe | grep 'str\tw2, \[x0,' | ${FAIL_IF_EMPTY}
1303
1304 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit load
1305 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-far-g64.o -DFOO_AS_CONST -DLOAD_GPR_64 -DPADDING
1306 ${CC} ${CCFLAGS} AdrpLdrGotStr-far-g64.o main.o -o AdrpLdrGotStr-far-g64.exe
1307 ${OTOOL} -tV AdrpLdrGotStr-far-g64.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
1308 ${OTOOL} -tV AdrpLdrGotStr-far-g64.exe | grep 'add\t' | ${FAIL_IF_STDIN}
1309 ${OTOOL} -tV AdrpLdrGotStr-far-g64.exe | grep 'str\tx2, \[x0,' | ${FAIL_IF_EMPTY}
1310
1311 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 32-bit fp load
1312 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-far-f32.o -DFOO_AS_CONST -DLOAD_FPR_32 -DPADDING
1313 ${CC} ${CCFLAGS} AdrpLdrGotStr-far-f32.o main.o -o AdrpLdrGotStr-far-f32.exe
1314 ${OTOOL} -tV AdrpLdrGotStr-far-f32.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
1315 ${OTOOL} -tV AdrpLdrGotStr-far-f32.exe | grep 'add\t' | ${FAIL_IF_STDIN}
1316 ${OTOOL} -tV AdrpLdrGotStr-far-f32.exe | grep 'str\ts2, \[x0,' | ${FAIL_IF_EMPTY}
1317
1318 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit fp load
1319 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-far-f64.o -DFOO_AS_CONST -DLOAD_FPR_64 -DPADDING
1320 ${CC} ${CCFLAGS} AdrpLdrGotStr-far-f64.o main.o -o AdrpLdrGotStr-far-f64.exe
1321 ${OTOOL} -tV AdrpLdrGotStr-far-f64.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
1322 ${OTOOL} -tV AdrpLdrGotStr-far-f64.exe | grep 'add\t' | ${FAIL_IF_STDIN}
1323 ${OTOOL} -tV AdrpLdrGotStr-far-f64.exe | grep 'str\td2, \[x0,' | ${FAIL_IF_EMPTY}
1324
1325 # test ADRP/LDR/LDR -left untouched when target is external and GOT slot far for 128-bit vec load
1326 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-far-v128.o -DFOO_AS_CONST -DLOAD_VEC_128 -DPADDING
1327 ${CC} ${CCFLAGS} AdrpLdrGotStr-far-v128.o main.o -o AdrpLdrGotStr-far-v128.exe
1328 ${OTOOL} -tV AdrpLdrGotStr-far-v128.exe | grep 'adrp\tx0' | ${FAIL_IF_EMPTY}
1329 ${OTOOL} -tV AdrpLdrGotStr-far-v128.exe | grep 'add\t' | ${FAIL_IF_STDIN}
1330 ${OTOOL} -tV AdrpLdrGotStr-far-v128.exe | grep 'str\tq2, \[x0,' | ${FAIL_IF_EMPTY}
1331
1332
1333 AdrpLdrGotStr-farunaligned: main.o
1334 # test ADRP/LDR left untouched when target is in __TEXT for 8-bit load
1335 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-farunaligned-g8.o -DLOAD_GPR_8 -DMISALIGN_DATA -DPADDING
1336 ${CC} ${CCFLAGS} AdrpLdrGotStr-farunaligned-g8.o main.o -o AdrpLdrGotStr-farunaligned-g8.exe
1337 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g8.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1338 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g8.exe | grep 'add\t' | ${FAIL_IF_STDIN}
1339 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g8.exe | grep 'str\tb2, \[x0,' | ${FAIL_IF_EMPTY}
1340
1341 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 16-bit load
1342 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-farunaligned-g16.o -DLOAD_GPR_16 -DMISALIGN_DATA -DPADDING
1343 ${CC} ${CCFLAGS} AdrpLdrGotStr-farunaligned-g16.o main.o -o AdrpLdrGotStr-farunaligned-g16.exe
1344 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g16.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1345 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g16.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
1346 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g16.exe | grep 'str\th2, \[x1\]' | ${FAIL_IF_EMPTY}
1347
1348 # test ADRP/LDR/LDR -> LDR literal when target close for 32-bit load
1349 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-farunaligned-g32.o -DLOAD_GPR_32 -DMISALIGN_DATA -DPADDING
1350 ${CC} ${CCFLAGS} AdrpLdrGotStr-farunaligned-g32.o main.o -o AdrpLdrGotStr-farunaligned-g32.exe
1351 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g32.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1352 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g32.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
1353 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g32.exe | grep 'str\tw2, \[x1\]' | ${FAIL_IF_EMPTY}
1354
1355 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit load
1356 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-farunaligned-g64.o -DLOAD_GPR_64 -DMISALIGN_DATA -DPADDING
1357 ${CC} ${CCFLAGS} AdrpLdrGotStr-farunaligned-g64.o main.o -o AdrpLdrGotStr-farunaligned-g64.exe
1358 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g64.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1359 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g64.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
1360 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-g64.exe | grep 'str\tx2, \[x1\]' | ${FAIL_IF_EMPTY}
1361
1362 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 32-bit fp load
1363 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-farunaligned-f32.o -DLOAD_FPR_32 -DMISALIGN_DATA -DPADDING
1364 ${CC} ${CCFLAGS} AdrpLdrGotStr-farunaligned-f32.o main.o -o AdrpLdrGotStr-farunaligned-f32.exe
1365 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-f32.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1366 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-f32.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
1367 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-f32.exe | grep 'str\ts2, \[x1\]' | ${FAIL_IF_EMPTY}
1368
1369 # test ADRP/LDR/LDR left untouched when target is external and GOT slot far for 64-bit fp load
1370 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-farunaligned-f64.o -DLOAD_FPR_64 -DMISALIGN_DATA -DPADDING
1371 ${CC} ${CCFLAGS} AdrpLdrGotStr-farunaligned-f64.o main.o -o AdrpLdrGotStr-farunaligned-f64.exe
1372 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-f64.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1373 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-f64.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
1374 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-f64.exe | grep 'str\td2, \[x1\]' | ${FAIL_IF_EMPTY}
1375
1376 # test ADRP/LDR/LDR -left untouched when target is external and GOT slot far for 128-bit vec load
1377 ${CC} ${CCFLAGS} AdrpLdrGotStr.s -c -o AdrpLdrGotStr-farunaligned-v128.o -DLOAD_VEC_128 -DMISALIGN_DATA -DPADDING
1378 ${CC} ${CCFLAGS} AdrpLdrGotStr-farunaligned-v128.o main.o -o AdrpLdrGotStr-farunaligned-v128.exe
1379 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-v128.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1380 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-v128.exe | grep 'add\t' | ${FAIL_IF_EMPTY}
1381 ${OTOOL} -tV AdrpLdrGotStr-farunaligned-v128.exe | grep 'str\tq2, \[x1\]' | ${FAIL_IF_EMPTY}
1382
1383
1384 AdrpLdrGot: main.o
1385 # test ADRP/LDR left untouched when target is extern and GOT is far
1386 ${CC} ${CCFLAGS} AdrpLdrGot.s -c -o AdrpLdrGot-externfar.o -DPADDING
1387 ${CC} ${CCFLAGS} AdrpLdrGot-externfar.o main.o -o AdrpLdrGot-externfar.exe
1388 ${OTOOL} -tV AdrpLdrGot-externfar.exe | grep 'adrp' | ${FAIL_IF_EMPTY}
1389 ${OTOOL} -tV AdrpLdrGot-externfar.exe | grep 'ldr\tx1, \[x0' | ${FAIL_IF_EMPTY}
1390
1391 # test ADRP/LDR -> NOP/LDR literal when target is exern and GOT is near
1392 ${CC} ${CCFLAGS} AdrpLdrGot.s -c -o AdrpLdrGot-externnear.o
1393 ${CC} ${CCFLAGS} AdrpLdrGot-externnear.o main.o -o AdrpLdrGot-externnear.exe
1394 ${OTOOL} -tV AdrpLdrGot-externnear.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1395 ${OTOOL} -tV AdrpLdrGot-externnear.exe | grep 'ldr\tx1' | ${FAIL_IF_EMPTY}
1396
1397 # test ADRP/LDR -> ADR when target is local, near code
1398 ${CC} ${CCFLAGS} AdrpLdrGot.s -c -o AdrpLdrGot-localnear.o -DTARGET=_fooCode
1399 ${CC} ${CCFLAGS} AdrpLdrGot-localnear.o main.o -o AdrpLdrGot-localnear.exe
1400 ${OTOOL} -tV AdrpLdrGot-localnear.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1401 ${OTOOL} -tV AdrpLdrGot-localnear.exe | grep 'adr\tx1' | ${FAIL_IF_EMPTY}
1402
1403 # test ADRP/LDR -> ADR when target is local, near data
1404 ${CC} ${CCFLAGS} AdrpLdrGot.s -c -o AdrpLdrGot-localnear2.o -DTARGET=_fooData
1405 ${CC} ${CCFLAGS} AdrpLdrGot-localnear2.o main.o -o AdrpLdrGot-localnear2.exe
1406 ${OTOOL} -tV AdrpLdrGot-localnear2.exe | grep 'adrp' | ${FAIL_IF_STDIN}
1407 ${OTOOL} -tV AdrpLdrGot-localnear2.exe | grep 'adr\tx1' | ${FAIL_IF_EMPTY}
1408
1409 # test ADRP/LDR -> ADR when target is local, far code
1410 ${CC} ${CCFLAGS} AdrpLdrGot.s -c -o AdrpLdrGot-localfar.o -DTARGET=_fooCode -DPADDING=1
1411 ${CC} ${CCFLAGS} AdrpLdrGot-localfar.o main.o -o AdrpLdrGot-localfar.exe
1412 ${OTOOL} -tV AdrpLdrGot-localfar.exe | grep 'adrp\tx1' | ${FAIL_IF_EMPTY}
1413 ${OTOOL} -tV AdrpLdrGot-localfar.exe | grep 'add\tx1' | ${FAIL_IF_EMPTY}
1414
1415
1416
1417 clean:
1418 rm -f *.o *.exe *.dylib