public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/63949] New: Aarch64 instruction combiner does not optimize subsi_sxth function as expected
@ 2014-11-19 10:23 vekumar at gcc dot gnu.org
  2014-11-19 12:05 ` [Bug target/63949] " ktkachov at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: vekumar at gcc dot gnu.org @ 2014-11-19 10:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63949
           Summary: Aarch64 instruction combiner does not optimize
                    subsi_sxth function as expected
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vekumar at gcc dot gnu.org

Reference: https://bugs.linaro.org/show_bug.cgi?id=863

Test case 

int   subsi_sxth (int a, short  i)
{
  /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*sxth #?1" } } */
  return a - ((int)i << 1);
}

Assembly generated with GCC 5.0.0 20141114

subsi_sxth:
        sbfiz   w1, w1, 1, 16
        sub     w0, w0, w1
        ret

Expected 
       subw    w0,w0,w1,sxth 1


Combiner Says Failed to mismatch 

set (reg/i:SI 0 x0)
    (minus:SI (reg:SI 0 x0 [ a ])
        (subreg:SI (sign_extract:DI (mult:DI (reg:DI 1 x1 [ i ])
                    (const_int 2 [0x2]))
                (const_int 17 [0x11])
                (const_int 0 [0])) 0)))

We have a pattern that would match in aarch64.md file, but it is not
recognized.

(define_insn "*sub_<optab><mode>_multp2"
   [(set (match_operand:GPI 0 "register_operand" "=rk")
         (minus:GPI (match_operand:GPI 4 "register_operand" "r")
                    (ANY_EXTRACT:GPI
                     (mult:GPI (match_operand:GPI 1 "register_operand" "r")
                               (match_operand 2 "aarch64_pwr_imm3" "Up3"))
                     (match_operand 3 "const_int_operand" "n")
                     (const_int 0))))]
   "aarch64_is_extend_from_extract (<MODE>mode, operands[2], operands[3])"
   "sub\\t%<w>0, %<w>4, %<w>1, <su>xt%e3 %p2"
   [(set_attr "type" "alu_ext")]
 )


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

end of thread, other threads:[~2015-05-26 16:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-19 10:23 [Bug target/63949] New: Aarch64 instruction combiner does not optimize subsi_sxth function as expected vekumar at gcc dot gnu.org
2014-11-19 12:05 ` [Bug target/63949] " ktkachov at gcc dot gnu.org
2014-11-19 17:20 ` pinskia at gcc dot gnu.org
2014-11-22 10:27 ` [Bug target/63949] Aarch64 instruction combiner does not optimize subsi_sxth function as expected (gcc.target/aarch64/extend.c fails) rearnsha at gcc dot gnu.org
2014-12-19 11:28 ` vekumar at gcc dot gnu.org
2014-12-19 11:52 ` vekumar at gcc dot gnu.org
2015-01-01 11:35 ` vekumar at gcc dot gnu.org
2015-01-02 13:38 ` vekumar at gcc dot gnu.org
2015-01-06  8:13 ` vekumar at gcc dot gnu.org
2015-01-08 12:07 ` segher at gcc dot gnu.org
2015-01-15 10:56 ` ramana at gcc dot gnu.org
2015-01-15 10:57 ` pinskia at gcc dot gnu.org
2015-05-26 16:36 ` vekumar 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).