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

--- Comment #14 from Jaydeep Chauhan <jaydeepchauhan1494 at gmail dot com> ---
(In reply to Jaydeep Chauhan from comment #10)


I have tried solve this case using define_split or define_insn_and_split 
  but i am facing is some issue as per below:

1.It is not possible to combine below four instruction 

        addq    $1, %rax
        salq    $4, %rax
        addq    p1(%rip), %rax
        movl    (%rax), %eax

into the this
        shlq    $4, %rcx
        movl    16(%rax,%rcx), %eax 

using define_split or define_insn_and_split

To add offset "16" and "p1"  it is creating problem because "p1" is symbol ref.

2.Also to optimize 
        addq    p1(%rip), %rax
        movl    (%rax), %eax
into a single instruction it should need to be seperate define_split or
define_insn_and_split.
So it should need to be seperate 

3.I have also tried this case with peephole but i am facing same problem with
this also


(define_peephole2
  [(parallel [(set (match_operand:DI 0 "register_operand")
                 (plus:DI (match_dup 0)
                     (match_operand:DI 1 "const_int_operand")))
                 (clobber (reg:CC FLAGS_REG))])
   (parallel [(set (match_dup 0)
                 (ashift:DI (match_dup 0)
                         (match_operand 2 "const_int_operand")))
                 (clobber (reg:CC FLAGS_REG))])
   (parallel [(set (match_dup 0)
        (plus:DI (match_operand:DI 4 "nonimmediate_operand")
                 (mem:DI (match_operand:SDWIM 5 "<general_hilo_operand>"))))
                 (clobber (reg:CC FLAGS_REG))])]
  ""
  [(parallel [(set (match_dup 0)
                   (ashift:DI (match_dup 0)(match_dup 2)))
                   (clobber (reg:CC FLAGS_REG))])
   (parallel [(set (match_dup 0)
               (plus:DI (match_dup 4)
                    (mem:DI (match_dup 5))))
                    (clobber (reg:CC FLAGS_REG))])]
{
   int scale = 8 << INTVAL (operands[1]);
   operands[4] = gen_rtx_PLUS (DImode,operands[4], GEN_INT (scale));
})


Please share your comment/suggestion on this.

Reply via email to