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

    <tr>
        <th>Summary</th>
        <td>
            Pls clarify how `min_vector_width` is supposed to be used
        </td>
    </tr>

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

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

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

<pre>
    Reading this paragraph in the [docs](https://releases.llvm.org/16.0.0/tools/clang/docs/AttributeReference.html#min-vector-width)

> This is currently used by the X86 target to allow some CPUs that support 512-bit vectors to be limited to using 256-bit vectors to avoid frequency penalties. This is currently enabled with the -prefer-vector-width=256 command line option. The min_vector_width attribute can be used to prevent the backend from trying to split vector operations to match the prefer-vector-width. All X86 vector intrinsics from x86intrin.h already set this attribute. Additionally, use of any of the X86-specific vector builtins will implicitly set this attribute on the calling function. The intent is that explicitly writing vector code using the X86 intrinsics will prevent prefer-vector-width from affecting the code.

I had an impression that if I'd have, say, `prefer-vector-width=128` set globally among `clang` options and `min-vector-width=256` as an attribute for a particular function, then 256 bit vector code will be generated for it.

I tested my understanding on this simple [example](https://godbolt.org/z/rGa94caqd) and found it to be wrong.

So, the question is it is somehow possible to
* have `prefer-vector-width=128` for all functions by default
* be able to "unset" `prefer-vector-width` or set it to a higher value for selected functions

Prob related: #60946

Thx in advance
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVU2v27gO_TXKhkhgy4lvssgi7X156K7o6wNmV9AyHWsqS65EJzfz6weUfT_a3sFs4iSmyHMOj0hMyV480VHtPqjd4won7kM8emu-W0ZeNaG9H78QttZfgHubYMSIl4hjD9YD9wRq96ENJqndo9L7nnlMqjopfVb6HMkRJkob567DJsSL0uey3hSbQukzh-CS0mfj0MuLnESfT8zRNhPTF-ookje06XlwSleD9esrGQ5xfbMt90ofVPGoitPyWf0Hvgp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