This is an archive of the discontinued LLVM Phabricator instance.

[mips] clz is defined to give 32 for zero. Similarly, dclz gives 64.
ClosedPublic

Authored by dsanders on Jul 9 2014, 5:53 AM.

Details

Summary

While debugging another issue, I noticed that Mips currently specifies that the
count leading zero builtins are undefined when the input is zero. The
architecture specifications say that the clz and dclz instructions write 32 or
64 respectively when given zero.

This doesn't fix any bugs that I'm aware of but it may improve optimisation in
some cases.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 11191.Jul 9 2014, 5:53 AM
dsanders retitled this revision from to [mips] clz is defined to give 32 for zero. Similarly, dclz gives 64..
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added a reviewer: atanasyan.
atanasyan accepted this revision.Jul 9 2014, 6:25 AM
atanasyan edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jul 9 2014, 6:25 AM
dsanders closed this revision.Jul 9 2014, 6:51 AM