flat assembler
Message board for the users of flat assembler.

Index > Main > Would you like to have removed redundant instructions?


Would you like to have removed redundant instructions?
yes
6%
 6%  [ 1 ]
no
86%
 86%  [ 13 ]
whatever
6%
 6%  [ 1 ]
Total Votes : 15

Author
Thread Post new topic Reply to topic
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
Hi. I'm doing a hobby-only assembler and i would like to ask everyone if you would like to have removed all redundant instructions.

example in Jcc instructions:

in this list, column (1) would be turned into column (2):
Code:
(1)      (2)
jo    -> jo
jno -> jno
jb -> jb
jnae        
jc  -> jc
jnb
jae  -> jae
jnc        -> jnc
jz -> jz
je          
jnz -> jnz
jne                
jbe -> jbe
jna                
jnbe        
ja  -> ja
js  -> js
jns -> jns
jp
jpe  -> jpe
jnp        -> jnp
jpo
jl  -> jl
jnge
jnl
jge  -> jge
jle        -> jle
jng
jnle
jg  -> jg    

About 12 instructions less.

_________________
Sorry if bad english.
Post 16 Sep 2011, 13:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17281
Location: In your JS exploiting you and your system
revolution
What is your reasoning for removing them? They encode to the same binary, the only extra storage is in the assembler opcode list.

Personally I find it useful to have both JA and JNBE etc. Depending upon the circumstances it helps to understand the code easier when selecting the appropriate mnemonic.
Post 16 Sep 2011, 13:21
View user's profile Send private message Visit poster's website Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
the main purpose is to keep a pattern. in high-lvl-lang we have a few options: <, >, <=, >=, !=, ==, so i was thougth to keep things simplier. Of course they use symbols instead textual instruction. So i was wondering if it would be better doing so in a textual context.


Last edited by Teehee on 16 Sep 2011, 13:28; edited 1 time in total
Post 16 Sep 2011, 13:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17281
Location: In your JS exploiting you and your system
revolution
Assembly != HLL
Post 16 Sep 2011, 13:28
View user's profile Send private message Visit poster's website Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
if you consider a disassembler, it will choose one of them to use always. doesn't? unless, for example, if it was able to find a switch/case context and put je instead jz in that context. Or, yet, using JE after CMP instructions and JZ after TEST inst. Things like that.

yeah, not HLL, but that doens't mean you can't make things easier/simplier.
Post 16 Sep 2011, 13:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17281
Location: In your JS exploiting you and your system
revolution
I don't bother with the disassembler case, I deal with source code. Anything that makes my source code easier to understand is not a bad thing.

Anyhow, if you want to remove some mnemonics then go ahead, just that you won't find me being one of the users of your assembler.

> "make things easier/simplier".

Simpler for who? The author of the assembler? Easier for who? The author of the assembler?
Post 16 Sep 2011, 13:43
View user's profile Send private message Visit poster's website Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
to the user dear revolution Smile

This is the purpose of this poll: if you like or not, if it is simplier for you or not. If no one like i will keep them. Particulary, in a programming context, i don't like to have many options to make the same thing. Again: in a object oriented context thats not a good thing. Do you think there is some problem to take some of this principles and apply in assembly context?

You are a traditional assembly guy Wink


Last edited by Teehee on 16 Sep 2011, 14:04; edited 1 time in total
Post 16 Sep 2011, 13:45
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17281
Location: In your JS exploiting you and your system
revolution
I can't see how it makes it simpler for the user Question

Let's see:
Code:
cmp ...
je somewhere
cmovne reg1,reg2    
Assembler says: Unknown opcode JE.

User says: Hmm, which one was it again that is allowed? Oh, it must be JZ.

Try again with JZ.
Code:
cmp ...
jz somewhere
cmovne reg1,reg2    
Assembler says: Unknown opcode CMOVNE.

User says: AARRGHH, this is very frustrating!
Post 16 Sep 2011, 14:01
View user's profile Send private message Visit poster's website Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
haha yeah that may happen to a non-new assembly users Razz

I think the tradition will say strong in this context, Hmmm. Im already considering* as a bad thing!

*considering to remove the redundant structions
Post 16 Sep 2011, 14:05
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

Quote:
Personally I find it useful to have both JA and JNBE etc.
Depending upon the circumstances it helps to understand the code easier when selecting the appropriate mnemonic.
100% agree with revolution


_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 16 Sep 2011, 14:33
View user's profile Send private message Send e-mail Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
well, me too Razz
Post 16 Sep 2011, 14:39
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz
No way!
Post 16 Sep 2011, 19:20
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
troll...
Post 16 Sep 2011, 22:46
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
Code:
cmp eax,[value]
je equal
test eax,2
jz zero
    


revolution gave the only true reason of duplicate mnemonics, it depends on the circumstances, and help to remember what the code is intented to do.
Post 17 Sep 2011, 12:23
View user's profile Send private message Visit poster's website Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 568
Location: Brazil
Teehee
7 votes no. it seems an unanimity about to do not to remove these instructions. Thanks for replies and rev. for the arguments.
Post 17 Sep 2011, 16:23
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
8 Smile
Post 17 Sep 2011, 16:31
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.