summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2012-01-26 22:14:27 +0000
committerBob Wilson <bob.wilson@apple.com>2012-01-26 22:14:27 +0000
commita7a61e270183eb36f8353d049a1892a59f459deb (patch)
treeb0edf31ae9baf1b754a791e4c65830f9899afbae /clang/lib/Basic/Targets.cpp
parent6a6a30d555e20507f42f25eb7d7662165f4cf2cb (diff)
downloadbcm5719-llvm-a7a61e270183eb36f8353d049a1892a59f459deb.tar.gz
bcm5719-llvm-a7a61e270183eb36f8353d049a1892a59f459deb.zip
Make clz/ctz builtins defined for zero on ARM targets. rdar://10732455
ARM supports clz and ctz directly and both operations have well-defined results for zero. There is no disadvantage in performance to using the defined-at-zero versions of llvm.ctlz/cttz intrinsics. We're running into ARM-specific code written with the assumption that __builtin_clz(0) == 32, even though that value is technically undefined. The code is failing now because of llvm optimizations that are taking advantage of the undef behavior (specifically svn r147255). There's nothing wrong with that optimization on x86 where any incorrect assumptions about __builtin_clz(0) will quickly be exposed. For ARM, though, optimizations based on that undef behavior are likely to cause subtle bugs. Other targets with defined-at-zero clz/ctz support may want to override the default behavior as well. llvm-svn: 149086
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r--clang/lib/Basic/Targets.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index f0e3bc4b74a..a5571422906 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -2778,6 +2778,7 @@ public:
Records = BuiltinInfo;
NumRecords = clang::ARM::LastTSBuiltin-Builtin::FirstTSBuiltin;
}
+ virtual bool isCLZForZeroUndef() const { return false; }
virtual const char *getVAListDeclaration() const {
return "typedef void* __builtin_va_list;";
}
OpenPOWER on IntegriCloud