Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
2361-beam_disasm-Resolve-float-arithmetic-as-bi...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2361-beam_disasm-Resolve-float-arithmetic-as-bif-s.patch of Package erlang
From 3330262e59a8aa53c9e9d262765d949b7e88b5a5 Mon Sep 17 00:00:00 2001 From: Michael Davis <mcarsondavis@gmail.com> Date: Wed, 9 Nov 2022 15:59:26 -0600 Subject: [PATCH 1/8] beam_disasm: Resolve float arithmetic as 'bif's HiPE translated float arithmetic BIFs as 'arithfbif' in order to handle arithmetic operations differently from other guard BIFs. For asm format, though, these are expected to be `bif/5` instructions. For example, in the following listing: fadd(A,B) when is_float(A) andalso is_float(B) -> A + B. The addition operation becomes a `bif/5`: {test,is_float,{f,1},[{x,0}]}. {test,is_float,{f,1},[{x,1}]}. {fmove,{x,0},{fr,0}}. {fmove,{x,1},{fr,1}}. {bif,fadd,{f,0},[{fr,0},{fr,1}],{fr,0}}. {test_heap,{alloc,[{words,0},{floats,1},{funs,0}]},0}. {fmove,{fr,0},{x,0}}. return. --- lib/compiler/src/beam_disasm.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/compiler/src/beam_disasm.erl b/lib/compiler/src/beam_disasm.erl index 9cc2b8455f..bd48b40c4e 100644 --- a/lib/compiler/src/beam_disasm.erl +++ b/lib/compiler/src/beam_disasm.erl @@ -973,19 +973,19 @@ resolve_inst({fconv,Args},_,_,_) -> {fconv,Reg,FR}; resolve_inst({fadd=I,Args},_,_,_) -> [F,A1,A2,Reg] = resolve_args(Args), - {arithfbif,I,F,[A1,A2],Reg}; + {bif,I,F,[A1,A2],Reg}; resolve_inst({fsub=I,Args},_,_,_) -> [F,A1,A2,Reg] = resolve_args(Args), - {arithfbif,I,F,[A1,A2],Reg}; + {bif,I,F,[A1,A2],Reg}; resolve_inst({fmul=I,Args},_,_,_) -> [F,A1,A2,Reg] = resolve_args(Args), - {arithfbif,I,F,[A1,A2],Reg}; + {bif,I,F,[A1,A2],Reg}; resolve_inst({fdiv=I,Args},_,_,_) -> [F,A1,A2,Reg] = resolve_args(Args), - {arithfbif,I,F,[A1,A2],Reg}; + {bif,I,F,[A1,A2],Reg}; resolve_inst({fnegate,Args},_,_,_) -> [F,Arg,Reg] = resolve_args(Args), - {arithfbif,fnegate,F,[Arg],Reg}; + {bif,fnegate,F,[Arg],Reg}; %% %% Instructions for try expressions added in January 2003 (R10). -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor