<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 - clang 12.0 incorrectly passes AVX SIMD arguments to function"
   href="https://bugs.llvm.org/show_bug.cgi?id=49271">49271</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang 12.0 incorrectly passes AVX SIMD arguments to function
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>npcarter@g.harvard.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24555" name="attach_24555" title="Source code for test case">attachment 24555</a> <a href="attachment.cgi?id=24555&action=edit" title="Source code for test case">[details]</a></span>
Source code for test case

We're observing cases where code compiled with Clang 12.0 on an x86 Mac does
not correctly pass AVX SIMD register parameters to functions.  The attached
file contains a function "calc_band_1", which was derived from a key function
in the HMMER homology search program.  When compiled using on an x86 Mac, using
the command "clang -g -O0 -lm -mavx -march=native bug_test2.c -o bug_test2",
garbage values are passed to the two __m256 arguments to calc_band_1.  

This was observed under:
clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix

Other versions of clang or other C compilers have not shown this behavior, and
changing the optimization parameter to "-03" causes the code to compile and run
correctly.

This bug seems tied to the overall complexity of the function being called, and
in particular to the number of AVX vector variables declared in it.  We had to
include most of the original calc_band_1 function in the test case to recreate
the bug, and even with most of the function replicated, the bug only appears if
calc_band_1 declares a large number of __m256 variables.  On our machines, the
function as provided passes the wrong values in the SIMD arguments to
calc_band_1, but, if you delete one of the __m256 variable declarations at the
start of the function and re-compile, the _m256 arguments are passed correctly.</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>