News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to generate JA/JNA jump using .IF syntax?

Started by MazeGen, September 22, 2005, 02:37:15 PM

Previous topic - Next topic

QvasiModo

Quote from: Farabi on September 29, 2005, 03:33:07 PM
Hai. Jz and je is all the same. So do jg or ja, so it cannot be happen.
(Am I wrong remember the opcode?)

JZ and JE are the same, but JG and JA are not. JG is for signed comparisons and JA for unsigned. Of course the opcodes are also different.

Farabi

Quote from: QvasiModo on September 29, 2005, 06:37:04 PM
Quote from: Farabi on September 29, 2005, 03:33:07 PM
Hai. Jz and je is all the same. So do jg or ja, so it cannot be happen.
(Am I wrong remember the opcode?)

JZ and JE are the same, but JG and JA are not. JG is for signed comparisons and JA for unsigned. Of course the opcodes are also different.

Thanks. Yes, you are right. I have forget it.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

sonthakit

I agree that Developer of MASM32 should improve the code include above? and other jump condition
Because I have same problem when I write

sub eax,ebx
jbe XXX

I can not use .if directive to generate that code. MASM cannot make that code.
And I did not agree to use

sub eax,ebx
.if eax <= 0
because it generate the code

sub eax,ebx
or eax,eax
jbe XXX

I concern about my program speed very much in the nano-second. I did not want any unnecessary code in my program.
Developer! if you read my post. Please include this comment in new version of MASM32

Thank

hutch--

This code,


    sub eax,ebx
    .if eax <= 0                ; unsigned comparison
    nop
    .endif

    nop
    nop
    nop

    sub eax,ebx
    .if SDWORD PTR eax <= 0     ; signed comparison
    nop
    .endif

    ret


generates this disassembly.


00401025                    fn_00401025:                ; Xref 00401000
00401025 2BC3                   sub     eax,ebx
00401027 83F800                 cmp     eax,0
0040102A 7701                   ja      loc_0040102D
0040102C 90                     nop
0040102D                    loc_0040102D:               ; Xref 0040102A
0040102D 90                     nop
0040102E 90                     nop
0040102F 90                     nop
00401030 2BC3                   sub     eax,ebx
00401032 83F800                 cmp     eax,0
00401035 7F01                   jg      loc_00401038
00401037 90                     nop
00401038                    loc_00401038:               ; Xref 00401035
00401038 C3                     ret
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

sonthakit

Sorry. I write the code wrong.

It is not or eax,eax but cmp eax,0

But my point is := I is not necessary to code cmp eax,0
because sub eax,ebx always set the EFLAGS
and you can jbe immediately.
How I can use .if without code cmp eax,0
I think it is not possible this time.

hutch--

hmmmm,

Quote
I concern about my program speed very much in the nano-second. I did not want any unnecessary code in my program.
Developer! if you read my post. Please include this comment in new version of MASM32

If you ae serious about speed, write your own code manually, the block .IF syntax is for less critical high level parts of code.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

sonthakit

This MASM32 version has command .if zero?
So. I suggest add the command

.if above?
.if !above?

next version of MASM.

hutch--

If you have suggestions about how to improve MASM, send them to Microsoft as they wrote MASM.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

mnemonic

sonthakit,

AFAIK there are no developers of MASM (ml.exe) registered in this forum.
If you want any features to be added to MASM you will have to contact Microsoft.

The MASM32 project has different aims, e.g. providing you include files and helper macros.

Don't mix that up.  :wink

EDIT: Too slow...  :bg
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

MazeGen

I thing this topic goes completely wrong way. I'm locking it.