<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 - Implement __shiftright128 for x86_64-pc-windows-msvc"
   href="https://bugs.llvm.org/show_bug.cgi?id=37755">37755</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Implement __shiftright128 for x86_64-pc-windows-msvc
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>sfinae@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20415" name="attach_20415" title="Test case">attachment 20415</a> <a href="attachment.cgi?id=20415&action=edit" title="Test case">[details]</a></span>
Test case

This intrinsic makes <a href="https://github.com/ulfjack/ryu">https://github.com/ulfjack/ryu</a> more efficient on x64
Windows.

C:\Temp>type repro.cpp
#ifndef _M_X64
    #error This repro requires x64.
#endif

// <a href="https://docs.microsoft.com/en-us/cpp/intrinsics/shiftright128">https://docs.microsoft.com/en-us/cpp/intrinsics/shiftright128</a>

#include <intrin.h>
#include <stdio.h>

int main() {
    const unsigned long long val = __shiftright128(0x0102030405060708ull,
0xA0B0C0D0E0F0AABBull, 20);

    if (val == 0x0AABB01020304050ull) {
        puts("PASS");
    } else {
        printf("FAIL, this should be 0AABB01020304050: %016llX\n", val);
    }
}

C:\Temp>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26504 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

C:\Temp>cl /EHsc /nologo /W4 repro.cpp && repro
repro.cpp
PASS

C:\Temp>clang-cl -m64 -v
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: S:\msvc\src\vctools\NonShip\ClangLLVM\bin

C:\Temp>clang-cl -m64 /EHsc /nologo /W4 repro.cpp && repro
repro-128dd8.obj : error LNK2019: unresolved external symbol __shiftright128
referenced in function main
repro.exe : fatal error LNK1120: 1 unresolved externals
clang-cl.exe: error: linker command failed with exit code 1120 (use -v to see
invocation)</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>