diff --git a/compiler/xtensa/agcpugas.pas b/compiler/xtensa/agcpugas.pas index 9cd1a1c94c..7a865151c2 100644 --- a/compiler/xtensa/agcpugas.pas +++ b/compiler/xtensa/agcpugas.pas @@ -100,11 +100,8 @@ unit agcpugas; begin s:=gas_regname(base); if index<>NR_NO then - begin - s:=s+gas_regname(index); - end - else if offset<>0 then - s:=s+','+tostr(offset); + Internalerror(2020030802); + s:=s+','+tostr(offset); end; end; getreferencestring:=s; diff --git a/compiler/xtensa/cgcpu.pas b/compiler/xtensa/cgcpu.pas index d79d06651a..ed18c994d6 100644 --- a/compiler/xtensa/cgcpu.pas +++ b/compiler/xtensa/cgcpu.pas @@ -227,8 +227,33 @@ implementation procedure tcgcpu.a_load_ref_reg(list : TAsmList; fromsize,tosize : tcgsize; const ref : TReference; reg : tregister); + var + href: treference; + op: TAsmOp; + tmpreg: TRegister; begin - list.Concat(taicpu.op_none(A_NOP)); + href:=ref; + fixref(list,href); + + case fromsize of + OS_8: op:=A_L8UI; + OS_16: op:=A_L16UI; + OS_S8: op:=A_L8UI; + OS_S16: op:=A_L16SI; + + OS_64,OS_S64, { This only happens if tosize is smaller than fromsize } + { We can therefore only consider the low 32-bit of the 64bit value } + OS_32, + OS_S32: op:=A_L32I; + else + internalerror(2020030801); + end; + + list.concat(taicpu.op_reg_ref(op,reg,href)); + if (fromsize=OS_S8) and not(tosize in [OS_S8,OS_8]) then + list.concat(taicpu.op_reg_reg_const(A_SEXT,reg,reg,7)); + if (fromsize<>tosize) and (not (tosize in [OS_SINT,OS_INT])) then + a_load_reg_reg(list,fromsize,tosize,reg,reg); end; diff --git a/compiler/xtensa/xtensaatt.inc b/compiler/xtensa/xtensaatt.inc index 5a6d2de970..9de9945419 100644 --- a/compiler/xtensa/xtensaatt.inc +++ b/compiler/xtensa/xtensaatt.inc @@ -14,6 +14,9 @@ 'callx12', 'entry', 'extui', +'l8ui', +'l16si', +'l16ui', 'l32i', 'l32r', 'lsi', diff --git a/compiler/xtensa/xtensaop.inc b/compiler/xtensa/xtensaop.inc index 567e5b5cdf..6466678739 100644 --- a/compiler/xtensa/xtensaop.inc +++ b/compiler/xtensa/xtensaop.inc @@ -14,6 +14,9 @@ A_CALLX8, A_CALLX12, A_ENTRY, A_EXTUI, +A_L8UI, +A_L16SI, +A_L16UI, A_L32I, A_L32R, A_LSI,