Recent

Author Topic: Use asm  (Read 1583 times)

yazigegeda

  • Newbie
  • Posts: 3
Use asm
« on: October 07, 2021, 06:44:18 am »
How can I deal with this error! Help me, I want to execute asm! :( :( :(

Handoko

  • Hero Member
  • *****
  • Posts: 5151
  • My goal: build my own game engine using Lazarus
Re: Use asm
« Reply #1 on: October 07, 2021, 07:28:57 am »
Maybe this can help you:
https://stackoverflow.com/questions/13874152/porting-assembler-x86-cpu-id-code-to-amd64#13876674

You forgot to declare the type of TCPUID.
« Last Edit: October 07, 2021, 07:30:31 am by Handoko »

Thaddy

  • Hero Member
  • *****
  • Posts: 14367
  • Sensorship about opinions does not belong here.
Re: Use asm
« Reply #2 on: October 07, 2021, 07:30:27 am »
TCPUId is not declared. You are probably missing a unit.
OTOH the cpuid instruction is available for supported Intel/AMD processors.
« Last Edit: October 07, 2021, 08:40:26 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11447
  • FPC developer.
Re: Use asm
« Reply #3 on: October 07, 2021, 09:32:40 am »
Some CPUID uses have been preprepared in the cpu unit:

Code: Pascal  [Select][+][-]
  1.  
  2.     { returns true, if the processor supports the cpuid instruction }
  3.     function cpuid_support : boolean;
  4.  
  5.     { returns true, if floating point is done by an emulator }
  6.     function floating_point_emulation : boolean;
  7.  
  8.     { returns the contents of the cr0 register }
  9.     function cr0 : longint;
  10.  
  11.     function InterlockedCompareExchange128Support : boolean;
  12.     function AESSupport : boolean;inline;
  13.     function AVXSupport: boolean;inline;
  14.     function AVX2Support: boolean;inline;
  15.     function AVX512FSupport: boolean;inline;    
  16.     function AVX512DQSupport: boolean;inline;    
  17.     function AVX512IFMASupport: boolean;inline;    
  18.     function AVX512PFSupport: boolean;inline;    
  19.     function AVX512ERSupport: boolean;inline;    
  20.     function AVX512CDSupport: boolean;inline;    
  21.     function AVX512BWSupport: boolean;inline;    
  22.     function AVX512VLSupport: boolean;inline;    
  23.     function FMASupport: boolean;inline;
  24.     function POPCNTSupport: boolean;inline;
  25.     function SSE41Support: boolean;inline;
  26.     function SSE42Support: boolean;inline;
  27.     function MOVBESupport: boolean;inline;
  28.     function F16CSupport: boolean;inline;
  29.     function RDRANDSupport: boolean;inline;
  30.     function RTMSupport: boolean;inline;
  31.     function BMI1Support: boolean;inline;
  32.     function BMI2Support: boolean;inline;
  33.  
  34.     var
  35.       is_sse3_cpu : boolean = false;
  36.  
  37.     function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec;
  38.  

yazigegeda

  • Newbie
  • Posts: 3
Re: Use asm
« Reply #4 on: October 07, 2021, 10:57:29 am »
Thanks everyone for your help, I have solved the problem

 

TinyPortal © 2005-2018