<?xml-stylesheet type="text/xsl" encoding="UTF-8" href="iform.xsl" version="1.0"?>
<!DOCTYPE instructionsection PUBLIC "-//ARM//DTD instructionsection //EN" "iform-p.dtd">
<!-- Copyright (c) 2010-2025 Arm Limited or its affiliates. All rights reserved. -->
<!-- This document is Non-Confidential. This document may only be used and distributed in accordance with the terms of the agreement entered into by Arm and the party that Arm delivered this document to. -->
<instructionsection id="STFMAX" title="STFMAX, STFMAXL -- A64" type="instruction">
  <docvars>
    <docvar key="instr-class" value="advsimd"/>
    <docvar key="isa" value="A64"/>
  </docvars>
  <heading>STFMAX, STFMAXL</heading>
  <desc>
    <brief>
      <para>Atomic floating-point maximum, without return</para>
    </brief>
    <authored>
      <para>This instruction atomically loads a 16-bit, 32-bit, or 64-bit value from memory,
computes the floating-point maximum with the value held in a register,
and stores the result back to memory.</para>
      <list type="unordered">
        <listitem>
          <content>
            <instruction>STFMAXL</instruction> stores
  to memory with release semantics.</content>
        </listitem>
        <listitem>
          <content>
            <instruction>STFMAX</instruction> has no release semantics.</content>
        </listitem>
      </list>
      <para>This instruction:</para>
      <list type="unordered">
        <listitem>
          <content>Disables alternative floating-point behaviors, as if <register_link id="AArch64-fpcr.xml" state="AArch64">FPCR</register_link>.AH
  is 0.</content>
        </listitem>
        <listitem>
          <content>Generates only the default NaN, as if <register_link id="AArch64-fpcr.xml" state="AArch64">FPCR</register_link>.DN
  is 1.</content>
        </listitem>
        <listitem>
          <content>Does not modify the cumulative <register_link id="AArch64-fpsr.xml" state="AArch64">FPSR</register_link>
  exception bits (IDC, IXC, UFC, OFC, DZC, and IOC).</content>
        </listitem>
        <listitem>
          <content>Disables trapped floating-point exceptions, as if the
  <register_link id="AArch64-fpcr.xml" state="AArch64">FPCR</register_link> trap enable bits
  (IDE, IXE, UFE, OFE, DZE, and IOE) are all zero.</content>
        </listitem>
      </list>
      <para>For more information about memory ordering semantics, see <xref linkend="ARMARM_BEIHCHEF">Load-Acquire, Store-Release</xref>.</para>
      <para>For information about addressing modes, see
<xref linkend="ARMARM_CHDIIIBB">Load/Store addressing modes</xref>.</para>
    </authored>
  </desc>
  <alias_list howmany="0"/>
  <classes>
    <iclass name="Floating-point" oneof="1" id="iclass_floating_point" no_encodings="6" isa="A64">
      <docvars>
        <docvar key="instr-class" value="advsimd"/>
        <docvar key="isa" value="A64"/>
      </docvars>
      <iclassintro count="6"/>
      <arch_variants>
        <arch_variant feature="FEAT_LSFE" name="v9Ap6"/>
      </arch_variants>
      <regdiagram form="32" psname="A64.ldst.memop.STFMAX_16" tworows="1">
        <box hibit="31" width="2" name="size" usename="1">
          <c colspan="2"/>
        </box>
        <box hibit="29" width="3" settings="3">
          <c>1</c>
          <c>1</c>
          <c>1</c>
        </box>
        <box hibit="26" name="VR" usename="1" settings="1" psbits="x">
          <c>1</c>
        </box>
        <box hibit="25" width="2" settings="2">
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="23" name="A" usename="1" settings="1" psbits="x">
          <c>0</c>
        </box>
        <box hibit="22" width="1" name="R" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="21" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="20" width="5" name="Rs" usename="1">
          <c colspan="5"/>
        </box>
        <box hibit="15" name="o3" usename="1" settings="1" psbits="x">
          <c>1</c>
        </box>
        <box hibit="14" width="3" name="opc" usename="1" settings="3" psbits="xxx">
          <c>1</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="11" width="2" settings="2">
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="9" width="5" name="Rn" usename="1">
          <c colspan="5"/>
        </box>
        <box hibit="4" width="5" name="Rt" usename="1" settings="5" psbits="xxxxx">
          <c>1</c>
          <c>1</c>
          <c>1</c>
          <c>1</c>
          <c>1</c>
        </box>
      </regdiagram>
      <encoding name="STFMAX_16" oneofinclass="6" oneof="6" label="Half-precision no memory ordering" bitdiffs="size == 01 &amp;&amp; R == 0">
        <docvars>
          <docvar key="instr-class" value="advsimd"/>
          <docvar key="isa" value="A64"/>
          <docvar key="reg-type" value="16-reg"/>
          <docvar key="mnemonic" value="STFMAX"/>
        </docvars>
        <box hibit="31" width="2" name="size">
          <c>0</c>
          <c>1</c>
        </box>
        <box hibit="22" width="1" name="R">
          <c>0</c>
        </box>
        <asmtemplate><text>STFMAX  </text><a hover="Is the 16-bit name of the SIMD&amp;FP register holding the data value to be operated on with the contents of the memory location, encoded in the &quot;Rs&quot; field." link="fpfar_hs">&lt;Hs&gt;</a><text>, [</text><a hover="Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the &quot;Rn&quot; field." link="XnSP_option">&lt;Xn|SP&gt;</a><text>]</text></asmtemplate>
      </encoding>
      <encoding name="STFMAXL_16" oneofinclass="6" oneof="6" label="Half-precision release" bitdiffs="size == 01 &amp;&amp; R == 1">
        <docvars>
          <docvar key="instr-class" value="advsimd"/>
          <docvar key="isa" value="A64"/>
          <docvar key="reg-type" value="16-reg"/>
          <docvar key="mnemonic" value="STFMAXL"/>
        </docvars>
        <box hibit="31" width="2" name="size">
          <c>0</c>
          <c>1</c>
        </box>
        <box hibit="22" width="1" name="R">
          <c>1</c>
        </box>
        <asmtemplate><text>STFMAXL  </text><a hover="Is the 16-bit name of the SIMD&amp;FP register holding the data value to be operated on with the contents of the memory location, encoded in the &quot;Rs&quot; field." link="fpfar_hs">&lt;Hs&gt;</a><text>, [</text><a hover="Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the &quot;Rn&quot; field." link="XnSP_option">&lt;Xn|SP&gt;</a><text>]</text></asmtemplate>
      </encoding>
      <encoding name="STFMAX_32" oneofinclass="6" oneof="6" label="Single-precision no memory ordering" bitdiffs="size == 10 &amp;&amp; R == 0">
        <docvars>
          <docvar key="instr-class" value="advsimd"/>
          <docvar key="isa" value="A64"/>
          <docvar key="reg-type" value="32-reg"/>
          <docvar key="mnemonic" value="STFMAX"/>
        </docvars>
        <box hibit="31" width="2" name="size">
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="22" width="1" name="R">
          <c>0</c>
        </box>
        <asmtemplate><text>STFMAX  </text><a hover="Is the 32-bit name of the SIMD&amp;FP register holding the data value to be operated on with the contents of the memory location, encoded in the &quot;Rs&quot; field." link="fpfar_ss">&lt;Ss&gt;</a><text>, [</text><a hover="Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the &quot;Rn&quot; field." link="XnSP_option">&lt;Xn|SP&gt;</a><text>]</text></asmtemplate>
      </encoding>
      <encoding name="STFMAXL_32" oneofinclass="6" oneof="6" label="Single-precision release" bitdiffs="size == 10 &amp;&amp; R == 1">
        <docvars>
          <docvar key="instr-class" value="advsimd"/>
          <docvar key="isa" value="A64"/>
          <docvar key="reg-type" value="32-reg"/>
          <docvar key="mnemonic" value="STFMAXL"/>
        </docvars>
        <box hibit="31" width="2" name="size">
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="22" width="1" name="R">
          <c>1</c>
        </box>
        <asmtemplate><text>STFMAXL  </text><a hover="Is the 32-bit name of the SIMD&amp;FP register holding the data value to be operated on with the contents of the memory location, encoded in the &quot;Rs&quot; field." link="fpfar_ss">&lt;Ss&gt;</a><text>, [</text><a hover="Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the &quot;Rn&quot; field." link="XnSP_option">&lt;Xn|SP&gt;</a><text>]</text></asmtemplate>
      </encoding>
      <encoding name="STFMAX_64" oneofinclass="6" oneof="6" label="Double-precision no memory ordering" bitdiffs="size == 11 &amp;&amp; R == 0">
        <docvars>
          <docvar key="instr-class" value="advsimd"/>
          <docvar key="isa" value="A64"/>
          <docvar key="reg-type" value="64-reg"/>
          <docvar key="mnemonic" value="STFMAX"/>
        </docvars>
        <box hibit="31" width="2" name="size">
          <c>1</c>
          <c>1</c>
        </box>
        <box hibit="22" width="1" name="R">
          <c>0</c>
        </box>
        <asmtemplate><text>STFMAX  </text><a hover="Is the 64-bit name of the SIMD&amp;FP register holding the data value to be operated on with the contents of the memory location, encoded in the &quot;Rs&quot; field." link="fpfar_ds">&lt;Ds&gt;</a><text>, [</text><a hover="Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the &quot;Rn&quot; field." link="XnSP_option">&lt;Xn|SP&gt;</a><text>]</text></asmtemplate>
      </encoding>
      <encoding name="STFMAXL_64" oneofinclass="6" oneof="6" label="Double-precision release" bitdiffs="size == 11 &amp;&amp; R == 1">
        <docvars>
          <docvar key="instr-class" value="advsimd"/>
          <docvar key="isa" value="A64"/>
          <docvar key="reg-type" value="64-reg"/>
          <docvar key="mnemonic" value="STFMAXL"/>
        </docvars>
        <box hibit="31" width="2" name="size">
          <c>1</c>
          <c>1</c>
        </box>
        <box hibit="22" width="1" name="R">
          <c>1</c>
        </box>
        <asmtemplate><text>STFMAXL  </text><a hover="Is the 64-bit name of the SIMD&amp;FP register holding the data value to be operated on with the contents of the memory location, encoded in the &quot;Rs&quot; field." link="fpfar_ds">&lt;Ds&gt;</a><text>, [</text><a hover="Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the &quot;Rn&quot; field." link="XnSP_option">&lt;Xn|SP&gt;</a><text>]</text></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="A64.ldst.memop.STFMAX_16" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">if !IsFeatureImplemented(FEAT_LSFE) then EndOfDecode(Decode_UNDEF); end;

let s : integer = UInt(Rs);
let n : integer = UInt(Rn);

let datasize : integer{} = 8 &lt;&lt; UInt(size);
let acquire : boolean = FALSE;
let release : boolean = R == '1';
let tagchecked : boolean = n != 31;</pstext></ps>
      </ps_section>
    </iclass>
  </classes>
  <explanations scope="all">
    <explanation enclist="STFMAX_16, STFMAXL_16" symboldefcount="1">
      <symbol link="fpfar_hs">&lt;Hs&gt;</symbol>
      <account encodedin="Rs">
        <intro>
          <para>Is the 16-bit name of the SIMD&amp;FP register holding the data value to be operated on with the contents of the memory location, encoded in the "Rs" field.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="STFMAX_16, STFMAXL_16, STFMAX_32, STFMAXL_32, STFMAX_64, STFMAXL_64" symboldefcount="1">
      <symbol link="XnSP_option">&lt;Xn|SP&gt;</symbol>
      <account encodedin="Rn">
        <intro>
          <para>Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the "Rn" field.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="STFMAX_32, STFMAXL_32" symboldefcount="1">
      <symbol link="fpfar_ss">&lt;Ss&gt;</symbol>
      <account encodedin="Rs">
        <intro>
          <para>Is the 32-bit name of the SIMD&amp;FP register holding the data value to be operated on with the contents of the memory location, encoded in the "Rs" field.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="STFMAX_64, STFMAXL_64" symboldefcount="1">
      <symbol link="fpfar_ds">&lt;Ds&gt;</symbol>
      <account encodedin="Rs">
        <intro>
          <para>Is the 64-bit name of the SIMD&amp;FP register holding the data value to be operated on with the contents of the memory location, encoded in the "Rs" field.</para>
        </intro>
      </account>
    </explanation>
  </explanations>
  <ps_section howmany="1">
    <ps name="A64.ldst.memop.STFMAX_16" sections="1" secttype="Operation">
      <pstext mayhavelinks="1" section="Execute" rep_section="execute">AArch64_CheckFPEnabled();
var address : bits(64);
var value : bits(datasize);
var data : bits(datasize);
let accdesc : AccessDescriptor = CreateAccDescFPAtomicOp(MemAtomicOp_FPMAX, acquire,
                                                            release, tagchecked);

value = V{datasize}(s);
if n == 31 then
    CheckSPAlignment();
    address = SP{64}();
else
    address = X{64}(n);
end;

let comparevalue : bits(datasize) = ARBITRARY : bits(datasize); // Irrelevant when not executing CAS
data = MemAtomic{datasize}(address, comparevalue, value, accdesc);</pstext></ps>
  </ps_section>
  <timestamp>2026-03-12 12:23:09</timestamp>
  <commit_id>2025-09_rel_asl1</commit_id>
</instructionsection>
