From 5ae1d2b774647c70533d67bcf985c0ce1a78e4a5 Mon Sep 17 00:00:00 2001 From: Mohammad Nazmul Alam Date: Wed, 13 Jan 2021 11:15:47 -0500 Subject: [PATCH] Fix b2iEvaluator in power for bRegLoad The b2iEvaluator currently does not generate sign extension for bRegLoad. While it will work for sign extended bRegLoad, it may yield wrong result if the byte was not sign extended. This commit cover such cases, by making sure bRegLoad is always sign extended. Fixes: eclipse/openj9#11192 Signed-off-by: Mohammad Nazmul Alam --- compiler/p/codegen/UnaryEvaluator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/p/codegen/UnaryEvaluator.cpp b/compiler/p/codegen/UnaryEvaluator.cpp index b7ca0326f96..9d6bf17658a 100644 --- a/compiler/p/codegen/UnaryEvaluator.cpp +++ b/compiler/p/codegen/UnaryEvaluator.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2020 IBM Corp. and others + * Copyright (c) 2000, 2021 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -249,7 +249,8 @@ TR::Register *OMR::Power::TreeEvaluator::b2iEvaluator(TR::Node *node, TR::CodeGe child->getOpCodeValue() != TR::d2b && child->getOpCodeValue() != TR::i2b && child->getOpCodeValue() != TR::l2b && - child->getOpCodeValue() != TR::iRegLoad )) + child->getOpCodeValue() != TR::iRegLoad && + child->getOpCodeValue() != TR::bRegLoad )) { trgReg = cg->gprClobberEvaluate(child); }