aarch64.inc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2014 by Jonas Maebe, member of
  4. the Free Pascal development team.
  5. Processor dependent implementation for the system unit for
  6. AArch64
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. {$IFNDEF LINUX}
  14. {$DEFINE USE_DCBZ}
  15. {$ENDIF LINUX}
  16. {****************************************************************************
  17. AArch64 specific stuff
  18. ****************************************************************************}
  19. const
  20. fpu_ioe = 1 shl 8;
  21. fpu_dze = 1 shl 9;
  22. fpu_ofe = 1 shl 10;
  23. fpu_ufe = 1 shl 11;
  24. fpu_ixe = 1 shl 12;
  25. fpu_ide = 1 shl 15;
  26. fpu_exception_mask = fpu_ioe or fpu_dze or fpu_ofe or fpu_ufe or fpu_ixe or fpu_ide;
  27. fpu_exception_mask_to_status_mask_shift = 8;
  28. function getfpcr: qword; nostackframe; assembler;
  29. asm
  30. mrs x0,fpcr
  31. end;
  32. procedure setfpcr(val: qword);
  33. begin
  34. asm
  35. ldr x0,val
  36. msr fpcr,x0
  37. {$if not defined(darwin) or defined(ios) or defined(watchos) or defined(tvos)}
  38. // read back the fpcr because on several (non-macOS) platforms it's raz
  39. mrs x0,fpcr
  40. str x0, val
  41. {$endif}
  42. end;
  43. DefaultFPUControlWord:=val;
  44. end;
  45. function getfpsr: qword; nostackframe; assembler;
  46. asm
  47. mrs x0,fpsr
  48. end;
  49. function GetNativeFPUControlWord: TNativeFPUControlWord;
  50. begin
  51. result:=getfpcr;
  52. end;
  53. procedure SetNativeFPUControlWord(const cw: TNativeFPUControlWord);
  54. begin
  55. setfpcr(cw);
  56. end;
  57. procedure setfpsr(val: qword); nostackframe; assembler;
  58. asm
  59. msr fpsr, x0
  60. end;
  61. const
  62. FPSR_IOC = 1;
  63. FPSR_DZC = 1 shl 1;
  64. FPSR_OFC = 1 shl 2;
  65. FPSR_UFC = 1 shl 3;
  66. FPSR_IXC = 1 shl 4;
  67. FPSR_IDC = 1 shl 7;
  68. FPSR_EXCEPTIONS = FPSR_IOC or FPSR_DZC or FPSR_OFC or FPSR_UFC or FPSR_IXC or FPSR_IDC;
  69. procedure RaisePendingExceptions;
  70. var
  71. fpsr : qword;
  72. f: TFPUException;
  73. begin
  74. fpsr:=getfpsr;
  75. if (fpsr and FPSR_DZC) <> 0 then
  76. float_raise(exZeroDivide);
  77. if (fpsr and FPSR_OFC) <> 0 then
  78. float_raise(exOverflow);
  79. if (fpsr and FPSR_UFC) <> 0 then
  80. float_raise(exUnderflow);
  81. if (fpsr and FPSR_IOC) <> 0 then
  82. float_raise(exInvalidOp);
  83. if (fpsr and FPSR_IXC) <> 0 then
  84. float_raise(exPrecision);
  85. if (fpsr and FPSR_IDC) <> 0 then
  86. float_raise(exDenormalized);
  87. { now the soft float exceptions }
  88. for f in softfloat_exception_flags do
  89. float_raise(f);
  90. end;
  91. { as so far no AArch64 flavour which supports hard floating point exceptions, we use solely
  92. the softfloat_exception_mask for masking as the masking flags are RAZ and WI if floating point
  93. exceptions are not supported }
  94. procedure fpc_throwfpuexception;[public,alias:'FPC_THROWFPUEXCEPTION'];
  95. var
  96. fpsr : qword;
  97. f: TFPUException;
  98. begin
  99. { at this point, we know already, that an exception will be risen }
  100. fpsr:=getfpsr;
  101. { check, if the exception is masked }
  102. if ((fpsr and FPSR_DZC) <> 0) and (exZeroDivide in softfloat_exception_mask) then
  103. fpsr:=fpsr and not(FPSR_DZC);
  104. if ((fpsr and FPSR_OFC) <> 0) and (exOverflow in softfloat_exception_mask) then
  105. fpsr:=fpsr and not(FPSR_OFC);
  106. if ((fpsr and FPSR_UFC) <> 0) and (exUnderflow in softfloat_exception_mask) then
  107. fpsr:=fpsr and not(FPSR_UFC);
  108. if ((fpsr and FPSR_IOC) <> 0) and (exInvalidOp in softfloat_exception_mask) then
  109. fpsr:=fpsr and not(FPSR_IOC);
  110. if ((fpsr and FPSR_IXC) <> 0) and (exPrecision in softfloat_exception_mask) then
  111. fpsr:=fpsr and not(FPSR_IXC);
  112. if ((fpsr and FPSR_IDC) <> 0) and (exDenormalized in softfloat_exception_mask) then
  113. fpsr:=fpsr and not(FPSR_IDC);
  114. setfpsr(fpsr);
  115. if (fpsr and FPSR_EXCEPTIONS)<>0 then
  116. RaisePendingExceptions;
  117. end;
  118. {$define FPC_SYSTEM_HAS_SYSINITFPU}
  119. procedure SysInitFPU;
  120. begin
  121. softfloat_rounding_mode:=rmNearest;
  122. { 0 is rmNearest }
  123. setfpcr(getfpcr and $ff3fffff);
  124. { clear all "exception happened" flags we care about}
  125. setfpsr(getfpsr and not(fpu_exception_mask shr fpu_exception_mask_to_status_mask_shift));
  126. { enable invalid operations, overflow and division by zero exceptions. }
  127. setfpcr(((getfpcr and not(fpu_exception_mask)) or fpu_dze or fpu_ofe or fpu_ioe));
  128. softfloat_exception_mask:=[float_flag_underflow,float_flag_inexact,float_flag_denormal];
  129. softfloat_exception_flags:=[];
  130. end;
  131. {$define FPC_SYSTEM_HAS_SYSRESETFPU}
  132. Procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
  133. begin
  134. softfloat_exception_flags:=[];
  135. { clear all "exception happened" flags we care about}
  136. setfpsr(getfpsr and not(fpu_exception_mask shr fpu_exception_mask_to_status_mask_shift));
  137. end;
  138. {****************************************************************************
  139. Move / Fill
  140. ****************************************************************************}
  141. {****************************************************************************
  142. String
  143. ****************************************************************************}
  144. {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
  145. function get_caller_addr(framebp:pointer;addr:pointer=nil):pointer;assembler; nostackframe;
  146. asm
  147. cbz x0, .Lcaller_addr_invalid
  148. {$ifdef cpullvm}
  149. movn w1, #0
  150. cmp x0, x1
  151. csel x0, xzr, x0, ls
  152. b.ls .Lcaller_addr_invalid
  153. {$endif cpullvm}
  154. ldur x0, [x0, #8]
  155. .Lcaller_addr_invalid:
  156. end;
  157. {$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
  158. function get_caller_frame(framebp:pointer;addr:pointer=nil):pointer;assembler; nostackframe;
  159. asm
  160. cbz x0, .Lcaller_addr_invalid
  161. ldur x0, [x0]
  162. .Lcaller_addr_invalid:
  163. end;
  164. {$define FPC_SYSTEM_HAS_SPTR}
  165. Function Sptr : Pointer;assembler; nostackframe;
  166. asm
  167. mov x0, sp
  168. end;
  169. {****************************************************************************
  170. Str()
  171. ****************************************************************************}
  172. { int_str: generic implementation is used for now }
  173. {****************************************************************************
  174. Multithreading
  175. ****************************************************************************}
  176. { perform a thread-safe inc/dec }
  177. {$define FPC_SYSTEM_HAS_DECLOCKED_LONGINT}
  178. function declocked(var l : longint) : boolean;assembler;nostackframe;
  179. { input: address of l in x0 }
  180. { output: boolean indicating whether l is zero after decrementing }
  181. asm
  182. {$ifdef CPUAARCH64_HAS_LSE}
  183. mov w1,#-1
  184. ldadd w1,w2,[x0]
  185. adds w2,w2,w1
  186. cset w0,eq
  187. {$else CPUAARCH64_HAS_LSE}
  188. .LDecLockedLoop:
  189. ldxr w1,[x0]
  190. subs w1,w1,#1
  191. stxr w2,w1,[x0]
  192. cbnz w2,.LDecLockedLoop
  193. cset w0, eq
  194. {$endif CPUAARCH64_HAS_LSE}
  195. end;
  196. {$define FPC_SYSTEM_HAS_INCLOCKED_LONGINT}
  197. procedure inclocked(var l : longint);assembler;nostackframe;
  198. asm
  199. {$ifdef CPUAARCH64_HAS_LSE}
  200. mov w1,#1
  201. ldadd w1,w2,[x0]
  202. {$else CPUAARCH64_HAS_LSE}
  203. .LIncLockedLoop:
  204. ldxr w1,[x0]
  205. add w1,w1,#1
  206. stxr w2,w1,[x0]
  207. cbnz w2,.LIncLockedLoop
  208. {$endif CPUAARCH64_HAS_LSE}
  209. end;
  210. {$define FPC_SYSTEM_HAS_DECLOCKED_INT64}
  211. function declocked(var l : int64) : boolean;assembler;nostackframe;
  212. { input: address of l in x0 }
  213. { output: boolean indicating whether l is zero after decrementing }
  214. asm
  215. {$ifdef CPUAARCH64_HAS_LSE}
  216. mov x1,#-1
  217. ldadd x1,x2,[x0]
  218. adds x2,x2,x1
  219. cset w0,eq
  220. {$else CPUAARCH64_HAS_LSE}
  221. .LDecLockedLoop:
  222. ldxr x1,[x0]
  223. subs x1,x1,#1
  224. stxr w2,x1,[x0]
  225. cbnz w2,.LDecLockedLoop
  226. cset w0, eq
  227. {$endif CPUAARCH64_HAS_LSE}
  228. end;
  229. {$define FPC_SYSTEM_HAS_INCLOCKED_INT64}
  230. procedure inclocked(var l : int64);assembler;nostackframe;
  231. asm
  232. {$ifdef CPUAARCH64_HAS_LSE}
  233. mov x1,#1
  234. ldadd x1,x2,[x0]
  235. {$else CPUAARCH64_HAS_LSE}
  236. .LIncLockedLoop:
  237. ldxr x1,[x0]
  238. add x1,x1,#1
  239. stxr w2,x1,[x0]
  240. cbnz w2,.LIncLockedLoop
  241. {$endif CPUAARCH64_HAS_LSE}
  242. end;
  243. {$ifdef VER3_2}
  244. function InterLockedDecrement (var Target: longint) : longint; assembler; nostackframe;
  245. {$else VER3_2}
  246. {$define FPC_SYSTEM_HAS_ATOMIC_DEC_32}
  247. function fpc_atomic_dec_32 (var Target: longint) : longint; assembler; nostackframe;
  248. {$endif VER3_2}
  249. { input: address of target in x0 }
  250. { output: target-1 in x0 }
  251. { side-effect: target := target-1 }
  252. asm
  253. {$ifdef CPUAARCH64_HAS_LSE}
  254. mov w1,#-1
  255. ldadd w1,w2,[x0]
  256. add w0,w2,w1
  257. {$else CPUAARCH64_HAS_LSE}
  258. .LInterDecLockedLoop:
  259. ldxr w1,[x0]
  260. subs w1,w1,#1
  261. stxr w2,w1,[x0]
  262. cbnz w2,.LInterDecLockedLoop
  263. mov w0,w1
  264. {$endif CPUAARCH64_HAS_LSE}
  265. end;
  266. {$ifdef VER3_2}
  267. function InterLockedIncrement (var Target: longint) : longint; assembler; nostackframe;
  268. {$else VER3_2}
  269. {$define FPC_SYSTEM_HAS_ATOMIC_INC_32}
  270. function fpc_atomic_inc_32 (var Target: longint) : longint; assembler; nostackframe;
  271. {$endif VER3_2}
  272. { input: address of target in x0 }
  273. { output: target+1 in x0 }
  274. { side-effect: target := target+1 }
  275. asm
  276. {$ifdef CPUAARCH64_HAS_LSE}
  277. mov w1,#1
  278. ldadd w1,w2,[x0]
  279. add w0,w2,w1
  280. {$else CPUAARCH64_HAS_LSE}
  281. .LInterIncLockedLoop:
  282. ldxr w1,[x0]
  283. add w1,w1,#1
  284. stxr w2,w1,[x0]
  285. cbnz w2,.LInterIncLockedLoop
  286. mov w0,w1
  287. {$endif CPUAARCH64_HAS_LSE}
  288. end;
  289. {$ifdef VER3_2}
  290. function InterLockedExchange (var Target: longint;Source : longint) : longint; assembler; nostackframe;
  291. {$else VER3_2}
  292. {$define FPC_SYSTEM_HAS_ATOMIC_XCHG_32}
  293. function fpc_atomic_xchg_32 (var Target: longint;Source : longint) : longint; assembler; nostackframe;
  294. {$endif VER3_2}
  295. { input: address of target in x0, source in w1 }
  296. { output: target in x0 }
  297. { side-effect: target := source }
  298. asm
  299. {$ifdef CPUAARCH64_HAS_LSE}
  300. swp w1,w0,[x0]
  301. {$else CPUAARCH64_HAS_LSE}
  302. .LInterLockedXchgLoop:
  303. ldxr w2,[x0]
  304. stxr w3,w1,[x0]
  305. cbnz w3,.LInterLockedXchgLoop
  306. mov w0,w2
  307. {$endif CPUAARCH64_HAS_LSE}
  308. end;
  309. {$ifdef VER3_2}
  310. function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint; assembler; nostackframe;
  311. {$else VER3_2}
  312. {$define FPC_SYSTEM_HAS_ATOMIC_ADD_32}
  313. function fpc_atomic_add_32 (var Target: longint;Value : longint) : longint; assembler; nostackframe;
  314. {$endif VER3_2}
  315. asm
  316. {$ifdef CPUAARCH64_HAS_LSE}
  317. ldadd w1,w0,[x0]
  318. {$else CPUAARCH64_HAS_LSE}
  319. .LInterLockedXchgAddLoop:
  320. ldxr w2,[x0]
  321. add w4,w2,w1
  322. stxr w3,w4,[x0]
  323. cbnz w3,.LInterLockedXchgAddLoop
  324. mov w0,w2
  325. {$endif CPUAARCH64_HAS_LSE}
  326. end;
  327. {$ifdef VER3_2}
  328. function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comperand: longint): longint; assembler; nostackframe;
  329. {$else VER3_2}
  330. {$define FPC_SYSTEM_HAS_ATOMIC_CMP_XCHG_32}
  331. function fpc_atomic_cmp_xchg_32(var Target: longint; NewValue: longint; Comparand: longint): longint; assembler; nostackframe;
  332. {$endif VER3_2}
  333. { input: address of target in x0, newvalue in w1, comparand in w2 }
  334. { output: value stored in target before entry of the function }
  335. { side-effect: NewValue stored in target if (target = comparand) }
  336. asm
  337. {$ifdef CPUAARCH64_HAS_LSE}
  338. cas w2,w1,[x0]
  339. mov w0,w2
  340. {$else CPUAARCH64_HAS_LSE}
  341. .LInterlockedCompareExchangeLoop:
  342. ldxr w3,[x0]
  343. cmp w3,w2
  344. csel w4,w1,w3,eq
  345. stxr w5,w4,[x0]
  346. cbnz w5,.LInterlockedCompareExchangeLoop
  347. mov w0,w3
  348. {$endif CPUAARCH64_HAS_LSE}
  349. end;
  350. {$ifdef VER3_2}
  351. function InterLockedDecrement64 (var Target: int64) : int64; assembler; nostackframe;
  352. {$else VER3_2}
  353. {$define FPC_SYSTEM_HAS_ATOMIC_DEC_64}
  354. function fpc_atomic_dec_64 (var Target: int64) : int64; assembler; nostackframe;
  355. {$endif VER3_2}
  356. asm
  357. {$ifdef CPUAARCH64_HAS_LSE}
  358. mov x1,#-1
  359. ldadd x1,x2,[x0]
  360. add x0,x2,x1
  361. {$else CPUAARCH64_HAS_LSE}
  362. .LInterDecLockedLoop:
  363. ldxr x1,[x0]
  364. sub x1,x1,#1
  365. stxr w2,x1,[x0]
  366. cbnz w2,.LInterDecLockedLoop
  367. mov x0,x1
  368. {$endif CPUAARCH64_HAS_LSE}
  369. end;
  370. {$ifdef VER3_2}
  371. function InterLockedIncrement64 (var Target: int64) : int64; assembler; nostackframe;
  372. {$else VER3_2}
  373. {$define FPC_SYSTEM_HAS_ATOMIC_INC_64}
  374. function fpc_atomic_inc_64 (var Target: int64) : int64; assembler; nostackframe;
  375. {$endif VER3_2}
  376. asm
  377. {$ifdef CPUAARCH64_HAS_LSE}
  378. mov x1,#1
  379. ldadd x1,x2,[x0]
  380. add x0,x2,x1
  381. {$else CPUAARCH64_HAS_LSE}
  382. .LInterIncLockedLoop:
  383. ldxr x1,[x0]
  384. add x1,x1,#1
  385. stxr w2,x1,[x0]
  386. cbnz w2,.LInterIncLockedLoop
  387. mov x0,x1
  388. {$endif CPUAARCH64_HAS_LSE}
  389. end;
  390. {$ifdef VER3_2}
  391. function InterLockedExchange64 (var Target: int64;Source : int64) : int64; assembler; nostackframe;
  392. {$else VER3_2}
  393. {$define FPC_SYSTEM_HAS_ATOMIC_XCHG_64}
  394. function fpc_atomic_xchg_64 (var Target: int64;Source : int64) : int64; assembler; nostackframe;
  395. {$endif VER3_2}
  396. asm
  397. {$ifdef CPUAARCH64_HAS_LSE}
  398. swp x1,x0,[x0]
  399. {$else CPUAARCH64_HAS_LSE}
  400. .LInterLockedXchgLoop:
  401. ldxr x2,[x0]
  402. stxr w3,x1,[x0]
  403. cbnz w3,.LInterLockedXchgLoop
  404. mov x0,x2
  405. {$endif CPUAARCH64_HAS_LSE}
  406. end;
  407. {$ifdef VER3_2}
  408. function InterLockedExchangeAdd64 (var Target: int64;Source : int64) : int64; assembler; nostackframe;
  409. {$else VER3_2}
  410. {$define FPC_SYSTEM_HAS_ATOMIC_ADD_64}
  411. function fpc_atomic_add_64 (var Target: int64;Value : int64) : int64; assembler; nostackframe;
  412. {$endif VER3_2}
  413. asm
  414. {$ifdef CPUAARCH64_HAS_LSE}
  415. ldadd x1,x0,[x0]
  416. {$else CPUAARCH64_HAS_LSE}
  417. .LInterLockedXchgAddLoop:
  418. ldxr x2,[x0]
  419. add x4,x2,x1
  420. stxr w3,x4,[x0]
  421. cbnz w3,.LInterLockedXchgAddLoop
  422. mov x0,x2
  423. {$endif CPUAARCH64_HAS_LSE}
  424. end;
  425. {$ifdef VER3_2}
  426. function InterLockedCompareExchange64(var Target: int64; NewValue, Comperand : int64): int64; assembler; nostackframe;
  427. {$else VER3_2}
  428. {$define FPC_SYSTEM_HAS_ATOMIC_CMP_XCHG_64}
  429. function fpc_atomic_cmp_xchg_64 (var Target: int64; NewValue, Comparand : int64) : int64; [public, alias: 'FPC_ATOMIC_CMP_XCHG_64']; assembler; nostackframe;
  430. {$endif VER3_2}
  431. asm
  432. {$ifdef CPUAARCH64_HAS_LSE}
  433. cas x2,x1,[x0]
  434. mov x0,x2
  435. {$else CPUAARCH64_HAS_LSE}
  436. .LInterlockedCompareExchangeLoop:
  437. ldxr x3,[x0]
  438. cmp x3,x2
  439. csel x4,x1,x3,eq
  440. stxr w5,x4,[x0]
  441. cbnz w5,.LInterlockedCompareExchangeLoop
  442. mov x0,x3
  443. {$endif CPUAARCH64_HAS_LSE}
  444. end;
  445. {$ifndef FPC_SYSTEM_HAS_MEM_BARRIER}
  446. {$define FPC_SYSTEM_HAS_MEM_BARRIER}
  447. procedure ReadBarrier;assembler;nostackframe;{$ifdef SYSTEMINLINE}inline;{$endif}
  448. asm
  449. // { dmb ishld }
  450. dmb #9
  451. end;
  452. procedure ReadDependencyBarrier;{$ifdef SYSTEMINLINE}inline;{$endif}
  453. begin
  454. { reads imply barrier on earlier reads depended on }
  455. end;
  456. procedure ReadWriteBarrier;assembler;nostackframe;{$ifdef SYSTEMINLINE}inline;{$endif}
  457. asm
  458. // { dmb ish }
  459. dmb #11
  460. end;
  461. procedure WriteBarrier;assembler;nostackframe;{$ifdef SYSTEMINLINE}inline;{$endif}
  462. asm
  463. // { dmb ishst }
  464. dmb #10
  465. end;
  466. {$endif}
  467. {****************************************************************************
  468. Math Routines
  469. ****************************************************************************}
  470. {$define FPC_SYSTEM_HAS_SWAPENDIAN}
  471. function SwapEndian(const AValue: SmallInt): SmallInt; assembler; nostackframe;
  472. asm
  473. rev16 w0, w0
  474. end;
  475. function SwapEndian(const AValue: Word): Word; assembler; nostackframe;
  476. asm
  477. rev16 w0, w0
  478. end;
  479. function SwapEndian(const AValue: LongInt): LongInt; assembler; nostackframe;
  480. asm
  481. rev32 x0, x0
  482. end;
  483. function SwapEndian(const AValue: DWord): DWord; assembler; nostackframe;
  484. asm
  485. rev32 x0, x0
  486. end;
  487. function SwapEndian(const AValue: Int64): Int64; assembler; nostackframe;
  488. asm
  489. rev x0, x0
  490. end;
  491. function SwapEndian(const AValue: QWord): QWord; assembler; nostackframe;
  492. asm
  493. rev x0, x0
  494. end;
  495. {$define FPC_SYSTEM_HAS_UMUL64X64_128}
  496. function UMul64x64_128(a,b: uint64; out rHi: uint64): uint64; assembler; nostackframe;
  497. asm
  498. umulh x3,x0,x1
  499. mul x0,x0,x1
  500. str x3,[x2]
  501. end;