<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:douglas_yung@playstation.sony.com" title="Douglas Yung <douglas_yung@playstation.sony.com>"> <span class="fn">Douglas Yung</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Result of __builtin_ctzs() and __tzcnt_u16() not matching after 2af95a52"
   href="https://bugs.llvm.org/show_bug.cgi?id=50569">bug 50569</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Result of __builtin_ctzs() and __tzcnt_u16() not matching after 2af95a52"
   href="https://bugs.llvm.org/show_bug.cgi?id=50569#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Result of __builtin_ctzs() and __tzcnt_u16() not matching after 2af95a52"
   href="https://bugs.llvm.org/show_bug.cgi?id=50569">bug 50569</a>
              from <span class="vcard"><a class="email" href="mailto:douglas_yung@playstation.sony.com" title="Douglas Yung <douglas_yung@playstation.sony.com>"> <span class="fn">Douglas Yung</span></a>
</span></b>
        <pre>I think you are correct that the test has been passing 0 to tzcnt which results
in undefined behavior and that we were previously just getting lucky.

In investigating this issue before I reported it, I wrote a small program that
performed the actions the test was taking and compared the result for all
values of short from the min to the max and only 0 showed an issue. I then
added some code to dump out the value that was being passed to the intrinsic
and it seemed to be consistently be 0. I suspect that our convoluted
initialization using a union with doubles/shorts (int -> double -> short via
union) was always getting 0 causing the issue.

I'm going to resolve this as invalid and update our internal test to detect
when we are attempting to pass 0 to the intrinsic and select a different value
to avoid the undefined behavior.

Thanks for the help!</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>