add another overflow idiom
authorChris Lattner <sabre@nondot.org>
Wed, 15 Dec 2010 07:28:58 +0000 (07:28 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 15 Dec 2010 07:28:58 +0000 (07:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121854 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/README.txt

index e59c28697a196c47f4c6f83f881c59e029217b9c..5c97b8984c1d6e9e172445cca7099c3a5f57ba89 100644 (file)
@@ -93,6 +93,14 @@ when it would be better to generate:
        addq    %rdi, %rbx
        jno     LBB0_2
 
+Apparently some version of GCC knows this.  Here is a multiply idiom:
+
+unsigned int mul(unsigned int a,unsigned int b) {
+ if ((unsigned long long)a*b>0xffffffff)
+   exit(0);
+  return a*b;
+}
+
 //===---------------------------------------------------------------------===//
 
 Get the C front-end to expand hypot(x,y) -> llvm.sqrt(x*x+y*y) when errno and