[Bug target/97950] Unoptimal code generation with __builtin_*_overflow{,_p} for short

2020-11-24 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97950

Jakub Jelinek  changed:

   What|Removed |Added

Summary|Unoptimal code generation   |Unoptimal code generation
   |with|with
   |__builtin_*_overflow{,_p}   |__builtin_*_overflow{,_p}
   |for short and __int128  |for short
 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #6 from Jakub Jelinek  ---
Fixed for 11.1, too risky for backports.

[Bug target/97950] Unoptimal code generation with __builtin_*_overflow{,_p} for short and __int128

2020-11-24 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97950

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:a1dd66b108cba086f58448ccbe9bf57b0a342f9a

commit r11-5279-ga1dd66b108cba086f58448ccbe9bf57b0a342f9a
Author: Jakub Jelinek 
Date:   Tue Nov 24 10:45:40 2020 +0100

i386: Add *setcc_hi_1* define_insn_and_split [PR97950]

As the following testcase shows, unlike char, int or long long sized
__builtin_*_overflow{,_p}, for short sized one in most cases the ce1 pass
doesn't optimize the jo/jno or jc/jnc jumps with setting of a pseudo to 0/1
into seto/setc.  The reason is missing *setcc_hi_1* pattern.  The following
patch implements it using mode iterators so that on i486 and pentium?
one can get the zero extension through and instead of movzbw.

2020-11-24  Jakub Jelinek  

PR target/97950
* config/i386/i386.md (*setcc_si_1_and): Macroize into...
(*setcc__1_and): New define_insn_and_split with SWI24
iterator.
(*setcc_si_1_movzbl): Macroize into...
(*setcc__1_movzbl): New define_insn_and_split with SWI24
iterator.

* gcc.target/i386/pr97950.c: New test.

[Bug target/97950] Unoptimal code generation with __builtin_*_overflow{,_p} for short and __int128

2020-11-23 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97950

Jakub Jelinek  changed:

   What|Removed |Added

  Attachment #49613|0   |1
is obsolete||
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Last reconfirmed||2020-11-23

--- Comment #4 from Jakub Jelinek  ---
Created attachment 49615
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49615=edit
gcc11-pr97950.patch

Updated patch.

[Bug target/97950] Unoptimal code generation with __builtin_*_overflow{,_p} for short and __int128

2020-11-23 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97950

--- Comment #3 from Uroš Bizjak  ---
Comment on attachment 49613
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49613
gcc11-pr97950.patch

>+(define_insn_and_split "*setcc_hi_1"
>+  [(set (match_operand:HI 0 "register_operand" "=q")
>+  (match_operator:HI 1 "ix86_comparison_operator"
>+[(reg FLAGS_REG) (const_int 0)]))]
>+  "!TARGET_PARTIAL_REG_STALL"
>+  "#"
>+  "&& reload_completed"
>+  [(set (match_dup 2) (match_dup 1))
>+   (set (match_dup 0) (zero_extend:DI (match_dup 2)))]

zero_extend:HI

Perhaps you could apply SWI24 mode iterator to existing *setcc_si_1_and and
*setcc_si_1_movzbl?

[Bug target/97950] Unoptimal code generation with __builtin_*_overflow{,_p} for short and __int128

2020-11-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97950

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement