public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug target/115418] New: [14 regression] Extra movapd emitted for MAX implementation @ 2024-06-10 17:06 sjames at gcc dot gnu.org 2024-06-10 17:13 ` [Bug target/115418] " pinskia at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: sjames at gcc dot gnu.org @ 2024-06-10 17:06 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115418 Bug ID: 115418 Summary: [14 regression] Extra movapd emitted for MAX implementation Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: sjames at gcc dot gnu.org Target Milestone: --- ``` #define MAX(a, b) ((a) < (b) ? (b) : (a)) #define MAX3(a, b, c) MAX((a), MAX((b), (c))) double f(double a, double b, double c) { return MAX3(a,b,c); } ``` ``` $ gcc-14 /tmp/foo200.c -S -o - -O2 .file "foo200.c" .text .p2align 4 .globl f .type f, @function f: .LFB0: .cfi_startproc movapd %xmm2, %xmm3 maxsd %xmm1, %xmm3 maxsd %xmm0, %xmm3 movapd %xmm3, %xmm0 ret .cfi_endproc .LFE0: .size f, .-f .ident "GCC: (Gentoo Hardened 14.1.1_p20240608 p2) 14.1.1 20240608" .section .note.GNU-stack,"",@progbits ``` I only see the extra movapd with 14. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/115418] [14 regression] Extra movapd emitted for MAX implementation 2024-06-10 17:06 [Bug target/115418] New: [14 regression] Extra movapd emitted for MAX implementation sjames at gcc dot gnu.org @ 2024-06-10 17:13 ` pinskia at gcc dot gnu.org 2024-06-10 17:21 ` [Bug target/115418] " pinskia at gcc dot gnu.org 2024-06-11 5:27 ` liuhongt at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-06-10 17:13 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115418 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Target| |x86_64-linux-gnu Last reconfirmed| |2024-06-10 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The difference between GCC 14 and 15 is: GCC 14: _1 = a_4(D) < _5; _7 = _1 ? _5 : a_4(D); GCC 15: _8 = _4 > a_5(D); _7 = _8 ? _4 : a_5(D); GCC 15's IR gets recognized for UNSPEC_IEEE_MAX while GCC 14's is not. If anything the target should recognize both cases ... Since both are canonical. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/115418] Extra movapd emitted for MAX implementation 2024-06-10 17:06 [Bug target/115418] New: [14 regression] Extra movapd emitted for MAX implementation sjames at gcc dot gnu.org 2024-06-10 17:13 ` [Bug target/115418] " pinskia at gcc dot gnu.org @ 2024-06-10 17:21 ` pinskia at gcc dot gnu.org 2024-06-11 5:27 ` liuhongt at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-06-10 17:21 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115418 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[14 regression] Extra |Extra movapd emitted for |movapd emitted for MAX |MAX implementation |implementation | --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note the issue is ix86_expand_sse_fp_minmax only handles LT/UNGE but it should handle GT/UNLT with both parts swapped (comparison and true/false). Note this was just by accident that GCC 14 does not work. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/115418] Extra movapd emitted for MAX implementation 2024-06-10 17:06 [Bug target/115418] New: [14 regression] Extra movapd emitted for MAX implementation sjames at gcc dot gnu.org 2024-06-10 17:13 ` [Bug target/115418] " pinskia at gcc dot gnu.org 2024-06-10 17:21 ` [Bug target/115418] " pinskia at gcc dot gnu.org @ 2024-06-11 5:27 ` liuhongt at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: liuhongt at gcc dot gnu.org @ 2024-06-11 5:27 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115418 Hongtao Liu <liuhongt at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |liuhongt at gcc dot gnu.org --- Comment #3 from Hongtao Liu <liuhongt at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #2) > Note the issue is ix86_expand_sse_fp_minmax only handles LT/UNGE but it > should handle GT/UNLT with both parts swapped (comparison and true/false). > GT/UNLT is "canonicalized" to GT/UNGT in ix86_prepare_sse_fp_compare_args 4410 case GE: 4411 case GT: 4412 case UNLE: 4413 case UNLT: 4414 /* These are not supported directly before AVX, and furthermore 4415 ix86_expand_sse_fp_minmax only optimizes LT/UNGE. Swap the 4416 comparison operands to transform into something that is 4417 supported. */ 4418 std::swap (*pop0, *pop1); 4419 code = swap_condition (code); ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-11 5:27 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-06-10 17:06 [Bug target/115418] New: [14 regression] Extra movapd emitted for MAX implementation sjames at gcc dot gnu.org 2024-06-10 17:13 ` [Bug target/115418] " pinskia at gcc dot gnu.org 2024-06-10 17:21 ` [Bug target/115418] " pinskia at gcc dot gnu.org 2024-06-11 5:27 ` liuhongt at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).