public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/78952] Combine does not convert 8-bit sign-extract to a zero-extract for QImode operations
       [not found] <bug-78952-4@http.gcc.gnu.org/bugzilla/>
@ 2020-12-10  9:55 ` ubizjak at gmail dot com
  2020-12-10  9:55 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2020-12-10  9:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78952

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.0

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #6)
> (In reply to Martin Liška from comment #5)
> > Uros: Can the bug be marked as resolved?
> The patch implements the workaround for x86 targets, so it depends if we
> want the transformation in the middle-end or not.

Let's call this PR fixed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/78952] Combine does not convert 8-bit sign-extract to a zero-extract for QImode operations
       [not found] <bug-78952-4@http.gcc.gnu.org/bugzilla/>
  2020-12-10  9:55 ` [Bug rtl-optimization/78952] Combine does not convert 8-bit sign-extract to a zero-extract for QImode operations ubizjak at gmail dot com
@ 2020-12-10  9:55 ` ubizjak at gmail dot com
  2023-04-19 15:04 ` cvs-commit at gcc dot gnu.org
  2023-04-20 14:52 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2020-12-10  9:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78952

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/78952] Combine does not convert 8-bit sign-extract to a zero-extract for QImode operations
       [not found] <bug-78952-4@http.gcc.gnu.org/bugzilla/>
  2020-12-10  9:55 ` [Bug rtl-optimization/78952] Combine does not convert 8-bit sign-extract to a zero-extract for QImode operations ubizjak at gmail dot com
  2020-12-10  9:55 ` ubizjak at gmail dot com
@ 2023-04-19 15:04 ` cvs-commit at gcc dot gnu.org
  2023-04-20 14:52 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-19 15:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78952

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:

https://gcc.gnu.org/g:0df6d181230f0480547ed08b4e4354db68242724

commit r14-85-g0df6d181230f0480547ed08b4e4354db68242724
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Wed Apr 19 17:00:52 2023 +0200

    i386: Emit compares between high registers and memory

    Following code:

    typedef __SIZE_TYPE__ size_t;

    struct S1s
    {
      char pad1;
      char val;
      short pad2;
    };

    extern char ts[256];

    _Bool foo (struct S1s a, size_t i)
    {
      return (ts[i] > a.val);
    }

    compiles with -O2 to:

            movl    %edi, %eax
            movsbl  %ah, %edi
            cmpb    %dil, ts(%rsi)
            setg    %al
            ret

    the compare could use high register %ah instead of %dil:

            movl    %edi, %eax
            cmpb    ts(%rsi), %ah
            setl    %al
            ret

    Use any_extract code iterator to handle signed and unsigned extracts
    from high register and introduce peephole2 patterns to propagate
    norex memory opeerand into the compare insn.

    gcc/ChangeLog:

            PR target/78904
            PR target/78952
            * config/i386/i386.md (*cmpqi_ext<mode>_1_mem_rex64): New insn
pattern.
            (*cmpqi_ext<mode>_1): Use nonimmediate_operand predicate
            for operand 0. Use any_extract code iterator.
            (*cmpqi_ext<mode>_1 peephole2): New peephole2 pattern.
            (*cmpqi_ext<mode>_2): Use any_extract code iterator.
            (*cmpqi_ext<mode>_3_mem_rex64): New insn pattern.
            (*cmpqi_ext<mode>_1): Use general_operand predicate
            for operand 1. Use any_extract code iterator.
            (*cmpqi_ext<mode>_3 peephole2): New peephole2 pattern.
            (*cmpqi_ext<mode>_4): Use any_extract code iterator.

    gcc/testsuite/ChangeLog:

            PR target/78904
            PR target/78952
            * gcc.target/i386/pr78952-3.c: New test.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/78952] Combine does not convert 8-bit sign-extract to a zero-extract for QImode operations
       [not found] <bug-78952-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-04-19 15:04 ` cvs-commit at gcc dot gnu.org
@ 2023-04-20 14:52 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-20 14:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78952

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:

https://gcc.gnu.org/g:272484dae6b5264baa0f41eba80a9521e9b7ecf5

commit r14-117-g272484dae6b5264baa0f41eba80a9521e9b7ecf5
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Thu Apr 20 16:51:56 2023 +0200

    i386: Handle sign-extract for QImode operations with high registers
[PR78952]

    Introduce extract_operator predicate to handle both, zero-extract and
    sign-extract extract operations with expressions like:

        (subreg:QI
          (zero_extract:SWI248
            (match_operand 1 "int248_register_operand" "0")
            (const_int 8)
            (const_int 8)) 0)

    As shown in the testcase, this will enable generation of QImode
    instructions with high registers when signed arguments are used.

    gcc/ChangeLog:

            PR target/78952
            * config/i386/predicates.md (extract_operator): New predicate.
            * config/i386/i386.md (any_extract): Remove code iterator.
            (*cmpqi_ext<mode>_1_mem_rex64): Use extract_operator predicate.
            (*cmpqi_ext<mode>_1): Ditto.
            (*cmpqi_ext<mode>_2): Ditto.
            (*cmpqi_ext<mode>_3_mem_rex64): Ditto.
            (*cmpqi_ext<mode>_3): Ditto.
            (*cmpqi_ext<mode>_4): Ditto.
            (*extzvqi_mem_rex64): Ditto.
            (*extzvqi): Ditto.
            (*insvqi_2): Ditto.
            (*extendqi<SWI24:mode>_ext_1): Ditto.
            (*addqi_ext<mode>_0): Ditto.
            (*addqi_ext<mode>_1): Ditto.
            (*addqi_ext<mode>_2): Ditto.
            (*subqi_ext<mode>_0): Ditto.
            (*subqi_ext<mode>_2): Ditto.
            (*testqi_ext<mode>_1): Ditto.
            (*testqi_ext<mode>_2): Ditto.
            (*andqi_ext<mode>_0): Ditto.
            (*andqi_ext<mode>_1): Ditto.
            (*andqi_ext<mode>_1_cc): Ditto.
            (*andqi_ext<mode>_2): Ditto.
            (*<any_or:code>qi_ext<mode>_0): Ditto.
            (*<any_or:code>qi_ext<mode>_1): Ditto.
            (*<any_or:code>qi_ext<mode>_2): Ditto.
            (*xorqi_ext<mode>_1_cc): Ditto.
            (*negqi_ext<mode>_2): Ditto.
            (*ashlqi_ext<mode>_2): Ditto.
            (*<any_shiftrt:insn>qi_ext<mode>_2): Ditto.

    gcc/testsuite/ChangeLog:

            PR target/78952
            * gcc.target/i386/pr78952-4.c: New test.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-20 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-78952-4@http.gcc.gnu.org/bugzilla/>
2020-12-10  9:55 ` [Bug rtl-optimization/78952] Combine does not convert 8-bit sign-extract to a zero-extract for QImode operations ubizjak at gmail dot com
2020-12-10  9:55 ` ubizjak at gmail dot com
2023-04-19 15:04 ` cvs-commit at gcc dot gnu.org
2023-04-20 14:52 ` cvs-commit 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).