[Bug target/68543] New: Implement overflow arithmetic standard names {u,}{add,sub,mul}v4<mode> and/or negv3<mode>
ktkachov at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 25 17:26:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68543
Bug ID: 68543
Summary: Implement overflow arithmetic standard names
{u,}{add,sub,mul}v4<mode> and/or negv3<mode>
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: ktkachov at gcc dot gnu.org
Target Milestone: ---
As mentioned in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66112#c13
we should consider implementing the various overflow arithmetic standard name
expanders that take a label argument and emit a jump to it if the operation
overflows.
A motivational example is the code quality regression from PR 68381:
int
foo(unsigned short x, unsigned short y)
{
int r;
if (__builtin_mul_overflow (x, y, &r))
__builtin_abort ();
return r;
}
which for aarch64 at -O3 generates:
foo:
uxth w0, w0
uxth w1, w1
umull x0, w0, w1
tbnz w0, #31, .L6
mov w2, 0
cbnz w2, .L6
ret
.L6:
stp x29, x30, [sp, -16]!
add x29, sp, 0
bl abort
which could be improved
More information about the Gcc-bugs
mailing list