<html>
    <head>
      <base href="http://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 --- - clang -O4 drops other -mavx2 and possibly other flags"
   href="http://llvm.org/bugs/show_bug.cgi?id=18808">18808</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang -O4 drops other -mavx2 and possibly other flags
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>misc@shiftleft.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12047" name="attach_12047" title="A terminal transcript with a test case">attachment 12047</a> <a href="attachment.cgi?id=12047&action=edit" title="A terminal transcript with a test case">[details]</a></span>
A terminal transcript with a test case

I found that

clang -O4 -mavx2 *.c

sets AVX2 in the frontend, but not during link-time optimization.  The same may
be true for other flags.  This causes problems with code that tries to detect
whether AVX2 (or possibly other features) are supported, since it will emit
code designed for those features but they will not be present during link-time
optimization.

The terminal transcript shows the bug in action.  When compiled with -O3, AVX2
instructions are emitted, and when compiled with -O4, they are not.  The
transcript does not show that __AVX2__ is defined in the C file, but in fact it
is.</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>