View previous topic :: View next topic
|
Author |
Message |
himanshupant
New User
Joined: 21 Mar 2007 Posts: 46 Location: India
|
|
|
|
I have the below statement
TM SWITCH,X'00'
In the above case what would be the condition code set to after the TM for assuming
1) SWITCH is all zeros
2) SWITCH is all Ones
3) SWITCH is mixed zeros and ones.
For any other mask i.e. one not having zeroes , the IBM manual says the condition code is
0 all selected bits are zero
1 selected bits are mixed
2 not used!
3 all selected bits are one
but for the above case when the mask itself is zeroes , no bit would be selected .So how will the instruction behave ? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
I guess that the cc wouldn't change....
Checking my POP shows "0 Selected bits all-zero; mask is all-zero".
Good guess Bill... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Test under Mask (TM) assumes that you are looking for an "on" condition in one or more of the tested bits.
If you don't want to test for at least one bit on, there is no need to issue the TM. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Is TM an EXecutable instruction? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Bill,
Yes, it is a way to test bit patterns. The machine code is x'91' (no i've not memorized the op-codes ). |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
No, I mean is it and instruction that you can EX, overlaying the bit pattern part of the instruction like you can when you EX a MVC and overlay the length? |
|
Back to top |
|
|
himanshupant
New User
Joined: 21 Mar 2007 Posts: 46 Location: India
|
|
|
|
I agree Dick that with the test mask x'00' no bit would be tested .But the case I am pointing out has occured in a production code.So I was wondering that it might be changing the condition code somehow , because after this TM there is a BNO condition. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Without having the code to experiment with, my guess is that you have a rather elaborate unconditional branch. . .
Bill, i'm not sure if it can be EXed or not. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Hi !
quoting from the esa/390 principles of operations
Quote: |
TM D1(B1),I2 [SI]
|'91' | I2 | B1 | D1
A mask is used to select bits of the first operand, and the result is
indicated in the condition code.
The byte of immediate data, I2, is used as an eight-bit mask. The bits of the mask are made to correspond one for one with the bits of the byte in storage designated by the first-operand address.
A mask bit of one indicates that the storage bit is to be tested. When the mask bit is zero, the storage bit is ignored. When all storage bits thus selected are zero, condition code 0 is set. Condition code 0 is also set when the mask is all zeros. When the selected bits are all ones, condition code 3 is set; otherwise, condition code 1 is set.
Access exceptions associated with the storage operand are recognized for one byte even when the mask is all zeros.
Resulting Condition Code:
0
Selected bits all zeros; or mask bits all zeros
1
Selected bits mixed zeros and ones
2
--
3
Selected bits all ones
Program Exceptions:
* Access (fetch, operand 1)
|
The POP is clear.....
what manual were You reading which raised Your doubts?
And YES, the TM can be the object of an EX instruction
regards
e.s |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Hi back,
enrico-sorichetti wrote: |
And YES, the TM can be the object of an EX instruction |
Thanks, I kinda thought that from the original description....
Bill |
|
Back to top |
|
|
bengtpelle
New User
Joined: 28 Aug 2006 Posts: 24 Location: St. Petersburg, FL
|
|
|
|
I do not think that you got the full picture. From reading above, I noticed that you had a BNO after the TM for X'00".
This BNO is useless and it will never be executed.
It is true that the TM can be executed, however if it is, the BNO should be placed after the EX instruction, not after the TM. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
In the initial post and the follow up from himanshupant, there was no EX mentioned.
The EX discussion was (thinking out loud here) wondering if the TM might be configured on the fly rather than always use the x'00' mask.
Why would the BNO "never be executed"? I believe it will be executed every time thru the code and will always do the same thing - as mentioned earlier, "a rather elaborate unconditional branch". . . . |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
bengtpelle wrote: |
I noticed that you had a BNO after the TM for X'00".
This BNO is useless and it will never be executed. |
That bring up another old trick, XI/NI to chane the bit settings.... |
|
Back to top |
|
|
bengtpelle
New User
Joined: 28 Aug 2006 Posts: 24 Location: St. Petersburg, FL
|
|
|
|
XI, NI would work.
To figure that out, there should be a label on the TM instruction.
A dump could tell us if the TM was modified.
Here is a totaly unrelated idea....
Have you ever tried to Execute a BALR instruction????
Quite facinating thought on program flow.
I have used it to protect program logic from debugging. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Nasty.....But we don't code that way anymore, do we.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Whatever does
Quote: |
I have used it to protect program logic from debugging. |
really mean?
As posted, it says there is code that should not be subjected to debugging. Not a concept i'm familiar with. . .
If it means that you are trying to conceal what the code actually does, that is a very bad practice.
If i,ve misunderstood, my apologies. |
|
Back to top |
|
|
bengtpelle
New User
Joined: 28 Aug 2006 Posts: 24 Location: St. Petersburg, FL
|
|
|
|
No we don't, but I wish we could. |
|
Back to top |
|
|
|