missed optimization during overflow computation (seto/xor)
| Bugzilla Link | 32327 |
| Resolution | FIXED |
| Resolved on | Nov 16, 2017 06:32 |
| Version | trunk |
| OS | Linux |
| CC | @aemerson,@hfinkel,@RKSimon,@rotateright |
Extended Description
clang version 5.0.0 (trunk 294296) Target: x86_64-unknown-linux-gnu
#include <inttypes.h> bool foo(uint32_t x, uint32_t y) { return !(((uint64_t)(x) * (uint64_t)(y)) >> 32); }
$ clang++ overflow.cc -O3 -S -o -
BB#0:
movl %edi, %eax
mull %esi
seto %al
xorb $1, %al
retq
.Lfunc_end0:
This should be:
movl %edi, %eax
mull %esi
setno %al
retq
Is there a test for this? This popped up in a real code.
Yes - see @umulo_not_i32 in test/CodeGen/X86/overflow-intrinsic-setcc-fold.ll.
This was fixed here: https://reviews.llvm.org/rL314514
Is there a test for this? This popped up in a real code.
I guess it's already been fixed. Here's what I get
clang version 6.0.0 Target: x86_64-apple-darwin16.7.0 Thread model: posix
BB#0: ## %entry
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
movl %edi, %eax
mull %esi
setno %al
popq %rbp
retq