OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [tools/] [riscv-gnu-toolchain-master/] [gcc/] [gcc/] [config/] [riscv/] [peephole.md] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 serginhofr
;;........................
2
;; DI -> SI optimizations
3
;;........................
4
 
5
;; Simplify (int)(a + 1), etc.
6
(define_peephole2
7
  [(set (match_operand:DI 0 "register_operand")
8
        (match_operator:DI 4 "modular_operator"
9
          [(match_operand:DI 1 "register_operand")
10
           (match_operand:DI 2 "arith_operand")]))
11
   (set (match_operand:SI 3 "register_operand")
12
        (truncate:SI (match_dup 0)))]
13
  "TARGET_64BIT && (REGNO (operands[0]) == REGNO (operands[3]) || peep2_reg_dead_p (2, operands[0]))
14
   && (GET_CODE (operands[4]) != ASHIFT || (CONST_INT_P (operands[2]) && INTVAL (operands[2]) < 32))"
15
  [(set (match_dup 3)
16
          (truncate:SI
17
             (match_op_dup:DI 4
18
               [(match_operand:DI 1 "register_operand")
19
                (match_operand:DI 2 "arith_operand")])))])
20
 
21
;; Simplify (int)a + 1, etc.
22
(define_peephole2
23
  [(set (match_operand:SI 0 "register_operand")
24
        (truncate:SI (match_operand:DI 1 "register_operand")))
25
   (set (match_operand:SI 3 "register_operand")
26
        (match_operator:SI 4 "modular_operator"
27
          [(match_dup 0)
28
           (match_operand:SI 2 "arith_operand")]))]
29
  "TARGET_64BIT && (REGNO (operands[0]) == REGNO (operands[3]) || peep2_reg_dead_p (2, operands[0]))"
30
  [(set (match_dup 3)
31
        (match_op_dup:SI 4 [(match_dup 1) (match_dup 2)]))])
32
 
33
;; Simplify -(int)a, etc.
34
(define_peephole2
35
  [(set (match_operand:SI 0 "register_operand")
36
        (truncate:SI (match_operand:DI 2 "register_operand")))
37
   (set (match_operand:SI 3 "register_operand")
38
        (match_operator:SI 4 "modular_operator"
39
          [(match_operand:SI 1 "reg_or_0_operand")
40
           (match_dup 0)]))]
41
  "TARGET_64BIT && (REGNO (operands[0]) == REGNO (operands[3]) || peep2_reg_dead_p (2, operands[0]))"
42
  [(set (match_dup 3)
43
        (match_op_dup:SI 4 [(match_dup 1) (match_dup 2)]))])
44
 
45
;; Simplify (unsigned long)(unsigned int)a << const
46
(define_peephole2
47
  [(set (match_operand:DI 0 "register_operand")
48
        (ashift:DI (match_operand:DI 1 "register_operand")
49
                   (match_operand 2 "const_int_operand")))
50
   (set (match_operand:DI 3 "register_operand")
51
        (lshiftrt:DI (match_dup 0) (match_dup 2)))
52
   (set (match_operand:DI 4 "register_operand")
53
        (ashift:DI (match_dup 3) (match_operand 5 "const_int_operand")))]
54
  "TARGET_64BIT
55
   && INTVAL (operands[5]) < INTVAL (operands[2])
56
   && (REGNO (operands[3]) == REGNO (operands[4])
57
       || peep2_reg_dead_p (3, operands[3]))"
58
  [(set (match_dup 0)
59
        (ashift:DI (match_dup 1) (match_dup 2)))
60
   (set (match_dup 4)
61
        (lshiftrt:DI (match_dup 0) (match_operand 5)))]
62
{
63
  operands[5] = GEN_INT (INTVAL (operands[2]) - INTVAL (operands[5]));
64
})
65
 
66
;; Simplify PIC loads to static variables.
67
;; These will go away once we figure out how to emit auipc discretely.
68
(define_insn "*local_pic_load"
69
  [(set (match_operand:ANYI 0 "register_operand" "=r")
70
        (mem:ANYI (match_operand 1 "absolute_symbolic_operand" "")))]
71
  "flag_pic && SYMBOL_REF_LOCAL_P (operands[1])"
72
  "\t%0,%1"
73
  [(set (attr "length") (const_int 8))])
74
(define_insn "*local_pic_load"
75
  [(set (match_operand:ANYF 0 "register_operand" "=f")
76
        (mem:ANYF (match_operand 1 "absolute_symbolic_operand" "")))
77
   (clobber (match_scratch:DI 2 "=&r"))]
78
  "TARGET_HARD_FLOAT && TARGET_64BIT && flag_pic && SYMBOL_REF_LOCAL_P (operands[1])"
79
  "\t%0,%1,%2"
80
  [(set (attr "length") (const_int 8))])
81
(define_insn "*local_pic_load"
82
  [(set (match_operand:ANYF 0 "register_operand" "=f")
83
        (mem:ANYF (match_operand 1 "absolute_symbolic_operand" "")))
84
   (clobber (match_scratch:SI 2 "=&r"))]
85
  "TARGET_HARD_FLOAT && !TARGET_64BIT && flag_pic && SYMBOL_REF_LOCAL_P (operands[1])"
86
  "\t%0,%1,%2"
87
  [(set (attr "length") (const_int 8))])
88
(define_insn "*local_pic_loadu"
89
  [(set (match_operand:SUPERQI 0 "register_operand" "=r")
90
        (zero_extend:SUPERQI (mem:SUBDI (match_operand 1 "absolute_symbolic_operand" ""))))]
91
  "flag_pic && SYMBOL_REF_LOCAL_P (operands[1])"
92
  "u\t%0,%1"
93
  [(set (attr "length") (const_int 8))])
94
(define_insn "*local_pic_storedi"
95
  [(set (mem:ANYI (match_operand 0 "absolute_symbolic_operand" ""))
96
        (match_operand:ANYI 1 "reg_or_0_operand" "rJ"))
97
   (clobber (match_scratch:DI 2 "=&r"))]
98
  "TARGET_64BIT && (flag_pic && SYMBOL_REF_LOCAL_P (operands[0]))"
99
  "\t%z1,%0,%2"
100
  [(set (attr "length") (const_int 8))])
101
(define_insn "*local_pic_storesi"
102
  [(set (mem:ANYI (match_operand 0 "absolute_symbolic_operand" ""))
103
        (match_operand:ANYI 1 "reg_or_0_operand" "rJ"))
104
   (clobber (match_scratch:SI 2 "=&r"))]
105
  "!TARGET_64BIT && (flag_pic && SYMBOL_REF_LOCAL_P (operands[0]))"
106
  "\t%z1,%0,%2"
107
  [(set (attr "length") (const_int 8))])
108
(define_insn "*local_pic_storedi"
109
  [(set (mem:ANYF (match_operand 0 "absolute_symbolic_operand" ""))
110
        (match_operand:ANYF 1 "register_operand" "f"))
111
   (clobber (match_scratch:DI 2 "=&r"))]
112
  "TARGET_HARD_FLOAT && TARGET_64BIT && (flag_pic && SYMBOL_REF_LOCAL_P (operands[0]))"
113
  "\t%1,%0,%2"
114
  [(set (attr "length") (const_int 8))])
115
(define_insn "*local_pic_storesi"
116
  [(set (mem:ANYF (match_operand 0 "absolute_symbolic_operand" ""))
117
        (match_operand:ANYF 1 "register_operand" "f"))
118
   (clobber (match_scratch:SI 2 "=&r"))]
119
  "TARGET_HARD_FLOAT && !TARGET_64BIT && (flag_pic && SYMBOL_REF_LOCAL_P (operands[0]))"
120
  "\t%1,%0,%2"
121
  [(set (attr "length") (const_int 8))])

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.