[mips] clz is defined to give 32 for zero. Similarly, dclz gives 64.
authorDaniel Sanders <daniel.sanders@imgtec.com>
Wed, 9 Jul 2014 13:43:19 +0000 (13:43 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Wed, 9 Jul 2014 13:43:19 +0000 (13:43 +0000)
commitcfbb71dfb6464d9d442d6fc2fa0b76ded3981a53
treef0f0c304144f672b0c44889d4610783715083060
parent85bcadcdc6282c0e054c45d217e1ba64653e6a66
[mips] clz is defined to give 32 for zero. Similarly, dclz gives 64.

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.

Differential Revision: http://reviews.llvm.org/D4431

llvm-svn: 212618
clang/lib/Basic/Targets.cpp
clang/test/CodeGen/mips-count-builtins.c [new file with mode: 0644]