[Bug rtl-optimization/82889] New: Unnecessary sign extension of int32 to int64
hiraditya at msn dot com
gcc-bugzilla@gcc.gnu.org
Tue Nov 7 20:22:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82889
Bug ID: 82889
Summary: Unnecessary sign extension of int32 to int64
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: hiraditya at msn dot com
Target Milestone: ---
$ cat t.cpp
#include <stdint.h>
int lol(int32_t* table, int32_t* ht, uint32_t hash, uint32_t mask) {
for (uint64_t probe = (uint32_t)hash & mask, i = 1;; ++i) {
int32_t pos = ht[probe];
if (pos >= 0) {
if (table[pos] == 42) {
return true;
}
} else if (pos & 1) {
return false;
}
probe += i;
probe &= mask;
}
// notreached
}
compile with:
gcc -std=c++11 -O3 -s -o -
lol(int*, int*, unsigned int, unsigned int):
andl %ecx, %edx
movl $1, %r8d
movl %ecx, %ecx
jmp .L5
.L10:
cmpl $42, (%rdi,%rax,4)
je .L9
.L4:
addq %r8, %rdx
addq $1, %r8
andq %rcx, %rdx
.L5:
movslq (%rsi,%rdx,4), %rax #<------------sign extended
testl %eax, %eax
jns .L10
testb $1, %al
je .L4
xorl %eax, %eax
ret
.L9:
movl $1, %eax
ret
Is it possible to get rid of this?
More information about the Gcc-bugs
mailing list