public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100089] New: [11 Performance regression ] 30% for denbench/mp2decoddata2 with -O3 Date: Thu, 15 Apr 2021 06:35:57 +0000 [thread overview] Message-ID: <bug-100089-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100089 Bug ID: 100089 Summary: [11 Performance regression ] 30% for denbench/mp2decoddata2 with -O3 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com CC: hjl.tools at gmail dot com Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-*-* i?86-*-* Created attachment 50597 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50597&action=edit denbench_mp2decoddata2.cpp https://godbolt.org/z/EGoz1zx61 cat test.cpp static inline void idctrow(e_s16 *blk) { e_s32 x0, x1, x2, x3, x4, x5, x6, x7, x8; if (!((x1 = blk[4]<<11) | (x2 = blk[6]) | (x3 = blk[2]) | (x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3]))) { blk[0]=blk[1]=blk[2]=blk[3]=blk[4]=blk[5]=blk[6]=blk[7]=(e_s16)blk[0]<<3; return; } x0 = (blk[0]<<11) + 128; x8 = 565*(x4+x5); x4 = x8 + (2841 -565)*x4; x5 = x8 - (2841 +565)*x5; x8 = 2408*(x6+x7); x6 = x8 - (2408 -1609)*x6; x7 = x8 - (2408 +1609)*x7; x8 = x0 + x1; x0 -= x1; x1 = 1108*(x3+x2); x2 = x1 - (2676 +1108)*x2; x3 = x1 + (2676 -1108)*x3; x1 = x4 + x6; x4 -= x6; x6 = x5 + x7; x5 -= x7; x7 = x8 + x3; x8 -= x3; x3 = x0 + x2; x0 -= x2; x2 = (181*(x4+x5)+128)>>8; x4 = (181*(x4-x5)+128)>>8; blk[0] = (e_s16)((x7+x1)>>8); blk[1] = (e_s16)((x3+x2)>>8); blk[2] = (e_s16)((x0+x4)>>8); blk[3] = (e_s16)((x8+x6)>>8); blk[4] = (e_s16)((x8-x6)>>8); blk[5] = (e_s16)((x0-x4)>>8); blk[6] = (e_s16)((x3-x2)>>8); blk[7] = (e_s16)((x7-x1)>>8); } int __attribute__ ((noipa)) Fast_IDCT(e_s16 *block) { e_s32 i; for (i=0; i<8; i++) idctrow(block+8*i); return 1; } pass_ifcvt transforms the if branch in idctrow into an conditional move, and then pass_vect finds that although there's no loop vectorization opportunity but there are opportunities for SLP, but the cost model of SLP does not consider the cost of these conditional movs, which eventually generates a large number of redundant test and cmov in codegen. test.cpp:76:11: note: stmt 1 MEM[(e_s16 *)_3 + 2B] = _ifc__264; test.cpp:76:11: note: stmt 2 MEM[(e_s16 *)_3 + 4B] = _ifc__267; test.cpp:76:11: note: stmt 3 MEM[(e_s16 *)_3 + 6B] = _ifc__270; test.cpp:76:11: note: stmt 4 MEM[(e_s16 *)_3 + 8B] = _ifc__273; test.cpp:76:11: note: stmt 5 MEM[(e_s16 *)_3 + 10B] = _ifc__276; test.cpp:76:11: note: stmt 6 MEM[(e_s16 *)_3 + 12B] = _ifc__279; test.cpp:76:11: note: stmt 7 MEM[(e_s16 *)_3 + 14B] = _ifc__282; test.cpp:76:11: note: children 0x3ec9580 test.cpp:76:11: note: node (external) 0x3ec9580 (max_nunits=1, refcnt=1) test.cpp:76:11: note: { _ifc__261, _ifc__264, _ifc__267, _ifc__270, _ifc__273, _ifc__276, _ifc__279, _ifc__282 } test.cpp:76:11: note: Cost model analysis: 0x3c1aee0 _ifc__261 1 times scalar_store costs 12 in body 0x3c1aee0 _ifc__264 1 times scalar_store costs 12 in body 0x3c1aee0 _ifc__267 1 times scalar_store costs 12 in body 0x3c1aee0 _ifc__270 1 times scalar_store costs 12 in body 0x3c1aee0 _ifc__273 1 times scalar_store costs 12 in body 0x3c1aee0 _ifc__276 1 times scalar_store costs 12 in body 0x3c1aee0 _ifc__279 1 times scalar_store costs 12 in body 0x3c1aee0 _ifc__282 1 times scalar_store costs 12 in body 0x3c1aee0 _ifc__261 1 times unaligned_store (misalign -1) costs 12 in body 0x3c1aee0 <unknown> 1 times vec_construct costs 32 in prologue test.cpp:76:11: note: Cost model analysis for part in loop 1: Vector cost: 44 Scalar cost: 96 int Fast_IDCT (e_s16 * block) { vector(8) short int * vectp.78; vector(8) short int * vectp.77; e_s32 x0; e_s32 x1; e_s32 x2; e_s32 x3; e_s32 x4; e_s32 x5; e_s32 x6; e_s32 x7; e_s32 x8; e_s32 i; long unsigned int i.0_1; long unsigned int _2; e_s16 * _3; unsigned long ivtmp_4; unsigned long ivtmp_5; short int _10; int _11; int _12; short int _14; short int _16; short int _17; short int _19; short int _20; short int _22; short int _23; short int _25; short int _26; short int _28; short int _29; long int _31; int _34; short int _35; int _38; int _39; long int _41; long int _43; long int _45; long int _47; long int _49; long int _51; long int _55; long int _57; long int _59; long int _69; long int _70; long int _71; long int _73; long int _74; long int _75; long int _77; long int _78; short int _79; long int _80; long int _81; short int _82; long int _83; long int _84; short int _85; long int _86; long int _87; short int _88; long int _89; long int _90; short int _91; long int _92; long int _93; short int _94; long int _95; long int _96; short int _97; long int _98; long int _99; short int _100; long int _118; bool _121; short int pretmp_159; int _160; short int _ifc__237; short int _ifc__240; short int _ifc__243; short int _ifc__246; short int _ifc__249; short int _ifc__252; short int _ifc__255; short int _ifc__258; short int _ifc__261; short int _ifc__264; short int _ifc__267; short int _ifc__270; short int _ifc__273; short int _ifc__276; short int _ifc__279; short int _ifc__282; vector(8) short int _1154; <bb 2> [local count: 119292720]: _121 = 1; <bb 3> [local count: 954449105]: # i_122 = PHI <i_9(8), 0(2)> # ivtmp_5 = PHI <ivtmp_4(8), 8(2)> i.0_1 = (long unsigned int) i_122; _2 = i.0_1 * 16; _3 = block_7(D) + _2; _10 = MEM[(e_s16 *)_3 + 8B]; _11 = (int) _10; _12 = _11 << 11; x1_13 = (e_s32) _12; _14 = MEM[(e_s16 *)_3 + 12B]; _17 = MEM[(e_s16 *)_3 + 4B]; _16 = _14 | _17; _20 = MEM[(e_s16 *)_3 + 2B]; _19 = _16 | _20; _23 = MEM[(e_s16 *)_3 + 14B]; _22 = _19 | _23; _26 = MEM[(e_s16 *)_3 + 10B]; _25 = _22 | _26; _29 = MEM[(e_s16 *)_3 + 6B]; _28 = _25 | _29; _118 = (long int) _28; _31 = x1_13 | _118; pretmp_159 = *_3; _160 = (int) pretmp_159; _34 = _160 << 3; _35 = (short int) _34; _ifc__237 = _31 != 0 ? _23 : _35; _ifc__240 = _31 != 0 ? _14 : _35; _ifc__243 = _31 != 0 ? _26 : _35; _ifc__246 = _31 != 0 ? _10 : _35; _ifc__249 = _31 != 0 ? _29 : _35; _ifc__252 = _31 != 0 ? _17 : _35; _ifc__255 = _31 != 0 ? _20 : _35; _ifc__258 = _31 == 0 ? _35 : pretmp_159; x2_15 = (e_s32) _14; x3_18 = (e_s32) _17; x4_21 = (e_s32) _20; x5_24 = (e_s32) _23; x6_27 = (e_s32) _26; x7_30 = (e_s32) _29; _38 = _160 << 11; _39 = _38 + 128; x0_40 = (e_s32) _39; _41 = x4_21 + x5_24; x8_42 = _41 * 565; _43 = x4_21 * 2276; x4_44 = x8_42 + _43; _45 = x5_24 * -3406; x5_46 = x8_42 + _45; _47 = x6_27 + x7_30; x8_48 = _47 * 2408; _49 = x6_27 * -799; x6_50 = x8_48 + _49; _51 = x7_30 * -4017; x7_52 = x8_48 + _51; x8_53 = x1_13 + x0_40; x0_54 = x0_40 - x1_13; _55 = x2_15 + x3_18; x1_56 = _55 * 1108; _57 = x2_15 * -3784; x2_58 = x1_56 + _57; _59 = x3_18 * 1568; x3_60 = x1_56 + _59; x1_61 = x4_44 + x6_50; x4_62 = x4_44 - x6_50; x6_63 = x5_46 + x7_52; x5_64 = x5_46 - x7_52; x7_65 = x8_53 + x3_60; x8_66 = x8_53 - x3_60; x3_67 = x0_54 + x2_58; x0_68 = x0_54 - x2_58; _69 = x4_62 + x5_64; _70 = _69 * 181; _71 = _70 + 128; x2_72 = _71 >> 8; _73 = x4_62 - x5_64; _74 = _73 * 181; _75 = _74 + 128; x4_76 = _75 >> 8; _77 = x1_61 + x7_65; _78 = _77 >> 8; _79 = (short int) _78; _ifc__261 = _31 != 0 ? _79 : _ifc__258; _80 = x3_67 + x2_72; _81 = _80 >> 8; _82 = (short int) _81; _ifc__264 = _31 != 0 ? _82 : _ifc__255; _83 = x0_68 + x4_76; _84 = _83 >> 8; _85 = (short int) _84; _ifc__267 = _31 != 0 ? _85 : _ifc__252; _86 = x6_63 + x8_66; _87 = _86 >> 8; _88 = (short int) _87; _ifc__270 = _31 != 0 ? _88 : _ifc__249; _89 = x8_66 - x6_63; _90 = _89 >> 8; _91 = (short int) _90; _ifc__273 = _31 != 0 ? _91 : _ifc__246; _92 = x0_68 - x4_76; _93 = _92 >> 8; _94 = (short int) _93; _ifc__276 = _31 != 0 ? _94 : _ifc__243; _95 = x3_67 - x2_72; _96 = _95 >> 8; _97 = (short int) _96; _ifc__279 = _31 != 0 ? _97 : _ifc__240; _98 = x7_65 - x1_61; _99 = _98 >> 8; _100 = (short int) _99; _ifc__282 = _31 != 0 ? _100 : _ifc__237; _1154 = {_ifc__261, _ifc__264, _ifc__267, _ifc__270, _ifc__273, _ifc__276, _ifc__279, _ifc__282}; vectp.78_1155 = _3; MEM <vector(8) short int> [(e_s16 *)vectp.78_1155] = _1154; i_9 = i_122 + 1; ivtmp_4 = ivtmp_5 - 1; if (ivtmp_4 != 0) goto <bb 8>; [87.50%] else goto <bb 7>; [12.50%] <bb 8> [local count: 835156386]: goto <bb 3>; [100.00%] <bb 7> [local count: 119292720]: return 1; }
next reply other threads:[~2021-04-15 6:35 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-15 6:35 crazylht at gmail dot com [this message] 2021-04-15 7:17 ` [Bug tree-optimization/100089] [11 Regression] 30% performance regression " rguenth at gcc dot gnu.org 2021-04-27 11:40 ` [Bug tree-optimization/100089] [11/12 " jakub at gcc dot gnu.org 2021-05-12 8:19 ` rsandifo at gcc dot gnu.org 2021-05-12 8:27 ` rguenth at gcc dot gnu.org 2021-07-28 7:06 ` rguenth at gcc dot gnu.org 2021-08-23 12:47 ` rguenth at gcc dot gnu.org 2021-08-24 1:28 ` cvs-commit at gcc dot gnu.org 2021-08-24 9:36 ` rguenth at gcc dot gnu.org 2021-08-24 10:34 ` rguenth at gcc dot gnu.org 2021-08-24 12:23 ` cvs-commit at gcc dot gnu.org 2021-08-24 12:27 ` rguenth at gcc dot gnu.org 2021-08-30 12:05 ` rguenth at gcc dot gnu.org 2021-08-31 10:27 ` rguenth at gcc dot gnu.org 2022-01-21 12:34 ` rguenth at gcc dot gnu.org 2022-01-21 13:23 ` cvs-commit at gcc dot gnu.org 2022-01-21 13:24 ` [Bug tree-optimization/100089] [11 " rguenth at gcc dot gnu.org 2022-04-21 7:49 ` rguenth at gcc dot gnu.org 2023-05-29 10:04 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-100089-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).