powerpc.inc 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2000-2001 by the Free Pascal development team.
  5. Portions Copyright (c) 2000 by Casey Duncan ([email protected])
  6. Processor dependent implementation for the system unit for
  7. PowerPC
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. {****************************************************************************
  15. PowerPC specific stuff
  16. ****************************************************************************}
  17. {
  18. const
  19. ppc_fpu_overflow = (1 shl (32-3));
  20. ppc_fpu_underflow = (1 shl (32-4));
  21. ppc_fpu_divbyzero = (1 shl (32-5));
  22. ppc_fpu_inexact = (1 shl (32-6));
  23. ppc_fpu_invalid_snan = (1 shl (32-7));
  24. }
  25. procedure fpc_enable_ppc_fpu_exceptions;
  26. assembler;
  27. asm
  28. { clear all "exception happened" flags we care about}
  29. mtfsfi 0,0
  30. mtfsfi 1,0
  31. mtfsfi 2,0
  32. mtfsfi 3,0
  33. {$ifdef fpc_mtfsb0_corrected}
  34. mtfsb0 21
  35. mtfsb0 22
  36. mtfsb0 23
  37. {$endif fpc_mtfsb0_corrected}
  38. { enable invalid operations and division by zero exceptions. }
  39. { No overflow/underflow, since those give some spurious }
  40. { exceptions }
  41. mtfsfi 6,9
  42. end;
  43. procedure fpc_cpuinit;
  44. begin
  45. fpc_enable_ppc_fpu_exceptions;
  46. end;
  47. function fpc_get_ppc_fpscr: cardinal;
  48. assembler;
  49. var
  50. temp: record a,b:longint; end;
  51. asm
  52. mffs f0
  53. stfd f0,temp
  54. lwz r3,temp.b
  55. { clear all exception flags }
  56. {
  57. rlwinm r4,r3,0,16,31
  58. stw r4,temp.b
  59. lfd f0,temp
  60. a_mtfsf f0
  61. }
  62. end;
  63. { This function is never called directly, it's a dummy to hold the register save/
  64. load subroutines
  65. }
  66. {$ifndef MACOS}
  67. label
  68. _restfpr_14_x,
  69. _restfpr_15_x,
  70. _restfpr_16_x,
  71. _restfpr_17_x,
  72. _restfpr_18_x,
  73. _restfpr_19_x,
  74. _restfpr_20_x,
  75. _restfpr_21_x,
  76. _restfpr_22_x,
  77. _restfpr_23_x,
  78. _restfpr_24_x,
  79. _restfpr_25_x,
  80. _restfpr_26_x,
  81. _restfpr_27_x,
  82. _restfpr_28_x,
  83. _restfpr_29_x,
  84. _restfpr_30_x,
  85. _restfpr_31_x,
  86. _restfpr_14_l,
  87. _restfpr_15_l,
  88. _restfpr_16_l,
  89. _restfpr_17_l,
  90. _restfpr_18_l,
  91. _restfpr_19_l,
  92. _restfpr_20_l,
  93. _restfpr_21_l,
  94. _restfpr_22_l,
  95. _restfpr_23_l,
  96. _restfpr_24_l,
  97. _restfpr_25_l,
  98. _restfpr_26_l,
  99. _restfpr_27_l,
  100. _restfpr_28_l,
  101. _restfpr_29_l,
  102. _restfpr_30_l,
  103. _restfpr_31_l;
  104. procedure saverestorereg;assembler;
  105. asm
  106. { exit }
  107. .globl _restfpr_14_x
  108. _restfpr_14_x: lfd f14, -144(r11)
  109. .globl _restfpr_15_x
  110. _restfpr_15_x: lfd f15, -136(r11)
  111. .globl _restfpr_16_x
  112. _restfpr_16_x: lfd f16, -128(r11)
  113. .globl _restfpr_17_x
  114. _restfpr_17_x: lfd f17, -120(r11)
  115. .globl _restfpr_18_x
  116. _restfpr_18_x: lfd f18, -112(r11)
  117. .globl _restfpr_19_x
  118. _restfpr_19_x: lfd f19, -104(r11)
  119. .globl _restfpr_20_x
  120. _restfpr_20_x: lfd f20, -96(r11)
  121. .globl _restfpr_21_x
  122. _restfpr_21_x: lfd f21, -88(r11)
  123. .globl _restfpr_22_x
  124. _restfpr_22_x: lfd f22, -80(r11)
  125. .globl _restfpr_23_x
  126. _restfpr_23_x: lfd f23, -72(r11)
  127. .globl _restfpr_24_x
  128. _restfpr_24_x: lfd f24, -64(r11)
  129. .globl _restfpr_25_x
  130. _restfpr_25_x: lfd f25, -56(r11)
  131. .globl _restfpr_26_x
  132. _restfpr_26_x: lfd f26, -48(r11)
  133. .globl _restfpr_27_x
  134. _restfpr_27_x: lfd f27, -40(r11)
  135. .globl _restfpr_28_x
  136. _restfpr_28_x: lfd f28, -32(r11)
  137. .globl _restfpr_29_x
  138. _restfpr_29_x: lfd f29, -24(r11)
  139. .globl _restfpr_30_x
  140. _restfpr_30_x: lfd f30, -16(r11)
  141. .globl _restfpr_31_x
  142. _restfpr_31_x: lwz r0, 4(r11)
  143. lfd f31, -8(r11)
  144. mtlr r0
  145. ori r1, r11, 0
  146. blr
  147. { exit with restoring lr }
  148. .globl _restfpr_14_l
  149. _restfpr_14_l: lfd f14, -144(r11)
  150. .globl _restfpr_15_l
  151. _restfpr_15_l: lfd f15, -136(r11)
  152. .globl _restfpr_16_l
  153. _restfpr_16_l: lfd f16, -128(r11)
  154. .globl _restfpr_17_l
  155. _restfpr_17_l: lfd f17, -120(r11)
  156. .globl _restfpr_18_l
  157. _restfpr_18_l: lfd f18, -112(r11)
  158. .globl _restfpr_19_l
  159. _restfpr_19_l: lfd f19, -104(r11)
  160. .globl _restfpr_20_l
  161. _restfpr_20_l: lfd f20, -96(r11)
  162. .globl _restfpr_21_l
  163. _restfpr_21_l: lfd f21, -88(r11)
  164. .globl _restfpr_22_l
  165. _restfpr_22_l: lfd f22, -80(r11)
  166. .globl _restfpr_23_l
  167. _restfpr_23_l: lfd f23, -72(r11)
  168. .globl _restfpr_24_l
  169. _restfpr_24_l: lfd f24, -64(r11)
  170. .globl _restfpr_25_l
  171. _restfpr_25_l: lfd f25, -56(r11)
  172. .globl _restfpr_26_l
  173. _restfpr_26_l: lfd f26, -48(r11)
  174. .globl _restfpr_27_l
  175. _restfpr_27_l: lfd f27, -40(r11)
  176. .globl _restfpr_28_l
  177. _restfpr_28_l: lfd f28, -32(r11)
  178. .globl _restfpr_29_l
  179. _restfpr_29_l: lfd f29, -24(r11)
  180. .globl _restfpr_30_l
  181. _restfpr_30_l: lfd f30, -16(r11)
  182. .globl _restfpr_31_l
  183. _restfpr_31_l: lwz r0, 4(r11)
  184. lfd f31, -8(r11)
  185. mtlr r0
  186. ori r1, r11, 0
  187. blr
  188. end;
  189. {$endif MACOS}
  190. {****************************************************************************
  191. Move / Fill
  192. ****************************************************************************}
  193. {$ifndef FPC_SYSTEM_HAS_MOVE}
  194. {$define FPC_SYSTEM_HAS_MOVE}
  195. procedure Move(const source;var dest;count:longint);[public, alias: 'FPC_MOVE'];assembler;
  196. asm
  197. { count <= 0 ? }
  198. cmpwi cr0,r5,0
  199. { check if we have to do the move backwards because of overlap }
  200. sub r10,r4,r3
  201. { carry := boolean(dest-source < count) = boolean(overlap) }
  202. subc r10,r10,r5
  203. { count < 15 ? (to decide whether we will move dwords or bytes }
  204. cmpwi cr1,r5,15
  205. { if overlap, then r10 := -1 else r10 := 0 }
  206. subfe r10,r10,r10
  207. { count < 63 ? (32 + max. alignment (31) }
  208. cmpwi cr7,r5,63
  209. { if count <= 0, stop }
  210. ble cr0,.LMoveDone
  211. { load the begin of the source in the data cache }
  212. dcbt 0,r3
  213. { and the dest as well }
  214. dcbtst 0,r4
  215. { if overlap, then r0 := count else r0 := 0 }
  216. and r0,r5,r10
  217. { if overlap, then point source and dest to the end }
  218. add r3,r3,r0
  219. add r4,r4,r0
  220. { if overlap, then r6 := 0, else r6 := -1 }
  221. not r6,r10
  222. { if overlap, then r10 := -2, else r10 := 0 }
  223. slwi r10,r10,1
  224. { if overlap, then r10 := -1, else r10 := 1 }
  225. addi r10,r10,1
  226. { if count < 15, copy everything byte by byte }
  227. blt cr1,.LMoveBytes
  228. { if no overlap, then source/dest += -1, otherwise they stay }
  229. { After the next instruction, r3/r4 + r10 = next position to }
  230. { load/store from/to }
  231. add r3,r3,r6
  232. add r4,r4,r6
  233. { otherwise, guarantee 4 byte alignment for dest for starters }
  234. .LMove4ByteAlignLoop:
  235. lbzux r0,r3,r10
  236. stbux r0,r4,r10
  237. { is dest now 4 aligned? }
  238. andi. r0,r4,3
  239. subi r5,r5,1
  240. { while not aligned, continue }
  241. bne cr0,.LMove4ByteAlignLoop
  242. {$ifndef ppc603}
  243. { check for 32 byte alignment }
  244. andi. r7,r4,31
  245. {$endif non ppc603}
  246. { we are going to copy one byte again (the one at the newly }
  247. { aligned address), so increase count byte 1 }
  248. addi r5,r5,1
  249. { count div 4 for number of dwords to copy }
  250. srwi r0,r5,2
  251. { if 11 <= count < 63, copy using dwords }
  252. blt cr7,.LMoveDWords
  253. {$ifndef ppc603}
  254. { # of dwords to copy to reach 32 byte alignment (*4) }
  255. { (depends on forward/backward copy) }
  256. { if forward copy, r6 = -1 -> r8 := 32 }
  257. { if backward copy, r6 = 0 -> r8 := 0 }
  258. rlwinm r8,r6,0,31-6+1,31-6+1
  259. { if forward copy, we have to copy 32 - unaligned count bytes }
  260. { if backward copy unaligned count bytes }
  261. sub r7,r8,r7
  262. { if backward copy, the calculated value is now negate -> }
  263. { make it positive again }
  264. not r8, r6
  265. add r7, r7, r8
  266. xor r7, r7, r8
  267. {$endif not ppc603}
  268. { multiply the update count with 4 }
  269. slwi r10,r10,2
  270. slwi r6,r6,2
  271. { and adapt the source and dest }
  272. add r3,r3,r6
  273. add r4,r4,r6
  274. {$ifndef ppc603}
  275. beq cr0,.LMove32BytesAligned
  276. .L32BytesAlignMoveLoop:
  277. { count >= 39 -> align to 8 byte boundary and then use the FPU }
  278. { since we're already at 4 byte alignment, use dword store }
  279. subic. r7,r7,4
  280. lwzux r0,r3,r10
  281. subi r5,r5,4
  282. stwux r0,r4,r10
  283. bne .L32BytesAlignMoveLoop
  284. .LMove32BytesAligned:
  285. { count div 32 ( >= 1, since count was >=63 }
  286. srwi r0,r5,5
  287. { remainder }
  288. andi. r5,r5,31
  289. { to decide if we will do some dword stores (instead of only }
  290. { byte stores) afterwards or not }
  291. {$else not ppc603}
  292. srwi r0,r5,4
  293. andi. r5,r5,15
  294. {$endif not ppc603}
  295. cmpwi cr1,r5,11
  296. mtctr r0
  297. { r0 := count div 4, will be moved to ctr when copying dwords }
  298. srwi r0,r5,2
  299. {$ifndef ppc603}
  300. { adjust the update count: it will now be 8 or -8 depending on overlap }
  301. slwi r10,r10,1
  302. { adjust source and dest pointers: because of the above loop, dest is now }
  303. { aligned to 8 bytes. So if we add r6 we will still have an 8 bytes }
  304. { aligned address) }
  305. add r3,r3,r6
  306. add r4,r4,r6
  307. slwi r6,r6,1
  308. { the dcbz offset must give a 32 byte aligned address when added }
  309. { to the current dest address and its address must point to the }
  310. { bytes that will be overwritten in the current iteration. In case }
  311. { of a forward loop, the dest address has currently an offset of }
  312. { -8 compared to the bytes that will be overwritten (and r6 = -8). }
  313. { In case of a backward of a loop, the dest address currently has }
  314. { an offset of +32 compared to the bytes that will be overwritten }
  315. { (and r6 = 0). So the forward dcbz offset must become +8 and the }
  316. { backward -32 -> (-r6 * 5) - 32 gives the correct offset }
  317. slwi r7,r6,2
  318. add r7,r7,r6
  319. neg r7,r7
  320. subi r7,r7,32
  321. .LMove32ByteDcbz:
  322. lfdux f0,r3,r10
  323. lfdux f1,r3,r10
  324. lfdux f2,r3,r10
  325. lfdux f3,r3,r10
  326. { must be done only now, in case source and dest are less than }
  327. { 32 bytes apart! }
  328. dcbz r4,r7
  329. stfdux f0,r4,r10
  330. stfdux f1,r4,r10
  331. stfdux f2,r4,r10
  332. stfdux f3,r4,r10
  333. bdnz .LMove32ByteDcbz
  334. .LMove32ByteLoopDone:
  335. {$else not ppc603}
  336. .LMove16ByteLoop:
  337. lwzux r11,r3,r10
  338. lwzux r7,r3,r10
  339. lwzux r8,r3,r10
  340. lwzux r9,r3,r10
  341. stwux r11,r4,r10
  342. stwux r7,r4,r10
  343. stwux r8,r4,r10
  344. stwux r9,r4,r10
  345. bdnz .LMove16ByteLoop
  346. {$endif not ppc603}
  347. { cr0*4+eq is true if "count and 31" = 0 }
  348. beq cr0,.LMoveDone
  349. { make r10 again -1 or 1, but first adjust source/dest pointers }
  350. sub r3,r3,r6
  351. sub r4,r4,r6
  352. {$ifndef ppc603}
  353. srawi r10,r10,3
  354. srawi r6,r6,3
  355. {$else not ppc603}
  356. srawi r10,r10,2
  357. srawi r6,r6,2
  358. {$endif not ppc603}
  359. { cr1 contains whether count <= 11 }
  360. ble cr1,.LMoveBytes
  361. .LMoveDWords:
  362. mtctr r0
  363. andi. r5,r5,3
  364. { r10 * 4 }
  365. slwi r10,r10,2
  366. slwi r6,r6,2
  367. add r3,r3,r6
  368. add r4,r4,r6
  369. .LMoveDWordsLoop:
  370. lwzux r0,r3,r10
  371. stwux r0,r4,r10
  372. bdnz .LMoveDWordsLoop
  373. beq cr0,.LMoveDone
  374. { make r10 again -1 or 1 }
  375. sub r3,r3,r6
  376. sub r4,r4,r6
  377. srawi r10,r10,2
  378. srawi r6,r6,2
  379. .LMoveBytes:
  380. add r3,r3,r6
  381. add r4,r4,r6
  382. mtctr r5
  383. .LMoveBytesLoop:
  384. lbzux r0,r3,r10
  385. stbux r0,r4,r10
  386. bdnz .LMoveBytesLoop
  387. .LMoveDone:
  388. end;
  389. {$endif FPC_SYSTEM_HAS_MOVE}
  390. {$ifndef FPC_SYSTEM_HAS_FILLCHAR}
  391. {$define FPC_SYSTEM_HAS_FILLCHAR}
  392. Procedure FillChar(var x;count:longint;value:byte);assembler;
  393. { input: x in r3, count in r4, value in r5 }
  394. {$ifndef FPC_ABI_AIX}
  395. { in the AIX ABI, we can use te red zone for temp storage, otherwise we have }
  396. { to explicitely allocate room }
  397. var
  398. temp : packed record
  399. case byte of
  400. 0: (l1,l2: longint);
  401. 1: (d: double);
  402. end;
  403. {$endif FPC_ABI_AIX}
  404. asm
  405. { no bytes? }
  406. cmpwi cr6,r4,0
  407. { less than 15 bytes? }
  408. cmpwi cr7,r4,15
  409. { less than 64 bytes? }
  410. cmpwi cr1,r4,64
  411. { fill r5 with ValueValueValueValue }
  412. rlwimi r5,r5,8,16,23
  413. { setup for aligning x to multiple of 4}
  414. rlwinm r10,r3,0,31-2+1,31
  415. rlwimi r5,r5,16,0,15
  416. ble cr6,.LFillCharDone
  417. { get the start of the data in the cache (and mark it as "will be }
  418. { modified") }
  419. dcbtst 0,r3
  420. subfic r10,r10,4
  421. blt cr7,.LFillCharVerySmall
  422. { just store 4 bytes instead of using a loop to align (there are }
  423. { plenty of other instructions now to keep the processor busy }
  424. { while it handles the (possibly unaligned) store) }
  425. stw r5,0(r3)
  426. { r3 := align(r3,4) }
  427. add r3,r3,r10
  428. { decrease count with number of bytes already stored }
  429. sub r4,r4,r10
  430. blt cr1,.LFillCharSmall
  431. { if we have to fill with 0 (which happens a lot), we can simply use }
  432. { dcbz for the most part, which is very fast, so make a special case }
  433. { for that }
  434. cmplwi cr1,r5,0
  435. { align to a multiple of 32 (and immediately check whether we aren't }
  436. { already 32 byte aligned) }
  437. rlwinm. r10,r3,0,31-5+1,31
  438. { setup r3 for using update forms of store instructions }
  439. subi r3,r3,4
  440. { get number of bytes to store }
  441. subfic r10,r10,32
  442. { if already 32byte aligned, skip align loop }
  443. beq .L32ByteAlignLoopDone
  444. { substract from the total count }
  445. sub r4,r4,r10
  446. .L32ByteAlignLoop:
  447. { we were already aligned to 4 byres, so this will count down to }
  448. { exactly 0 }
  449. subic. r10,r10,4
  450. stwu r5,4(r3)
  451. bne .L32ByteAlignLoop
  452. .L32ByteAlignLoopDone:
  453. { get the amount of 32 byte blocks }
  454. srwi r10,r4,5
  455. { and keep the rest in r4 (recording whether there is any rest) }
  456. rlwinm. r4,r4,0,31-5+1,31
  457. { move to ctr }
  458. mtctr r10
  459. { check how many rest there is (to decide whether we'll use }
  460. { FillCharSmall or FillCharVerySmall) }
  461. cmplwi cr7,r4,11
  462. { if filling with zero, only use dcbz }
  463. bne cr1, .LFillCharNoZero
  464. { make r3 point again to the actual store position }
  465. addi r3,r3,4
  466. .LFillCharDCBZLoop:
  467. dcbz 0,r3
  468. addi r3,r3,32
  469. bdnz .LFillCharDCBZLoop
  470. { if there was no rest, we're finished }
  471. beq .LFillCharDone
  472. b .LFillCharVerySmall
  473. .LFillCharNoZero:
  474. {$ifdef FPC_ABI_AIX}
  475. stw r5,0(r1)
  476. stw r5,4(r1)
  477. lfd f0,0(r1)
  478. {$else FPC_ABI_AIX}
  479. stw r5,temp
  480. stw r5,temp+4
  481. lfd f0,temp
  482. {$endif FPC_ABI_AIX}
  483. { make r3 point to address-8, so we're able to use fp double stores }
  484. { with update (it's already -4 now) }
  485. subi r3,r3,4
  486. { load r10 with 8, so that dcbz uses the correct address }
  487. li r10, 8
  488. .LFillChar32ByteLoop:
  489. dcbz r3,r10
  490. stfdu f0,8(r3)
  491. stfdu f0,8(r3)
  492. stfdu f0,8(r3)
  493. stfdu f0,8(r3)
  494. bdnz .LFillChar32ByteLoop
  495. { if there was no rest, we're finished }
  496. beq .LFillCharDone
  497. { make r3 point again to the actual next byte that must be written }
  498. addi r3,r3,8
  499. b .LFillCharVerySmall
  500. .LFillCharSmall:
  501. { when we arrive here, we're already 4 byte aligned }
  502. { get count div 4 to store dwords }
  503. srwi r10,r4,2
  504. { get ready for use of update stores }
  505. subi r3,r3,4
  506. mtctr r10
  507. rlwinm. r4,r4,0,31-2+1,31
  508. .LFillCharSmallLoop:
  509. stwu r5,4(r3)
  510. bdnz .LFillCharSmallLoop
  511. { if nothing left, stop }
  512. beq .LFillCharDone
  513. { get ready to store bytes }
  514. addi r3,r3,4
  515. .LFillCharVerySmall:
  516. mtctr r4
  517. subi r3,r3,1
  518. .LFillCharVerySmallLoop:
  519. stbu r5,1(r3)
  520. bdnz .LFillCharVerySmallLoop
  521. .LFillCharDone:
  522. end;
  523. {$endif FPC_SYSTEM_HAS_FILLCHAR}
  524. {$ifndef FPC_SYSTEM_HAS_FILLDWORD}
  525. {$define FPC_SYSTEM_HAS_FILLDWORD}
  526. procedure filldword(var x;count : longint;value : dword);
  527. assembler;
  528. asm
  529. { registers:
  530. r3 x
  531. r4 count
  532. r5 value
  533. }
  534. cmpwi cr0,r4,0
  535. mtctr r4
  536. subi r3,r3,4
  537. ble .LFillDWordEnd //if count<=0 Then Exit
  538. .LFillDWordLoop:
  539. stwu r5,4(r3)
  540. bdnz .LFillDWordLoop
  541. .LFillDWordEnd:
  542. end;
  543. {$endif FPC_SYSTEM_HAS_FILLDWORD}
  544. {$ifndef FPC_SYSTEM_HAS_INDEXBYTE}
  545. {$define FPC_SYSTEM_HAS_INDEXBYTE}
  546. function IndexByte(const buf;len:longint;b:byte):longint; assembler;
  547. { input: r3 = buf, r4 = len, r5 = b }
  548. { output: r3 = position of b in buf (-1 if not found) }
  549. asm
  550. { load the begin of the buffer in the data cache }
  551. dcbt 0,r3
  552. cmplwi r4,0
  553. mtctr r4
  554. subi r10,r3,1
  555. mr r0,r3
  556. { assume not found }
  557. li r3,-1
  558. ble .LIndexByteDone
  559. .LIndexByteLoop:
  560. lbzu r9,1(r10)
  561. cmplw r9,r5
  562. bdnzf cr0*4+eq,.LIndexByteLoop
  563. { r3 still contains -1 here }
  564. bne .LIndexByteDone
  565. sub r3,r10,r0
  566. .LIndexByteDone:
  567. end;
  568. {$endif FPC_SYSTEM_HAS_INDEXBYTE}
  569. {$ifndef FPC_SYSTEM_HAS_INDEXWORD}
  570. {$define FPC_SYSTEM_HAS_INDEXWORD}
  571. function IndexWord(const buf;len:longint;b:word):longint; assembler;
  572. { input: r3 = buf, r4 = len, r5 = b }
  573. { output: r3 = position of b in buf (-1 if not found) }
  574. asm
  575. { load the begin of the buffer in the data cache }
  576. dcbt 0,r3
  577. cmplwi r4,0
  578. mtctr r4
  579. subi r10,r3,2
  580. mr r0,r3
  581. { assume not found }
  582. li r3,-1
  583. ble .LIndexWordDone
  584. .LIndexWordLoop:
  585. lhzu r9,2(r10)
  586. cmplw r9,r5
  587. bdnzf cr0*4+eq,.LIndexWordLoop
  588. { r3 still contains -1 here }
  589. bne .LIndexWordDone
  590. sub r3,r10,r0
  591. srawi r3,r3,1
  592. .LIndexWordDone:
  593. end;
  594. {$endif FPC_SYSTEM_HAS_INDEXWORD}
  595. {$ifndef FPC_SYSTEM_HAS_INDEXDWORD}
  596. {$define FPC_SYSTEM_HAS_INDEXDWORD}
  597. function IndexDWord(const buf;len:longint;b:DWord):longint; assembler;
  598. { input: r3 = buf, r4 = len, r5 = b }
  599. { output: r3 = position of b in buf (-1 if not found) }
  600. asm
  601. { load the begin of the buffer in the data cache }
  602. dcbt 0,r3
  603. cmplwi r4,0
  604. mtctr r4
  605. subi r10,r3,4
  606. mr r0,r3
  607. { assume not found }
  608. li r3,-1
  609. ble .LIndexDWordDone
  610. .LIndexDWordLoop:
  611. lwzu r9,4(r10)
  612. cmplw r9,r5
  613. bdnzf cr0*4+eq, .LIndexDWordLoop
  614. { r3 still contains -1 here }
  615. bne .LIndexDWordDone
  616. sub r3,r10,r0
  617. srawi r3,r3,2
  618. .LIndexDWordDone:
  619. end;
  620. {$endif FPC_SYSTEM_HAS_INDEXDWORD}
  621. {$ifndef FPC_SYSTEM_HAS_COMPAREBYTE}
  622. {$define FPC_SYSTEM_HAS_COMPAREBYTE}
  623. function CompareByte(const buf1,buf2;len:longint):longint; assembler;
  624. { input: r3 = buf1, r4 = buf2, r5 = len }
  625. { output: r3 = 0 if equal, < 0 if buf1 < str2, > 0 if buf1 > str2 }
  626. { note: almost direct copy of strlcomp() from strings.inc }
  627. asm
  628. { load the begin of the first buffer in the data cache }
  629. dcbt 0,r3
  630. { use r0 instead of r3 for buf1 since r3 contains result }
  631. cmplwi r5,0
  632. mtctr r5
  633. subi r11,r3,1
  634. subi r4,r4,1
  635. li r3,0
  636. ble .LCompByteDone
  637. .LCompByteLoop:
  638. { load next chars }
  639. lbzu r9,1(r11)
  640. lbzu r10,1(r4)
  641. { calculate difference }
  642. sub. r3,r9,r10
  643. { if chars not equal or at the end, we're ready }
  644. bdnzt cr0*4+eq, .LCompByteLoop
  645. .LCompByteDone:
  646. end;
  647. {$endif FPC_SYSTEM_HAS_COMPAREBYTE}
  648. {$ifndef FPC_SYSTEM_HAS_COMPAREWORD}
  649. {$define FPC_SYSTEM_HAS_COMPAREWORD}
  650. function CompareWord(const buf1,buf2;len:longint):longint; assembler;
  651. { input: r3 = buf1, r4 = buf2, r5 = len }
  652. { output: r3 = 0 if equal, < 0 if buf1 < str2, > 0 if buf1 > str2 }
  653. { note: almost direct copy of strlcomp() from strings.inc }
  654. asm
  655. { load the begin of the first buffer in the data cache }
  656. dcbt 0,r3
  657. { use r0 instead of r3 for buf1 since r3 contains result }
  658. cmplwi r5,0
  659. mtctr r5
  660. subi r11,r3,2
  661. subi r4,r4,2
  662. li r3,0
  663. ble .LCompWordDone
  664. .LCompWordLoop:
  665. { load next chars }
  666. lhzu r9,2(r11)
  667. lhzu r10,2(r4)
  668. { calculate difference }
  669. sub. r3,r9,r10
  670. { if chars not equal or at the end, we're ready }
  671. bdnzt cr0*4+eq, .LCompWordLoop
  672. .LCompWordDone:
  673. end;
  674. {$endif FPC_SYSTEM_HAS_COMPAREWORD}
  675. {$ifndef FPC_SYSTEM_HAS_COMPAREDWORD}
  676. {$define FPC_SYSTEM_HAS_COMPAREDWORD}
  677. function CompareDWord(const buf1,buf2;len:longint):longint; assembler;
  678. { input: r3 = buf1, r4 = buf2, r5 = len }
  679. { output: r3 = 0 if equal, < 0 if buf1 < str2, > 0 if buf1 > str2 }
  680. { note: almost direct copy of strlcomp() from strings.inc }
  681. asm
  682. { load the begin of the first buffer in the data cache }
  683. dcbt 0,r3
  684. { use r0 instead of r3 for buf1 since r3 contains result }
  685. cmplwi r5,0
  686. mtctr r5
  687. subi r11,r3,4
  688. subi r4,r4,4
  689. li r3,0
  690. ble .LCompDWordDone
  691. .LCompDWordLoop:
  692. { load next chars }
  693. lwzu r9,4(r11)
  694. lwzu r10,4(r4)
  695. { calculate difference }
  696. sub. r3,r9,r10
  697. { if chars not equal or at the end, we're ready }
  698. bdnzt cr0*4+eq, .LCompDWordLoop
  699. .LCompDWordDone:
  700. end;
  701. {$endif FPC_SYSTEM_HAS_COMPAREDWORD}
  702. {$ifndef FPC_SYSTEM_HAS_INDEXCHAR0}
  703. {$define FPC_SYSTEM_HAS_INDEXCHAR0}
  704. function IndexChar0(const buf;len:longint;b:Char):longint; assembler;
  705. { input: r3 = buf, r4 = len, r5 = b }
  706. { output: r3 = position of found position (-1 if not found) }
  707. asm
  708. { load the begin of the buffer in the data cache }
  709. dcbt 0,r3
  710. { length = 0? }
  711. cmplwi r4,0
  712. mtctr r4
  713. subi r9,r3,1
  714. subi r0,r3,1
  715. { assume not found }
  716. li r3,-1
  717. { if yes, do nothing }
  718. ble .LIndexChar0Done
  719. .LIndexChar0Loop:
  720. lbzu r10,1(r9)
  721. cmplwi cr1,r10,0
  722. cmplw r10,r5
  723. beq cr1,.LIndexChar0Done
  724. bdnzf cr0*4+eq, .LIndexChar0Loop
  725. bne .LIndexChar0Done
  726. sub r3,r9,r0
  727. .LIndexChar0Done:
  728. end;
  729. {$endif FPC_SYSTEM_HAS_INDEXCHAR0}
  730. {****************************************************************************
  731. String
  732. ****************************************************************************}
  733. {$ifndef FPC_SYSTEM_HAS_FPC_SHORTSTR_ASSIGN}
  734. {$define FPC_SYSTEM_HAS_FPC_SHORTSTR_ASSIGN}
  735. function fpc_shortstr_to_shortstr(len:longint; const sstr: shortstring): shortstring; [public,alias: 'FPC_SHORTSTR_TO_SHORTSTR']; compilerproc;
  736. assembler;
  737. { input: r3: pointer to result, r4: len, r5: sstr }
  738. asm
  739. { load length source }
  740. lbz r10,0(r5)
  741. { load the begin of the dest buffer in the data cache }
  742. dcbtst 0,r3
  743. { put min(length(sstr),len) in r4 }
  744. subfc r7,r10,r4 { r0 := r4 - r10 }
  745. subfe r4,r4,r4 { if r3 >= r4 then r3' := 0 else r3' := -1 }
  746. and r7,r7,r4 { if r3 >= r4 then r3' := 0 else r3' := r3-r10 }
  747. add r4,r10,r7 { if r3 >= r4 then r3' := r10 else r3' := r3 }
  748. cmplwi r4,0
  749. { put length in ctr }
  750. mtctr r4
  751. stb r4,0(r3)
  752. beq .LShortStrCopyDone
  753. .LShortStrCopyLoop:
  754. lbzu r0,1(r5)
  755. stbu r0,1(r3)
  756. bdnz .LShortStrCopyLoop
  757. .LShortStrCopyDone:
  758. end;
  759. {$ifdef interncopy}
  760. procedure fpc_shortstr_assign(len:longint;sstr,dstr:pointer);[public,alias:'FPC_SHORTSTR_ASSIGN'];
  761. {$else}
  762. procedure fpc_shortstr_copy(len:longint;sstr,dstr:pointer);[public,alias:'FPC_SHORTSTR_COPY'];
  763. {$endif}
  764. assembler;
  765. { input: r3: len, r4: sstr, r5: dstr }
  766. asm
  767. { load length source }
  768. lbz r10,0(r4)
  769. { load the begin of the dest buffer in the data cache }
  770. dcbtst 0,r5
  771. { put min(length(sstr),len) in r3 }
  772. subc r0,r3,r10 { r0 := r3 - r10 }
  773. subfe r3,r3,r3 { if r3 >= r4 then r3' := 0 else r3' := -1 }
  774. and r3,r0,r3 { if r3 >= r4 then r3' := 0 else r3' := r3-r10 }
  775. add r3,r3,r10 { if r3 >= r4 then r3' := r10 else r3' := r3 }
  776. cmplwi r3,0
  777. { put length in ctr }
  778. mtctr r3
  779. stb r3,0(r5)
  780. beq .LShortStrCopyDone2
  781. .LShortStrCopyLoop2:
  782. lbzu r0,1(r4)
  783. stbu r0,1(r5)
  784. bdnz .LShortStrCopyLoop2
  785. .LShortStrCopyDone2:
  786. end;
  787. {$endif FPC_SYSTEM_HAS_FPC_SHORTSTR_ASSIGN}
  788. {$ifndef FPC_SYSTEM_HAS_FPC_SHORTSTR_APPEND_SHORTSTR}
  789. {$define FPC_SYSTEM_HAS_FPC_SHORTSTR_APPEND_SHORTSTR}
  790. procedure fpc_shortstr_append_shortstr(var s1: shortstring; const s2: shortstring); compilerproc;
  791. { expects that results (r3) contains a pointer to the current string s1, r4 }
  792. { high(s1) and (r5) a pointer to the one that has to be concatenated }
  793. assembler;
  794. asm
  795. { load length s1 }
  796. lbz r6, 0(r3)
  797. { load length s2 }
  798. lbz r10, 0(r5)
  799. { length 0? }
  800. cmplwi r10,0
  801. cmplw cr1,r6,r4
  802. { calculate min(length(s2),high(result)-length(result)) }
  803. sub r9,r4,r6
  804. subc r8,r9,r10 { r8 := r9 - r10 }
  805. subfe r9,r9,r9 { if r9 >= r10 then r9' := 0 else r9' := -1 }
  806. and r9,r8,r9 { if r9 >= r10 then r9' := 0 else r9' := r9-r10 }
  807. cror 4*7+2,4*0+2,4*1+2
  808. add r9,r9,r10 { if r9 >= r10 then r9' := r10 else r9' := r9 }
  809. { calculate new length }
  810. add r10,r6,r9
  811. { load value to copy in ctr }
  812. mtctr r9
  813. { store new length }
  814. stb r10,0(r3)
  815. { go to last current character of result }
  816. add r3,r6,r3
  817. { if nothing to do, exit }
  818. beq cr7, .LShortStrAppendDone
  819. { and concatenate }
  820. .LShortStrAppendLoop:
  821. lbzu r10,1(r5)
  822. stbu r10,1(r3)
  823. bdnz .LShortStrAppendLoop
  824. .LShortStrAppendDone:
  825. end;
  826. {$endif FPC_SYSTEM_HAS_FPC_SHORTSTR_APPEND_SHORTSTR}
  827. (*
  828. {$define FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE}
  829. function fpc_shortstr_compare(const dstr,sstr:shortstring): longint; [public,alias:'FPC_SHORTSTR_COMPARE']; compilerproc;
  830. assembler;
  831. asm
  832. { load length sstr }
  833. lbz r9,0(r4)
  834. { load length dstr }
  835. lbz r10,0(r3)
  836. { save their difference for later and }
  837. { calculate min(length(sstr),length(dstr)) }
  838. subfc r7,r10,r9 { r0 := r9 - r10 }
  839. subfe r9,r9,r9 { if r9 >= r10 then r9' := 0 else r9' := -1 }
  840. and r7,r7,r9 { if r9 >= r10 then r9' := 0 else r9' := r9-r8 }
  841. add r9,r10,r7 { if r9 >= r10 then r9' := r10 else r9' := r9 }
  842. { first compare dwords (length/4) }
  843. srwi. r5,r9,2
  844. { keep length mod 4 for the ends }
  845. rlwinm r9,r9,0,30,31
  846. { already check whether length mod 4 = 0 }
  847. cmplwi cr1,r9,0
  848. { so we can load r3 with 0, in case the strings both have length 0 }
  849. mr r8,r3
  850. li r3, 0
  851. { length div 4 in ctr for loop }
  852. mtctr r5
  853. { if length < 3, goto byte comparing }
  854. beq LShortStrCompare1
  855. { setup for use of update forms of load/store with dwords }
  856. subi r4,r4,3
  857. subi r8,r8,3
  858. LShortStrCompare4Loop:
  859. lwzu r3,4(r4)
  860. lwzu r10,4(r8)
  861. sub. r3,r3,r10
  862. bdnzt cr0+eq,LShortStrCompare4Loop
  863. { r3 contains result if we stopped because of "ne" flag }
  864. bne LShortStrCompareDone
  865. { setup for use of update forms of load/store with bytes }
  866. addi r4,r4,3
  867. addi r8,r8,3
  868. LShortStrCompare1:
  869. { if comparelen mod 4 = 0, skip this and return the difference in }
  870. { lengths }
  871. beq cr1,LShortStrCompareLen
  872. mtctr r9
  873. LShortStrCompare1Loop:
  874. lbzu r3,1(r4)
  875. lbzu r10,1(r8)
  876. sub. r3,r3,r10
  877. bdnzt cr0+eq,LShortStrCompare1Loop
  878. bne LShortStrCompareDone
  879. LShortStrCompareLen:
  880. { also return result in flags, maybe we can use this in the CG }
  881. mr. r3,r3
  882. LShortStrCompareDone:
  883. end;
  884. *)
  885. {$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR}
  886. {$define FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR}
  887. function fpc_pchar_to_shortstr(p:pchar):shortstring;[public,alias:'FPC_PCHAR_TO_SHORTSTR']; compilerproc;
  888. assembler;
  889. {$include strpas.inc}
  890. {$endif FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR}
  891. {$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
  892. {$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
  893. function fpc_pchar_length(p:pchar):longint;assembler;[public,alias:'FPC_PCHAR_LENGTH']; {$ifdef hascompilerproc} compilerproc; {$endif}
  894. {$include strlen.inc}
  895. {$endif FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
  896. {$define FPC_SYSTEM_HAS_GET_FRAME}
  897. function get_frame:pointer;assembler;
  898. asm
  899. { all abi's I know use r1 as stack pointer }
  900. mr r3, r1
  901. end;
  902. {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
  903. function get_caller_addr(framebp:pointer):pointer;assembler;
  904. asm
  905. cmplwi r3,0
  906. beq .Lcaller_addr_frame_null
  907. lwz r3,0(r3)
  908. cmplwi r3,0
  909. beq .Lcaller_addr_frame_null
  910. {$ifdef FPC_ABI_AIX}
  911. lwz r3,8(r3)
  912. {$else FPC_ABI_AIX}
  913. lwz r3,4(r3)
  914. {$endif FPC_ABI_AIX}
  915. .Lcaller_addr_frame_null:
  916. end;
  917. {$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
  918. function get_caller_frame(framebp:pointer):pointer;assembler;
  919. asm
  920. cmplwi r3,0
  921. beq .Lcaller_frame_null
  922. lwz r3,0(r3)
  923. .Lcaller_frame_null:
  924. end;
  925. {$define FPC_SYSTEM_HAS_ABS_LONGINT}
  926. function abs(l:longint):longint; assembler;[internconst:in_const_abs];
  927. asm
  928. srawi r0,r3,31
  929. add r3,r0,r3
  930. xor r3,r3,r0
  931. end;
  932. {****************************************************************************
  933. Math
  934. ****************************************************************************}
  935. {$define FPC_SYSTEM_HAS_ODD_LONGINT}
  936. function odd(l:longint):boolean;assembler;[internconst:in_const_odd];
  937. asm
  938. rlwinm r3,r3,0,31,31
  939. end;
  940. {$define FPC_SYSTEM_HAS_SQR_LONGINT}
  941. function sqr(l:longint):longint;assembler;[internconst:in_const_sqr];
  942. asm
  943. mullw r3,r3,r3
  944. end;
  945. {$define FPC_SYSTEM_HAS_SPTR}
  946. Function Sptr : Pointer;assembler;
  947. asm
  948. mr r3,r1
  949. end;
  950. {****************************************************************************
  951. Str()
  952. ****************************************************************************}
  953. { int_str: generic implementation is used for now }
  954. {****************************************************************************
  955. Multithreading
  956. ****************************************************************************}
  957. { do a thread save inc/dec }
  958. {$define FPC_SYSTEM_HAS_DECLOCKED}
  959. function declocked(var l : longint) : boolean;assembler;
  960. { input: address of l in r3 }
  961. { output: boolean indicating whether l is zero after decrementing }
  962. asm
  963. .LDecLockedLoop:
  964. lwarx r10,0,r3
  965. subi r10,r10,1
  966. stwcx. r10,0,r3
  967. bne- .LDecLockedLoop
  968. cntlzw r3,r10
  969. srwi r3,r3,5
  970. end;
  971. {$define FPC_SYSTEM_HAS_INCLOCKED}
  972. procedure inclocked(var l : longint);assembler;
  973. asm
  974. .LIncLockedLoop:
  975. lwarx r10,0,r3
  976. addi r10,r10,1
  977. stwcx. r10,0,r3
  978. bne- .LIncLockedLoop
  979. end;
  980. {
  981. $Log$
  982. Revision 1.65 2004-01-11 11:10:07 jonas
  983. + cgeneric.inc: implementations of rtl routines based on libc
  984. * system.inc: include cgeneric.inc before powerpc.inc/i386.inc/... if
  985. FPC_USE_LIBC is defined
  986. * powerpc.inc, i386.inc: check whether the routines they implement aren't
  987. implemented yet in another include file (cgeneric.inc)
  988. Revision 1.64 2004/01/10 00:16:20 jonas
  989. * fixed mtfsb0 instruction for assembler reader/writer
  990. * fixed initialisation of fpscr register to avoid spurious SIGPFE's
  991. (uses mtfsb0 instruction, so added extra define in options.pas to avoid
  992. requiring to start with a cross compiler)
  993. Revision 1.63 2004/01/03 19:46:29 jonas
  994. * fixed syntax error caught by Mac OS X' as :)
  995. Revision 1.62 2004/01/02 17:21:50 jonas
  996. + fpc_cpuinit procedure to allow cpu/fpu initialisation before any unit
  997. initialises
  998. + fpu exceptions for invalid operations and division by zero enabled for
  999. ppc
  1000. Revision 1.61 2003/12/28 21:06:56 jonas
  1001. * fixed fillchar for SYSV abi
  1002. Revision 1.60 2003/12/21 21:23:09 florian
  1003. * fixed compilation with sysv calling conventions
  1004. Revision 1.59 2003/12/09 20:08:30 jonas
  1005. * fixed buffer overflow bug in fpc_shortstr_append_shortstr in case
  1006. the result was already 255 characters long
  1007. Revision 1.58 2003/12/07 14:27:45 jonas
  1008. * fixed buffer overrun error in fillchar
  1009. Revision 1.57 2003/12/07 13:29:02 jonas
  1010. + added FPC_MOVE alias to move for open array support
  1011. Revision 1.56 2003/11/23 17:34:27 jonas
  1012. * fixed some label names
  1013. Revision 1.55 2003/11/15 19:01:27 florian
  1014. * fixed rtl to work with the integrated fpc ppc assembler reader
  1015. Revision 1.54 2003/09/14 20:33:28 jonas
  1016. * renamed sp to r1, gnu as doesn't understand sp
  1017. Revision 1.53 2003/09/06 10:44:41 olle
  1018. + Used macros ABI_AIX and ABI_SYSV exchanged to FPC_ABI_AIX and FPC_ABI_SYSV.
  1019. Revision 1.52 2003/08/24 20:47:49 olle
  1020. + added support for ABI_AIX in get_caller_addr
  1021. Revision 1.51 2003/06/14 12:41:08 jonas
  1022. * fixed compilation problems (removed unnecessary modified registers
  1023. lists from procedures)
  1024. Revision 1.50 2003/06/01 14:50:17 jonas
  1025. * fpc_shortstr_append_shortstr has to use high(s1) instead of 255 as
  1026. maxlen
  1027. + ppc version of fpc_shortstr_append_shortstr
  1028. Revision 1.49 2003/05/29 21:17:27 jonas
  1029. * compile with -dppc603 to not use unaligned float loads in move() and
  1030. g_concatcopy, because the 603 and 604 take an exception for those
  1031. (and netbsd doesn't even handle those in the kernel). There are
  1032. still some of those left that could cause problems though (e.g.
  1033. in the set helpers)
  1034. Revision 1.48 2003/05/29 14:32:54 jonas
  1035. * changed dcbst to dcbtst (former means "flush cache block to memory,
  1036. the latter means "I will soon store something to that cache block")
  1037. Revision 1.47 2003/05/29 12:14:02 jonas
  1038. * move() now uses dcbz if possible
  1039. Revision 1.46 2003/05/17 00:19:51 jonas
  1040. * fixed inclocked
  1041. Revision 1.45 2003/05/14 19:47:35 jonas
  1042. * fixed stupid bug in filldword
  1043. Revision 1.44 2003/05/13 20:39:26 florian
  1044. * uncommented shortstring compare, buggy
  1045. Revision 1.43 2003/05/12 19:39:33 jonas
  1046. * fixed final fillchar error (tfillchr passes now)
  1047. Revision 1.42 2003/05/12 19:00:50 jonas
  1048. * fixed bug in fillchar
  1049. Revision 1.41 2003/05/10 20:33:39 jonas
  1050. * fixed get_caller_frame and get_caller_addr
  1051. Revision 1.40 2003/05/10 17:33:06 jonas
  1052. * final (? :) fix to move, passes new tests/test/tmove test
  1053. Revision 1.39 2003/05/02 19:03:25 jonas
  1054. * fixed some bugs in move()
  1055. Revision 1.38 2003/04/27 16:24:44 jonas
  1056. - disabled fpc_shortstr_concat because it's called differently than that
  1057. routine is declared
  1058. Revision 1.37 2003/04/26 20:37:17 jonas
  1059. * fixed and re-enabled routines commented out by Florian :)
  1060. Revision 1.36 2003/04/26 17:46:49 florian
  1061. * commented out not working routines
  1062. * reactivated assembler fillchar
  1063. Revision 1.35 2003/04/26 17:35:15 jonas
  1064. * fixed FillChar
  1065. Revision 1.34 2003/04/26 12:05:10 florian
  1066. * removed object/class helpers, the compiler uses the generic ones
  1067. Revision 1.33 2003/04/26 11:55:52 florian
  1068. * fixed newlines
  1069. Revision 1.32 2003/04/23 21:04:48 florian
  1070. * fixed fpc_shortstr_to_shortstr
  1071. Revision 1.31 2003/03/17 14:30:11 peter
  1072. * changed address parameter/return values to pointer instead
  1073. of longint
  1074. Revision 1.30 2003/03/12 19:21:29 jonas
  1075. + implemented get_frame()
  1076. * fixed bug in IndexDWord()
  1077. Revision 1.29 2003/01/09 20:14:35 florian
  1078. * fixed helper declarations
  1079. Revision 1.28 2003/01/09 13:38:56 florian
  1080. * dec/inclocked got defines
  1081. Revision 1.27 2002/11/07 15:23:13 jonas
  1082. * always use code that was between 'ifdef mt', since that define is
  1083. deprecated now
  1084. Revision 1.26 2002/11/01 13:27:55 jonas
  1085. * changed "dcbtst r0,x" to "dcbtst 0,x"
  1086. Revision 1.25 2002/10/23 15:26:00 olle
  1087. * excluded saverestorereg for target macos
  1088. Revision 1.24 2002/10/20 13:40:55 jonas
  1089. * move/fill*/index*/comp* routines immediately exit if length is negative
  1090. Revision 1.23 2002/10/17 10:12:50 jonas
  1091. * fixed return value of declocked()
  1092. Revision 1.22 2002/10/05 14:20:16 peter
  1093. * fpc_pchar_length compilerproc and strlen alias
  1094. Revision 1.21 2002/10/02 18:21:52 peter
  1095. * Copy() changed to internal function calling compilerprocs
  1096. * FPC_SHORTSTR_COPY renamed to FPC_SHORTSTR_ASSIGN because of the
  1097. new copy functions
  1098. Revision 1.20 2002/09/10 21:30:34 jonas
  1099. * disabled powerpc-specific fpc_shortstr_concat for now, it was
  1100. completely wrong
  1101. Revision 1.19 2002/09/10 17:47:20 jonas
  1102. * fixed bug with concatting 0-length shortstrings
  1103. Revision 1.18 2002/09/07 16:01:26 peter
  1104. * old logs removed and tabs fixed
  1105. Revision 1.17 2002/08/31 21:29:57 florian
  1106. * several PC related fixes
  1107. Revision 1.16 2002/08/31 16:08:36 florian
  1108. * fixed undefined labels
  1109. Revision 1.15 2002/08/31 13:11:11 florian
  1110. * several fixes for Linux/PPC compilation
  1111. Revision 1.14 2002/08/18 22:11:10 florian
  1112. * fixed remaining assembler errors
  1113. Revision 1.13 2002/08/18 21:37:48 florian
  1114. * several errors in inline assembler fixed
  1115. Revision 1.12 2002/08/10 17:14:36 jonas
  1116. * various fixes, mostly changing the names of the modifies registers to
  1117. upper case since that seems to be required by the compiler
  1118. Revision 1.11 2002/07/30 17:29:53 florian
  1119. + dummy setjmp and longjmp added
  1120. + dummy implemtation of the destructor helper
  1121. Revision 1.10 2002/07/28 21:39:29 florian
  1122. * made abs a compiler proc if it is generic
  1123. Revision 1.9 2002/07/28 20:43:49 florian
  1124. * several fixes for linux/powerpc
  1125. * several fixes to MT
  1126. Revision 1.8 2002/07/26 15:45:56 florian
  1127. * changed multi threading define: it's MT instead of MTRTL
  1128. }