And thank you juergenkulow for this adaptative way.juergenkulow wrote: ↑Fri Oct 01, 2021 9:29 amCode: Select all
; fsincos in C Backend Define rcos.f, rsin.f, angle.f=3.141 ! asm volatile("fsincos" : "=%&t" (v_rcos), "=%&u" (v_rsin) : "0" (v_angle)); SetClipboardText(StrF(rsin)+" "+StrF(rcos)) ; 0.0005926211 -0.9999998212
Did ASM syntax changed for PB 6.00 alfa?
Re: Did ASM syntax changed for PB 6.00 alfa?
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: Did ASM syntax changed for PB 6.00 alfa?
I think none of you got the point.
Now you will get it with this short good explanation.
Les say I have this program, in pure 32bit x86:
So, the question is: if those instructions are not recognized by a 64bit x86 CPU, why the hell it runs in a windows 10 x64?
Now you will get it with this short good explanation.
Les say I have this program, in pure 32bit x86:
Well, this program runs ok in win NT or win 2000.push edi
pop edi
So, the question is: if those instructions are not recognized by a 64bit x86 CPU, why the hell it runs in a windows 10 x64?
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
Re: Did ASM syntax changed for PB 6.00 alfa?
Because the cpu too has a 32 bit mode. A search would give you that answer too.
https://en.wikipedia.org/wiki/X86-64
https://en.wikipedia.org/wiki/X86-64
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: Did ASM syntax changed for PB 6.00 alfa?
If it is the case, i.e., if the cpu has 32 bit mode, then ¿why PB x64 is not able to allow those instructions?Rinzwind wrote: ↑Sat Oct 02, 2021 5:00 pm Because the cpu too has a 32 bit mode. A search would give you that answer too.
https://en.wikipedia.org/wiki/X86-64
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
Re: Did ASM syntax changed for PB 6.00 alfa?
It is if you use 32 bit PB
Re: Did ASM syntax changed for PB 6.00 alfa?
It's not a PB problem.
Rinzwind is right.
it's a CPU plateform limitation.
You compile in 32 bit mode, so PUSH/POP EDI is correct (RDI doesn't exist in 32 bit).
You compile in 64 bit mode (so compiler 64 not compiler 32), so PUSH/POP EDI is not correct.
There is no problem to run a 32 bit exe under windows 64 bit version, in that case register will be edi due the fact that your are not in 64-bit mode .
Rinzwind is right.
it's a CPU plateform limitation.
You compile in 32 bit mode, so PUSH/POP EDI is correct (RDI doesn't exist in 32 bit).
You compile in 64 bit mode (so compiler 64 not compiler 32), so PUSH/POP EDI is not correct.
There is no problem to run a 32 bit exe under windows 64 bit version, in that case register will be edi due the fact that your are not in 64-bit mode .
A+
Denis
Denis
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: Did ASM syntax changed for PB 6.00 alfa?
Aha, then there is compiler (or general app) what tell the system if it is a 64bit or 32bit program.
Is is a issue of the ugly CPU architecture, and then, the O.S. policies adapted to it.
Thanks.
Is is a issue of the ugly CPU architecture, and then, the O.S. policies adapted to it.
Thanks.
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
Re: Did ASM syntax changed for PB 6.00 alfa?
Its not an issue thats why you are able to run x86 assembly on an x64 cpu.Psychophanta wrote: ↑Sat Oct 02, 2021 6:34 pm ...
Is is a issue of the ugly CPU architecture, and then, the O.S. policies adapted to it.
...
If you compile to x86 the code will work as usual no changes needed.
(Imho. thats why it is important for PB to support x86.)
The compiler takes care of the context switching between x86 and x64.
U can mix x86 and x64 assembly but then u need to perform context switching manually which is not trivial.
- Psychophanta
- Addict
- Posts: 4997
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Lípetsk, Russian Federation
- Contact:
Re: Did ASM syntax changed for PB 6.00 alfa?
Ok, but clearly it is an ugly stupid issue, since I can do a 16bit code like:Mijikai wrote: ↑Sat Oct 02, 2021 7:54 pmIts not an issue thats why you are able to run x86 assembly on an x64 cpu.Psychophanta wrote: ↑Sat Oct 02, 2021 6:34 pm ...
Is is a issue of the ugly CPU architecture, and then, the O.S. policies adapted to it.
...
If you compile to x86 the code will work as usual no changes needed.
(Imho. thats why it is important for PB to support x86.)
The compiler takes care of the context switching between x86 and x64.
U can mix x86 and x64 assembly but then u need to perform context switching manually which is not trivial.
Code: Select all
!push di
!pop di
BUT can not be done:
Code: Select all
!push edi
!pop edi
So , that is what is called ugly incoherent issue.
Lets be honest, please.
http://www.zeitgeistmovie.com
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB
Re: Did ASM syntax changed for PB 6.00 alfa?
The ASM syntax has already been debated on C fora and, the way to keep hardware compatibility (ARM vs Intel) is found since long time on C.
Fred approached it on Version 6, so the ASM syntax has changed.
Fred approached it on Version 6, so the ASM syntax has changed.
Re: Did ASM syntax changed for PB 6.00 alfa?
@juergenkulowjuergenkulow wrote: ↑Fri Oct 01, 2021 9:29 amCode: Select all
; fsincos in C Backend Define rcos.f, rsin.f, angle.f=3.141 ! asm volatile("fsincos" : "=%&t" (v_rcos), "=%&u" (v_rsin) : "0" (v_angle)); SetClipboardText(StrF(rsin)+" "+StrF(rcos)) ; 0.0005926211 -0.9999998212
How are defined 'u' and 't' ? Have you a link to a documentation about what these characters are referring ?
Other question about my remark : am I wrong about the crossplatform aspect between ARM and Intel standard ? In an other way, is your code adapted to ARM too, as I am supposing ?
Thank you in advance.
-
- Enthusiast
- Posts: 556
- Joined: Wed Sep 25, 2019 10:18 am
Re: Did ASM syntax changed for PB 6.00 alfa?
https://gcc.gnu.org/onlinedocs/gcc.pdf Page 706 (690)
ARM M1 Microarchitecture Firestorml
https://developer.arm.com/documentation/ddi0487/gb/
Code: Select all
; fsincos in C Backend and ASM
Define rcos.f, rsin.f, angle.f=3.141
CompilerIf #PB_Processor_x64=#PB_Compiler_Processor Or #PB_Processor_x86=#PB_Compiler_Processor
CompilerIf Defined(PB_Backend_C,#PB_Constant)
CompilerIf #PB_Compiler_Backend=#PB_Backend_C
! asm volatile("fsincos" : "=%&t" (v_rcos), "=%&u" (v_rsin) : "0" (v_angle));
CompilerElse ;#PB_Backend_ASM
EnableASM
FLD dword [v_angle]
FSINCOS
FSTP dword [v_rcos]
FSTP dword [v_rsin]
DisableASM
CompilerEndIf
CompilerElse ; PB < 6.00
EnableASM
FLD dword [v_angle]
FSINCOS
FSTP dword [v_rcos]
FSTP dword [v_rsin]
DisableASM
CompilerEndIf
CompilerElse ; other Processor
rcos=Cos(angle)
rsin=Sin(angle)
CompilerEndIf
SetClipboardText(StrF(rsin)+" "+StrF(rcos))
; 0.0005926211 -0.9999998212
https://developer.arm.com/documentation/ddi0487/gb/
Re: Did ASM syntax changed for PB 6.00 alfa?
@juergenkulow
To conclude, after having read the docs you provided, is I am wrong about ARM : I do not see an ARM fsincos equivalent.
I note fSinCos is an x86/x64 ASM example which finds crossplatform (this time, for ARM too) libraries, faster than hardware co-processor. But this goes away from the initial subject.
Thank you for the detailed source code.
To conclude, after having read the docs you provided, is I am wrong about ARM : I do not see an ARM fsincos equivalent.
I note fSinCos is an x86/x64 ASM example which finds crossplatform (this time, for ARM too) libraries, faster than hardware co-processor. But this goes away from the initial subject.
Thank you for the detailed source code.