20
{$ifndef FPC_SYSTEM_HAS_MOVE}
21
{$define FPC_SYSTEM_FPC_MOVE}
22
{$endif FPC_SYSTEM_HAS_MOVE}
24
{$ifdef FPC_SYSTEM_FPC_MOVE}
21
26
cpu_has_edsp : boolean = false;
22
27
in_edsp_test : boolean = false;
28
{$endif FPC_SYSTEM_FPC_MOVE}
24
procedure fpc_cpuinit;
26
30
{$if not(defined(wince)) and not(defined(gba)) and not(defined(nds)) and not(defined(FPUSOFT)) and not(defined(FPULIBGCC))}
31
{$define FPC_SYSTEM_HAS_SYSINITFPU}
32
Procedure SysInitFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
27
34
{ Enable FPU exceptions, but disable INEXACT, UNDERFLOW, DENORMAL }
41
53
Procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
43
55
softfloat_exception_flags:=0;
58
{$define FPC_SYSTEM_HAS_SYSINITFPU}
59
Procedure SysInitFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
44
61
softfloat_exception_mask:=float_flag_underflow or float_flag_inexact or float_flag_denormal;
45
62
{ Enable FPU exceptions, but disable INEXACT, UNDERFLOW, DENORMAL }
46
63
{ FPU precision 64 bit, rounding to nearest, affine infinity }
291
308
{$endif FPC_SYSTEM_HAS_MOVE}
310
{****************************************************************************
312
****************************************************************************}
314
{$ifndef FPC_SYSTEM_HAS_FPC_SHORTSTR_ASSIGN}
315
{$define FPC_SYSTEM_HAS_FPC_SHORTSTR_ASSIGN}
317
{$ifndef FPC_STRTOSHORTSTRINGPROC}
318
function fpc_shortstr_to_shortstr(len:longint;const sstr:shortstring):shortstring;assembler;nostackframe;[public,alias: 'FPC_SHORTSTR_TO_SHORTSTR'];compilerproc;
320
procedure fpc_shortstr_to_shortstr(out res:shortstring;const sstr:shortstring);assembler;nostackframe;[public,alias: 'FPC_SHORTSTR_TO_SHORTSTR'];compilerproc;
331
cmp r12,#6 (* 6 seems to be the break even point. *)
333
(* Align destination on 32bits. This is the only place where unrolling
334
really seems to help, since in the common case, sstr is aligned on
335
32 bits, therefore in the common case we need to copy 3 bytes to
336
align, i.e. in the case of a loop, you wouldn't branch out early.*)
350
(* Destination should be aligned now, but source might not be aligned,
351
if this is the case, do a byte-per-byte copy. *)
354
(* Start the main copy, 32 bit at a time. *)
359
(* Unrolling this loop would save a little bit of time for long strings
360
(>20 chars), but alas, it hurts for short strings and they are the
367
(* Do remaining bytes. *)
378
procedure fpc_shortstr_assign(len:longint;sstr,dstr:pointer);assembler;nostackframe;[public,alias:'FPC_SHORTSTR_ASSIGN'];compilerproc;
389
cmp r12,#6 (* 6 seems to be the break even point. *)
391
(* Align destination on 32bits. This is the only place where unrolling
392
really seems to help, since in the common case, sstr is aligned on
393
32 bits, therefore in the common case we need to copy 3 bytes to
394
align, i.e. in the case of a loop, you wouldn't branch out early.*)
408
(* Destination should be aligned now, but source might not be aligned,
409
if this is the case, do a byte-per-byte copy. *)
412
(* Start the main copy, 32 bit at a time. *)
417
(* Unrolling this loop would save a little bit of time for long strings
418
(>20 chars), but alas, it hurts for short strings and they are the
425
(* Do remaining bytes. *)
435
{$endif FPC_SYSTEM_HAS_FPC_SHORTSTR_ASSIGN}
437
{$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
438
{$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
439
function fpc_Pchar_length(p:Pchar):longint;assembler;nostackframe;[public,alias:'FPC_PCHAR_LENGTH'];compilerproc;
446
bne .Ltest_unaligned (*No, do byte per byte.*)
449
(*Aligned, load 4 bytes at a time.*)
451
(*Check wether r12 contains a 0 byte.*)
455
ands r2,r2,r3,lsl #7 (*r3 lsl 7 = $80808080*)
456
beq .Ltest_aligned (*No 0 byte, repeat.*)
460
cmp r12,#1 (*r12<1 same as r12=0, but result in carry flag*)
462
(*Dirty trick: we need to subtract 1 extra because we have counted the
463
terminating 0, due to the known carry flag sbc can do this.*)
294
473
fpc_system_lock: longint; export name 'fpc_system_lock';