<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57642>57642</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            flang/lib/Optimizer/CodeGen/Target.cpp lacks SPARC support
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          rorth
      </td>
    </tr>
</table>

<pre>
    Quite a number of flang tests `FAIL` on SPARC (both Solaris/sparcv9 and Linux/sparc64) with
```
error: /vol/llvm/src/llvm-project/dist/flang/lib/Optimizer/CodeGen/Target.cpp:310: not yet implemented: target not implemented
```
The ABI for passing and returning complex values is not part of the SPARC and SPARCv9 psABIs, so GCC follows the lead of the Sun/Oracle Studio compilers that originally defined/implemented this.  It's described in GCC's `gcc/config/sparc/sparc.cc`:
```
   Summary of the calling conventions implemented by GCC on the SPARC:

   32-bit ABI:
                                size      argument     return value

      _Complex float              8        memory         FP reg.
      _Complex double            16        memory         FP reg.
      _Complex long double       32        memory         FP reg.

    64-bit ABI:
                                size      argument     return value

      _Complex float              8        FP reg.        FP reg.
      _Complex double            16        FP reg.        FP reg.
      _Complex long double       32        memory         FP reg.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVFFvmzAQ_jXwYhWBITR54CFNlapSpXbr3icbDvBmbGSbtNmv39kJTVpV2tq9zEFw5zt_d_edc1w3--rLJBwQRtQ0cDBEt6SVTHXEgXWWRGW6Xd_e4YdoRR4f1l83JKJLrl1PHrVkRtiIbu3ITL1bEaYacifU9DzvlUVEV-RJuD5Kr6N0jTjHJ6hgjDZRvkbI7U5LfEu5G_xhUx-Vi9HoH1A7VBth_Sek562C4_t-dGIQv8CgvNEN3IBC6RszHbikHkdEz7PUx1DakT04IoZRwgDKQeO3XXAN1nPLe-l-64Gsr25Jqw0ZmbUCafIlG3CTUV6rtYd4JjsmJ7BE2ICLTDhPrMPzBwr9qSAhaaNFTGRxQ6wmN5sNwkupn2xwl8Cal6OTL-3esFqi4qZG6BBQSDDem2EQIzqhmJR70kArFBZCt2dloZewCSG3SOSlRR9bG8FxXygfOmxiuV3t6a-1akU3t3L-JmgrPaHvUkQIpjkMzOznrGvM5kCN2mEOQit7TjTh-1A03q4Xek7gM2ZOL7hwnvwXG_nDsngpDhI2ePLBgnLo1aFBb4Lg-r45NrCVmrnXgMtZGGDQWN-8tg8I2iXvwjR64hLOUbLyEzBSI4GvsHL6NzAnsLL4jwg85vivBH4A5tMEzrc7hiorS3qZUUoXcVPlzSpfsdgJJ6H62EQiktU_7XEQ2GkctXHxZGTVOzda3x66xafDoTnxBP_gp7H4ZiAKa3HKoLC4LAsa9xUUPKPLtuRZw5b5oizbBSvYatGwAniNLpJxkLaKFlcRpQqeSIBAOVpcx6KiKaXpCn_LPM2KJAdoOKccUsgz3mZRkcLAhEx8Hok2XWyqkBKfOotGiQPanox-QnYKIIRDfDa5XpsKR77r4xC4Con_BrQB7GY">