https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90209
Bug ID: 90209 Summary: codegen regression (x < 0 ? -x : x) results in branch instead of single instruction on x86_64 Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vegard.nossum at oracle dot com Target Milestone: --- This test case: double abs1(double x) { return x < 0 ? -x : x; } used to generate just a single "andpd" instruction before r131381 (5921cbdff68): abs1: andpd .LC2(%rip), %xmm0 ret afterward this revision, it generated this: fabs1: movapd %xmm0, %xmm1 ucomisd .LC0(%rip), %xmm0 jb .L7 .L2: movapd %xmm1, %xmm0 ret .L7: jp .L2 movsd .LC1(%rip), %xmm0 xorpd %xmm0, %xmm1 movapd %xmm1, %xmm0 ret The branch is still present on trunk, as can be seen here: https://godbolt.org/z/P4tQMB Thanks to jakub for narrowing it down to r131375..r131425. Three related bugs (AFAICT) are #29253, #62055, and #64897.