summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDoug Gilbert <dgilbert@us.ibm.com>2015-11-02 13:35:42 -0600
committerGregory S. Still <stillgs@us.ibm.com>2015-11-06 10:13:28 -0600
commit7f6c19c51a92d16b0b01787cb77e2de078432be2 (patch)
tree1df2d5bb8fb2fd5f4630df268fca5d81634c3a63 /tools
parent1678bcd4205295dbe2b9ba3b352ee72f4b0510e4 (diff)
downloadtalos-sbe-7f6c19c51a92d16b0b01787cb77e2de078432be2.tar.gz
talos-sbe-7f6c19c51a92d16b0b01787cb77e2de078432be2.zip
Incorrect assembler generated in Powerpc to PPE tool for multiply
Change-Id: Ie32cfc186492b99674756c80ff35a659d2d217bd RTC: 140450 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/21679 Tested-by: Jenkins Server Reviewed-by: Wael Elessawy <welessa@us.ibm.com> Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/PowerPCtoPPE/ppc-ppe-pcp.py39
1 files changed, 27 insertions, 12 deletions
diff --git a/tools/PowerPCtoPPE/ppc-ppe-pcp.py b/tools/PowerPCtoPPE/ppc-ppe-pcp.py
index 80bb3f35..7dd427d6 100755
--- a/tools/PowerPCtoPPE/ppc-ppe-pcp.py
+++ b/tools/PowerPCtoPPE/ppc-ppe-pcp.py
@@ -395,9 +395,15 @@ def p2p_replace(line, ppc_op):
print newline
# construct and write "mr R3, RA" to copy the operand RA to R3
- newline = inst.group(1) + 'mr' + inst.group(3) + '3' +\
- inst.group(5) + inst.group(6)
- print newline
+ # if RA == R3 then R3 was clobbered, restore R3 from stack
+ if inst.group(6) == '3':
+ newline = inst.group(1) + 'lwz' + inst.group(3) + '3' +\
+ inst.group(5) + '8(1)'
+ print newline
+ else:
+ newline = inst.group(1) + 'mr' + inst.group(3) + '3' +\
+ inst.group(5) + inst.group(6)
+ print newline
# if 'mulli' is detected, using 'li' instead of 'mr' for second operand
if ppc_op == 'mulli':
@@ -405,11 +411,13 @@ def p2p_replace(line, ppc_op):
else:
temp_op = 'mr'
- # construct and write "mr R4, RB" to copy the operand RB to R4
- # or in 'mulli' case, "li R4, IM" to copy the operand IM to R4
- newline = inst.group(1) + temp_op + inst.group(3) + '4' +\
- inst.group(5) + inst.group(8)
- print newline
+ # Set R4 if R4 is not already RB
+ if temp_op == 'li' or inst.group(8) != '4':
+ # construct and write "mr R4, RB" to copy the operand RB to R4
+ # or in 'mulli' case, "li R4, IM" to copy the operand IM to R4
+ newline = inst.group(1) + temp_op + inst.group(3) + '4' +\
+ inst.group(5) + inst.group(8)
+ print newline
# using branch and link(bl) to branch to subroutine
# later subroutine can branch back using branch link register(blr)
@@ -418,10 +426,17 @@ def p2p_replace(line, ppc_op):
newline = inst.group(1) + 'bl' + inst.group(3) + ppe_op
print newline
- # construct and write "mr RT, R3" to copy the result in R3 to RT
- newline = inst.group(1) + 'mr' + inst.group(3) + inst.group(4) +\
- inst.group(5) + '3'
- print newline
+ # if RT is not already R3 then copy R3 to RT
+ if inst.group(4) != '3':
+ # construct and write "mr RT, R3" to copy the result in R3 to RT
+ newline = inst.group(1) + 'mr' + inst.group(3) + inst.group(4) +\
+ inst.group(5) + '3'
+ print newline
+ else:
+ # save return on stack
+ newline = inst.group(1) + 'stw' + inst.group(3) + '3' +\
+ inst.group(5) + '8(1)'
+ print newline
# construct and write "lwz R3, 16(R1)" to fetch the LR value from stack
newline = inst.group(1) + 'lwz' + inst.group(3) + '3' +\
OpenPOWER on IntegriCloud