[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-08-31 Thread aagarwa at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #16 from Ajit Kumar Agarwal --- This patch https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624751.html removes the zero extension from the below testcase that has different cfg, My patch is not based on any CFG shape but it is g

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-07-20 Thread jskumari at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #15 from Surya Kumari Jangala --- This is another test which has unnecessary zero extension: #include bool glob1; bool glob2; bool foo (int a, bool d) { bool c; if (a > 2) c = glob1 & glob2; else c = glob1 | glob2;

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-04-11 Thread aagarwa at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 Ajit Kumar Agarwal changed: What|Removed |Added Ever confirmed|0 |1 Last reconfirmed|

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-03-16 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #14 from Richard Biener --- I get, for -mcpu=power9 or power10 foo: .LFB0: .cfi_startproc cmpwi 0,3,2 bgt 0,.L3 cmpwi 0,4,9 li 3,1 isel 3,0,3,1 blr .p2align 4,,15 .L3:

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-03-06 Thread jskumari at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #13 from Surya Kumari Jangala --- Thanks David and Segher for your comments. I wanted to note down my analysis and thoughts from when I had worked on this bug in January. Ajit is looking into it now.

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-03-05 Thread segher at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #12 from Segher Boessenkool --- What David says :-) We really could use something good for this, it has been a problem for all GCC targets since forever; it hurts rs6000 more than most though. Before RA this is a diamond, one side

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-03-05 Thread dje at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #11 from David Edelsohn --- Have you looked on the GCC mailing list for zero-extend elimination (zee) and sign-extend elimination (see)? The many, previous proposals for such passes.

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-03-05 Thread jskumari at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #10 from Surya Kumari Jangala --- After the expand pass, we have a single return bb which first zero extends r117 (this reg holds the return value which has been set by predecessor blocks). Zero extension is done because r117 is of m

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-02-28 Thread jskumari at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #9 from Surya Kumari Jangala --- The same issue of unnecessary rldicl instruction is there if we change return value from bool to int. int foo (int a, int b) { if (a > 2) return 0; if (b < 10) return 1; return 0; }

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-01-05 Thread jskumari at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #8 from Surya Kumari Jangala --- Using -O3 with gcc13, I got (with the test in comment 2): For P8: cmpwi 0,3,2 bgt 0,.L3 subfic 4,4,9 srdi 3,4,63 xori 3,3,0x1 rldicl 3,3,0,63 b

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-01-04 Thread segher at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #7 from Segher Boessenkool --- I do get that exact same code with everything from GCC 6 to GCC 12 as well though (modulo a small regression in GCC 10).

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-01-04 Thread segher at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #6 from Segher Boessenkool --- Ugh, this PR is for GCC 12 only, ignore me please :-)

[Bug target/103784] suboptimal code for returning bool value on target ppc

2023-01-04 Thread segher at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #5 from Segher Boessenkool --- I get simply subfic 3,3,2 srdi 3,3,63 xori 3,3,0x1 blr for this code. Did you use -O0 or similar?

[Bug target/103784] suboptimal code for returning bool value on target ppc

2021-12-20 Thread guihaoc at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #4 from HaoChen Gui --- output with "-fdump-tree-optimized=/dev/stdout" ;; Function foo (foo, funcdef_no=0, decl_uid=3317, cgraph_uid=1, symbol_order=0) Removing basic block 5 _Bool foo (int a, int b) { _Bool _1; _Bool _5; [

[Bug target/103784] suboptimal code for returning bool value on target ppc

2021-12-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #3 from Andrew Pinski --- I wonder if this is because on the gimple level we are producing: _5 = b_3(D) <= 9; _6 = a_2(D) <= 2; _7 = _5 & _6; Now. Can you add -fdump-tree-optimized=/dev/stdout and provide the output of that

[Bug target/103784] suboptimal code for returning bool value on target ppc

2021-12-20 Thread guihaoc at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 --- Comment #2 from HaoChen Gui --- Sorry, I pasted wrong codes. Here are the correct ones. //test.c #include bool foo (int a, int b) { if (a > 2) return false; if (b < 10) return true; return false; } //assembly with the trunk

[Bug target/103784] suboptimal code for returning bool value on target ppc

2021-12-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103784 Andrew Pinski changed: What|Removed |Added Keywords||missed-optimization --- Comment #1 from