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

    <tr>
        <th>Summary</th>
        <td>
            Flang should handle the -mtune option
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

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

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

<pre>
    `flang-new` already knows about the `-march` option but not about `-mtune`. `clang` (and also `gcc`/`gfortran`) handles both options. For context, `-mtune` produces code that's optimized for a certain subarchitecture (say `haswell` or `zen3`) while retaining compatibility with other subarchitectures, whereas `-march` might produce illegal instructions when run on the wrong hardware.

My reason for asking is that is makes it hard to use `flang-new` within [Spack](https://github.com/spack/spack). Spack handles `flang-new` as the Fortran component of the `clang` compiler but unfortunately doesn't provide a way to specify different compiler flags for the C, C++, and Fortran compilers. `-mtune` is used as an option for most architectures (e.g., [here](
https://github.com/spack/spack/blob/develop/lib/spack/external/archspec/json/cpu/microarchitectures.json)), which breaks using `flang-new` to build anything with Spack.

Even if `-mtune` wasn't implemented immediately it would at least be helpful if `flang-new` wouldn't just stop compilation but just display a warning and continue.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVM1u4zYQfhr6Moig0LFiH3TYZKtbT32CETmSGFOkwJ9otU9fDOW46y1QFBDCmBx-nO-HxBjN6IhacXoTp-8HzGnyoU35GuOh93prRVMPFt345GgVTQ1oA6He4Or8GgF7nxOkiUA09dOMQU1c5JdkvIM-J3A-3apKRcqORFNX_EsxLpcLeUanAW30PD8qJZpayI7_H3xIAV2ZuMCETluK0Ps03U6JFXQ-gPIu0Y8k5PvDQbAEr7OiCMprgjRhEvI1lr2z-UkaBh8AQVFIaBzE3DMJk0ilHIhbi7gx5IRxJWsLvcATP8kdb22tk7EEgRjCuBGUnxdMpjfWpA1Ww82micLv8JHbXScKhPFRw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