Browse Source

* fix min/max intrinsics on x86_64 for non constant/reference/register locations, resolves #40721

florian 1 year ago
parent
commit
3b8fcfc6eb
1 changed files with 5 additions and 0 deletions
  1. 5 0
      compiler/x86/nx86inl.pas

+ 5 - 0
compiler/x86/nx86inl.pas

@@ -1726,9 +1726,14 @@ implementation
                  paraarray[1]:=tcallparanode(parameters).paravalue;
                  paraarray[1]:=tcallparanode(parameters).paravalue;
                end;
                end;
 
 
+             if not(paraarray[1].location.loc in [LOC_CONSTANT,LOC_REFERENCE,LOC_CREFERENCE,LOC_REGISTER,LOC_CREGISTER]) then
+               hlcg.location_force_reg(current_asmdata.CurrAsmList,paraarray[1].location,
+                 paraarray[1].resultdef,paraarray[1].resultdef,true);
+
              location_reset(location,LOC_REGISTER,paraarray[1].location.size);
              location_reset(location,LOC_REGISTER,paraarray[1].location.size);
              location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
              location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
 
 
+
              hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,paraarray[1].resultdef,resultdef,paraarray[1].location,location.register);
              hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,paraarray[1].resultdef,resultdef,paraarray[1].location,location.register);
              cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
              cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);