mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-23 00:51:28 +02:00
+ implemented sqr(real) for the WebAssembly target
git-svn-id: trunk@49430 -
This commit is contained in:
parent
87111246ca
commit
c42e297bc6
@ -38,11 +38,14 @@ interface
|
||||
procedure second_memory_size;
|
||||
procedure second_memory_grow;
|
||||
procedure second_unreachable;
|
||||
protected
|
||||
function first_sqr_real: tnode; override;
|
||||
public
|
||||
function pass_typecheck_cpu: tnode; override;
|
||||
function first_cpu: tnode; override;
|
||||
procedure pass_generate_code_cpu; override;
|
||||
procedure second_length;override;
|
||||
procedure second_sqr_real; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -152,6 +155,13 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function twasminlinenode.first_sqr_real: tnode;
|
||||
begin
|
||||
expectloc:=LOC_FPUREGISTER;
|
||||
first_sqr_real:=nil;
|
||||
end;
|
||||
|
||||
|
||||
function twasminlinenode.pass_typecheck_cpu: tnode;
|
||||
begin
|
||||
Result:=nil;
|
||||
@ -268,6 +278,30 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure twasminlinenode.second_sqr_real;
|
||||
begin
|
||||
secondpass(left);
|
||||
hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
|
||||
|
||||
thlcgwasm(hlcg).a_load_loc_stack(current_asmdata.CurrAsmList,left.resultdef,left.location);
|
||||
thlcgwasm(hlcg).a_load_loc_stack(current_asmdata.CurrAsmList,left.resultdef,left.location);
|
||||
|
||||
case left.location.size of
|
||||
OS_F32:
|
||||
current_asmdata.CurrAsmList.Concat(taicpu.op_none(a_f32_mul));
|
||||
OS_F64:
|
||||
current_asmdata.CurrAsmList.Concat(taicpu.op_none(a_f64_mul));
|
||||
else
|
||||
internalerror(2021060102);
|
||||
end;
|
||||
thlcgwasm(hlcg).decstack(current_asmdata.CurrAsmList,1);
|
||||
|
||||
location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
|
||||
location.register:=hlcg.getregisterfordef(current_asmdata.CurrAsmList,resultdef);
|
||||
thlcgwasm(hlcg).a_load_stack_loc(current_asmdata.CurrAsmList,resultdef,location);
|
||||
end;
|
||||
|
||||
begin
|
||||
cinlinenode:=twasminlinenode;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user