Forum > General

x64 assembly routine - size of integer parameter is ignored

<< < (2/4) > >>

ncs-sniper:
I am fully aware that register calling convention is 32bit-only, in x64 it never had any effect and was ignored. Technically it has no effect even in x86, because register is the default calling convention, so specifying it is superfluous. I am using it pretty much only for delphi compatibility, which is pecifically mentioned in the document you linked.

As for your workaround, that is unfortunatelly not exactly equivalent and I cannot use it in most cases (the real functions are more complex and this could and would break them).

jamie:
In intel mode, if memory serves I believe you may need to help it a little.

using BYTE PTR in the phrase for example and things like that to help the inline ASM better evaluate the phase otherwise it may take the best optimize route.

 I would need to look at the exact details but I its there.

ncs-sniper:
Using BYTE PTR [Value] will load byte from memory address stored in parameter Value, not the Value itself.
I know of no construct how to force assembler to use proper size. Even in AT&T syntax, with instruction mnemonics suffix...

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---movb   %DL, Value... is compiled as:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---8bca  mov    %edx,%ecx %)

WooBean:

--- Quote from: ncs-sniper on June 18, 2022, 05:19:00 pm ---I am fully aware ....

As for your workaround, that is unfortunatelly not exactly equivalent ....

--- End quote ---

What do you mean by  x64 compiler and what were  targets of compilation? I tried your sample from Win7/64, Lazarus 2.2.0, FPC 3.2.2, x86_64-win64 and first platform target was win32/i386 and second win64/x86_64. First platform - win32/i383 target was compiled OK. As for target win64/x86_64 code was not compiled sucessfully (error message axactly matched your info).
My workaround proposal solves problem defined at initial post (assuming your target is win64/x86_64).

Thaddy:
Your work-around would be temporary and that contaminates code.
Use fixes or trunk if you really need it.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version