ref: dee140f9c5d4bd9c3f56c4c057fb20035ddac04e
parent: 61a95a1e7c53f2a2346ac9b565d54190d890bdcc
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Jul 4 19:53:01 EDT 2023
7c: dont replace SXTW instruction following MOVW $const, r All the MOVW instructions sign extend to full register size, but "MOVW $cosnt, R" is the exception, being equivalent to "MOVWU $const, R" (for historical reasons?). This fixes hjfs regression.
--- a/sys/src/cmd/7c/peep.c
+++ b/sys/src/cmd/7c/peep.c
@@ -252,11 +252,14 @@
if((r1 = findset(r, &p->from)) != R){
p1 = r1->prog;
switch(p1->as){
+ case AMOVW:
+ /* MOVW $const,r; does not sign extend */
+ if(p1->from.type == D_CONST && (p1->from.offset & 0x80000000) != 0)
+ break;
case AMOVB:
- case AMOVBU:
case AMOVH:
+ case AMOVBU:
case AMOVHU:
- case AMOVW:
if(p1->to.type == p->from.type && p1->to.reg == p->from.reg)
p->as = AMOVW;
break;
--
⑨