<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - _mm_insert_epi16 passes int to signature taking short"
   href="https://bugs.llvm.org/show_bug.cgi?id=38923">38923</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>_mm_insert_epi16 passes int to signature taking short
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>steveire@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given 

    $ type ..\simplemain.cpp
    #include <intrin.h>

    int main(int argc, char**)
    {
        __m128i mask = _mm_insert_epi16(__m128i{}, 0x8000, 0x1);

        return 0;
    }

I get:

    $ "C:\\dev\\src\\llvm\\build\\releaseprefix\\bin\\clang.exe" -cc1 -I
"C:\\dev\\src\\llvm\\build\\releaseprefix\\lib\\clang\\8.0.0\\include"
-internal-isystem "C:\\Program Files (x86)\\Microsoft Visual
Studio\\Preview\\Enterprise\\VC\\Tools\\MSVC\\14.15.26726\\include"
-internal-isystem "C:\\Program Files (x86)\\Windows
Kits\\10\\Include\\10.0.17134.0\\ucrt" -fms-compatibility
-fms-compatibility-version=19.15 -x c++ "..\\simplemain.cpp"

    ..\\simplemain.cpp:5:20: warning: implicit conversion from 'int' to 'short'
changes value from 32768 to -32768
        __m128i mask = _mm_insert_epi16(__m128i{}, 0x8000, 0x1);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   
C:\\dev\\src\\llvm\\build\\releaseprefix\\lib\\clang\\8.0.0\\include\emmintrin.h:4297:62:
note: expanded from macro '_mm_insert_epi16'
      (__m128i)__builtin_ia32_vec_set_v8hi((__v8hi)(__m128i)(a), (int)(b), \
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~                       ^~~~~~~~
    1 warning generated.


This warning gets emitted a lot when using clang-tidy, which invokes the
compiler directly. I can silence it by using `-isystem`, but the warning seems
to be legitimate. `_mm_insert_epi16` accepts an integer and casts it to `int`
in the call to `__builtin_ia32_vec_set_v8hi`, but `__builtin_ia32_vec_set_v8hi`
takes a short at that position.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>