<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Inconsistency with ADX intrinsics and builtins requirements"
   href="https://llvm.org/bugs/show_bug.cgi?id=26558">26558</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Inconsistency with ADX intrinsics and builtins requirements
          </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>douglas_yung@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The change r243908 added an ADX target requirement for the following 4
adx-related functions:

__builtin_ia32_addcarry_u32
__builtin_ia32_addcarry_u64
__builtin_ia32_subborrow_u32
__builtin_ia32_subborrow_u64

However, if you look at adxintrin.h, the four functions which use these
builtins are preceeded by the following comment:

/* Intrinsics that are also available if __ADX__ undefined */

>From this, it would seem that either the marking of the four previously
mentioned functions as requiring ADX may have been a mistake, or the comment in
adxintrin.h is incorrect and the 4 functions in there that reference the above
builtins also need to be annotated with an ADX target requirement and the
comment removed.

We discovered this in our testing by compiling the following test:

//--------------
#include <x86intrin.h>
//--------------

Compile it with the command "clang -c repro.cpp -femit-all-decls". With a
compiler built from r250498, it produces the following error:

In file included from repro.cpp:1:
In file included from
260210\Checking\bin\..\lib\clang\3.9.0\include\x86intrin.h:29:
In file included from
260210\Checking\bin\..\lib\clang\3.9.0\include\immintrin.h:172:
260210\Checking\bin\..\lib\clang\3.9.0\include\adxintrin.h:56:10: error:
'__builtin_ia32_addcarry_u32' needs target feature adx
  return __builtin_ia32_addcarry_u32(__cf, __x, __y, __p);
         ^
1 error generated.</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>