[llvm-bugs] [Bug 50569] Result of __builtin_ctzs() and __tzcnt_u16() not matching after 2af95a52

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 4 02:02:37 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50569

Douglas Yung <douglas_yung at playstation.sony.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Douglas Yung <douglas_yung at playstation.sony.com> ---
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!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210604/4153e15c/attachment.html>


More information about the llvm-bugs mailing list