@@ -11747,11 +11747,6 @@ static TR::Register *inlineStringCodingHasNegativesOrCountPositives(TR::Node *no
11747
11747
TR::Compiler->om.contiguousArrayHeaderSizeInBytes());
11748
11748
}
11749
11749
11750
- // get the starting address
11751
- generateTrg1Src2Instruction(cg, TR::InstOpCode::add, node, startReg, startReg, indexReg);
11752
- // make the index 0 since everything we need is relative to the offset
11753
- generateTrg1ImmInstruction(cg, TR::InstOpCode::li, node, indexReg, 0);
11754
-
11755
11750
// check the first byte
11756
11751
generateTrg1MemInstruction(cg, TR::InstOpCode::lbzx, node, tempReg,
11757
11752
TR::MemoryReference::createWithIndexReg(cg, startReg, indexReg, 1));
@@ -11762,6 +11757,9 @@ static TR::Register *inlineStringCodingHasNegativesOrCountPositives(TR::Node *no
11762
11757
else // when seeking negatives, we need to return 1
11763
11758
generateConditionalBranchInstruction(cg, TR::InstOpCode::blt, node, matchLabel, cr6);
11764
11759
11760
+ // count from the offset position since we are supposed to return (index-offset)
11761
+ generateTrg1Src2Instruction(cg, TR::InstOpCode::add, node, startReg, startReg, indexReg);
11762
+ generateTrg1ImmInstruction(cg, TR::InstOpCode::li, node, indexReg, 1);
11765
11763
// if we only have one byte end it here, and return 0 for hasNegative
11766
11764
generateTrg1Src1ImmInstruction(cg, TR::InstOpCode::addi, node, indexReg, indexReg, 1);
11767
11765
generateTrg1Src2Instruction(cg, TR::InstOpCode::cmp4, node, cr6, indexReg, lengthReg);
0 commit comments