anchor.diff:              end
       end.
   
  -float_need_flush(#b_blk{is=Is}, #fs{s=cleared}) ->
  +float_maybe_flush(Blk0, #fs{s=cleared,fail=Fail,bs=Blocks}=Fs0, Count0) ->
  +    #b_blk{last=#b_br{bool=#b_var{},succ=Succ}=Br} = Blk0,
  +    #b_blk{is=Is} = maps:get(Succ, Blocks),
       case Is of
           [#b_set{anno=#{float_op:=_}}|_] ->
  -            false;
  +            %% The next operation is also a floating point operation.
  +            %% No flush needed.
  +            {[],Blk0,Fs0,Count0};
           _ ->
  -            true
  -    end;
  -float_need_flush(_, _) -> false.
  +            %% Flush needed.
  +            {Bool0,Count1} = new_reg('@ssa_bool', Count0),
  +            Bool = #b_var{name=Bool0},
  +
  +            %% Allocate block numbers.
  +            CheckL = Count1,              %For checkerror.
  +            FlushL = Count1 + 1,          %For flushing of float regs.
  +            Count = Count1 + 2,
  +            Blk = Blk0#b_blk{last=Br#b_br{succ=CheckL}},
  +
  +            %% Build the block with the checkerror instruction.
  +            CheckIs = [#b_set{op={float,checkerror},dst=Bool}],
  +            CheckBr = #b_br{bool=Bool,succ=FlushL,fail=Fail},
  +            CheckBlk = #b_blk{is=CheckIs,last=CheckBr},
  +
  +            %% Build the block that flushes all registers.
  +            FlushIs = float_flush_regs(Fs0),
  +            FlushBr = #b_br{bool=#b_literal{val=true},succ=Succ,fail=Succ},
  +            FlushBlk = #b_blk{is=FlushIs,last=FlushBr},
  +
  +            %% Update state and blocks.
  +            Fs = Fs0#fs{s=undefined,regs=#{},fail=none},
  +            FlushBs = [{CheckL,CheckBlk},{FlushL,FlushBlk}],
  +            {FlushBs,Blk,Fs,Count}
  +    end;
  +float_maybe_flush(Blk, Fs, Count) ->
  +    {[],Blk,Fs,Count}.
   
   float_opt_is([#b_set{op=succeeded,args=[Src]}=I0],
                #fs{regs=Rs}=Fs, Count, Acc) ->
  
positive.code: float_opt_is([], Fs, _Count, _Acc) ->
      #fs{s=undefined} = Fs,                      %Assertion.
      none.
  
  float_rename_phis(#b_blk{is=Is}=Blk, #fs{ren=Ren}) ->
      if
          map_size(Ren) =:= 0 ->
              Blk;
          true ->
              Blk#b_blk{is=float_rename_phis_1(Is, Ren)}
      end.
  
  float_rename_phis_1([#b_set{op=phi,args=Args0}=I|Is], Ren) ->
      Args = [float_phi_arg(Arg, Ren) || Arg <- Args0],
      [I#b_set{args=Args}|float_rename_phis_1(Is, Ren)];
  float_rename_phis_1(Is, _) -> Is.
  
  float_phi_arg({Var,OldLbl}, Ren) ->
      case Ren of
          #{OldLbl:=NewLbl} ->
              {Var,NewLbl};
          #{} ->
              {Var,OldLbl}
      end.
  
  float_make_op(#b_set{op={bif,Op},dst=Dst,args=As0}=I0,
                Ts, #fs{s=S,regs=Rs0}=Fs, Count0) ->
  
negative.code:     end;
  float_non_guards([]) -> [?BADARG_BLOCK].
  
  float_opt([{L,#b_blk{last=#b_br{fail=F}}=Blk}|Bs0],
              Count0, #fs{non_guards=NonGuards}=Fs) ->
      case gb_sets:is_member(F, NonGuards) of
          true ->
              %% This block is not inside a guard.
              %% We can do the optimization.
              float_opt_1(L, Blk, Bs0, Count0, Fs);
          false ->
              %% This block is inside a guard. Don't do
              %% any floating point optimizations.
              {Bs,Count} = float_opt(Bs0, Count0, Fs),
              {[{L,Blk}|Bs],Count}
      end;
  float_opt([{L,Blk}|Bs], Count, Fs) ->
      float_opt_1(L, Blk, Bs, Count, Fs);
  float_opt([], Count, _Fs) ->
      {[],Count}.
  
  float_opt_1(L, #b_blk{is=Is0}=Blk0, Bs0, Count0, Fs0) ->
      case float_opt_is(Is0, Fs0, Count0, []) of
          {Is1,Fs1,Count1} ->
              Fs2 = float_fail_label(Blk0, Fs1),
              Fail = Fs2#fs.fail,
              {Flush,Blk,Fs,Count2} = float_maybe_flush(Blk0, Fs2, Count1),
              Split = float_split_conv(Is1, Blk),
              {Blks0,Count3} = float_number(Split, L, Count2),
              {Blks,Count4} = float_conv(Blks0, Fail, Count3),
              {Bs,Count} = float_opt(Bs0, Count4, Fs),
              {Blks++Flush++Bs,Count};
          none ->
              {Bs,Count} = float_opt(Bs0, Count0, Fs0),
              {[{L,Blk0}|Bs],Count}
  