Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resoning behind comparison to -0 and +0 #143

Merged
merged 1 commit into from
Apr 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2019 IBM Corp.
* Copyright (c) 2017, 2022 IBM Corp.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which accompanies this distribution
Expand Down Expand Up @@ -2519,6 +2519,14 @@ public void testShiftLeftInvalidPrecision()
@Test
public void testLeftOffsetOne()
{
/* Both expectedArray and expectedArray2 are needed because
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VermaSh We do not need to quote PoPs here. I think if you elaborate on behavior difference from z14 and z15 here, it would be sufficient. (I think one of the updates you posted earlier on internal issue would be more suitable).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have replaced the quote with a summary explaining the behavior change.

* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down Expand Up @@ -3449,6 +3457,14 @@ public double shiftRight(double x, int shift, boolean round)
@Test
public void testShiftLeftUnitCases()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down Expand Up @@ -3554,6 +3570,14 @@ public void testShiftLeftUnitCases()
@Test
public void testShiftRightUnitCases()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down Expand Up @@ -4481,6 +4505,14 @@ public void testRightShiftTopNibbleGarbage()
@Test
public void testZeroShifts1()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down Expand Up @@ -4508,6 +4540,14 @@ public void testZeroShifts1()
@Test
public void testZeroShifts2()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand All @@ -4532,6 +4572,14 @@ public void testZeroShifts2()
@Test
public void testZeroShifts3()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down Expand Up @@ -4561,6 +4609,14 @@ public void testZeroShifts3()
@Test
public void testZeroShifts4()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down