소스 검색

* handling spilling of (v)movq/(v)movd properly if the mm register is replaced by a memory reference

florian 3 달 전
부모
커밋
79708f45ab
1개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. 18 0
      compiler/x86/rgx86.pas

+ 18 - 0
compiler/x86/rgx86.pas

@@ -418,6 +418,24 @@ implementation
             { Replace register with spill reference }
             { Replace register with spill reference }
             if replaceoper<>-1 then
             if replaceoper<>-1 then
               begin
               begin
+                if replaceoper=0 then
+                  begin
+{$ifdef x86_64}
+                    { if an mm register => int register (v)movq is converted, replace it by MOV with opsize Q }
+                    if ((opcode=A_MOVQ) or (opcode=A_VMOVQ)) and (oper[0]^.typ=top_reg)  and (oper[1]^.typ=top_reg) and (getregtype(oper[1]^.reg)=R_INTREGISTER) then
+                      begin
+                        opcode:=A_MOV;
+                        opsize:=S_Q;
+                      end;
+{$endif x86_64}
+                    { if an mm register => int register (v)movd is converted, replace it by MOV with opsize L }
+                    if ((opcode=A_MOVD) or (opcode=A_VMOVD)) and (oper[0]^.typ=top_reg)  and (oper[1]^.typ=top_reg) and (getregtype(oper[1]^.reg)=R_INTREGISTER) then
+                      begin
+                        opcode:=A_MOV;
+                        opsize:=S_L;
+                      end;
+                  end;
+
                 if opcode=A_LEA then
                 if opcode=A_LEA then
                   begin
                   begin
                     opcode:=A_ADD;
                     opcode:=A_ADD;