mips.inc 684 B

123456789101112131415161718192021222324252627282930
  1. {$i ../mips/mips.inc}
  2. {$ifndef FPC_SYSTEM_HAS_SAR_QWORD}
  3. {$ifdef ENDIAN_LITTLE}
  4. {$define FPC_SYSTEM_HAS_SAR_QWORD}
  5. function fpc_SarInt64(Const AValue : Int64;const Shift : Byte): Int64; [Public,Alias:'FPC_SARINT64']; compilerproc; assembler; nostackframe;
  6. asm
  7. { $a1=high(AValue),$a0=low(AValue), result: $v1:$v0 }
  8. andi $a2,$a2,63
  9. sltiu $t0,$a2,32
  10. beq $t0,$0,.L1
  11. nop
  12. srlv $v0,$a0,$a2
  13. srav $v1,$a1,$a2
  14. beq $a2,$0,.Lexit
  15. nop
  16. subu $t0,$0,$a2
  17. sllv $t0,$a1,$t0
  18. or $v0,$v0,$t0
  19. b .Lexit
  20. nop
  21. .L1:
  22. sra $v1,$a1,31
  23. srav $v0,$a1,$a2
  24. .Lexit:
  25. end;
  26. {$endif ENDIAN_LITTLE}
  27. {$endif FPC_SYSTEM_HAS_SAR_QWORD}