Recent

Author Topic: [SOLVED] __builtin_prefetch  (Read 294 times)

julkas

  • Hero Member
  • *****
  • Posts: 598
  • KISS principle / Lazarus 2.0.6 / FPC 3.0.4
[SOLVED] __builtin_prefetch
« on: June 06, 2020, 06:25:59 am »
I need  C  __builtin_prefetch analog.
Any hint?
« Last Edit: June 06, 2020, 11:46:34 am by julkas »
procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
asm
  mov rax, a
  mov rdx, b
  mul rdx
  mov [clo], rax
  mov [chi], rdx
end;

Thaddy

  • Hero Member
  • *****
  • Posts: 10186
Re: __builtin_prefetch
« Reply #1 on: June 06, 2020, 10:30:34 am »
isn't it just (intel/amd):
Code: Pascal  [Select][+][-]
  1. procedure prefetch;inline;asm prefetch;end;
Note that prefetch is not very useful on modern processors.
(But it had a marked improvement on old amd64.)
« Last Edit: June 06, 2020, 10:44:53 am by Thaddy »
I am more like donkey than shrek

PascalDragon

  • Hero Member
  • *****
  • Posts: 1692
  • Compiler Developer
Re: __builtin_prefetch
« Reply #2 on: June 06, 2020, 11:01:33 am »
I need  C  __builtin_prefetch analog.
Any hint?

It's simply called Prefetch. It will only have an effect on x86 (all three bitnesses), PowerPC (both bitnesses) and ARM as only there it's backend is implemented. On other platforms won't have an effect.

julkas

  • Hero Member
  • *****
  • Posts: 598
  • KISS principle / Lazarus 2.0.6 / FPC 3.0.4
Re: __builtin_prefetch
« Reply #3 on: June 06, 2020, 11:45:53 am »
procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
asm
  mov rax, a
  mov rdx, b
  mul rdx
  mov [clo], rax
  mov [chi], rdx
end;

 

TinyPortal © 2005-2018