Post Reply 
Why DEG?
09-26-2024, 10:19 AM (This post was last modified: 09-26-2024 10:23 AM by toml_12953.)
Post: #1
Why DEG?
In the following Nqueens benchmark, why is DEG used after the ISG and DSE statements? There are no trig functions in the program. If they're supposed to be NOPs, why not just use a register increment or decrement? I'm confused.

Code:
LBL "NQUEENS"
        TIME
        STO "T0"
LBL A   CLRG
        8 STO 11
LBL 00  RCL 00 RCL 11
        X=Y? GTO 04
        ISG 00 DEG
        STO IND 00
LBL 01  ISG 10 DEG
        RCL 00 STO 09
LBL 02  DSE 09 DEG
        RCL 09 X=0? GTO 00
        RCL IND 00 RCL IND 09 -
        X=0? GTO 03
        ABS RCL 00 RCL 09 -
        X<>Y? GTO 02
LBL 03  DSE IND 00 GTO 01
        DSE 00 GTO 03
LBL 04  RCL 10
        TIME
        RCL "T0"
        HMS-
        →HR
        3600
        ×
        RTN

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
09-26-2024, 11:55 AM
Post: #2
RE: Why DEG?
Just a guess, but I'd say DEG is being used as a NOP and it executes much faster than any register access or math operation, as it only sets some internal status bit(s).

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-26-2024, 11:59 AM (This post was last modified: 09-26-2024 12:02 PM by Pekis.)
Post: #3
RE: Why DEG?
(09-26-2024 11:55 AM)rprosperi Wrote:  Just a guess, but I'd say DEG is being used as a NOP and it executes much faster than any register access or math operation, as it only sets some internal status bit(s).

... and there won't be any [useful]line skip after the ISG or DSE op
Find all posts by this user
Quote this message in a reply
09-26-2024, 12:45 PM
Post: #4
RE: Why DEG?
It is used as a NOP.

I tried changing it to a synthetic NOP to see if it was much faster but it wasn't much different.

(09-26-2024 11:55 AM)rprosperi Wrote:  Just a guess, but I'd say DEG is being used as a NOP and it executes much faster than any register access or math operation, as it only sets some internal status bit(s).

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
09-26-2024, 10:41 PM
Post: #5
RE: Why DEG?
(09-26-2024 10:19 AM)toml_12953 Wrote:  If they're supposed to be NOPs, why not just use a register increment or decrement?

What specific instruction(s) are you suggesting for "register increment or decrement"? On most HP RPN calculators, ISG/DSE are the fastest register increment and decrement, and the only ones that don't affect the stack. Having to use a NOP of some sort after, if you don't use the conditional execution of the next line, is a small price to pay.
Find all posts by this user
Quote this message in a reply
09-27-2024, 12:36 AM
Post: #6
RE: Why DEG?
(09-26-2024 10:41 PM)brouhaha Wrote:  
(09-26-2024 10:19 AM)toml_12953 Wrote:  If they're supposed to be NOPs, why not just use a register increment or decrement?

What specific instruction(s) are you suggesting for "register increment or decrement"? On most HP RPN calculators, ISG/DSE are the fastest register increment and decrement, and the only ones that don't affect the stack. Having to use a NOP of some sort after, if you don't use the conditional execution of the next line, is a small price to pay.

1
STO+ 00

or

1
STO- 00

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
09-27-2024, 02:27 AM
Post: #7
RE: Why DEG?
(09-26-2024 10:19 AM)toml_12953 Wrote:  In the following Nqueens benchmark, why is DEG used after the ISG and DSE statements?

Using ISG/DSE or ISZ/DSZ is a small optimization, because normally it's faster than 1 STO+/-.
As brouhaha stated, DEG (NOP) is necessary to suppress a skip.

Calculator Benchmark
Find all posts by this user
Quote this message in a reply
09-27-2024, 05:08 AM
Post: #8
RE: Why DEG?
(09-27-2024 12:36 AM)toml_12953 Wrote:  1
STO+ 00

or

1
STO- 00

This disturbs the stack by leaving 1 in X and T content is lost. So not a direct replacement for ISG 00 DEG or DSG 00 DEG.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 4 Guest(s)