View | Details | Return to bug 23726 | Differences between
and this patch

Collapse All | Expand All

(-)predicates.md (+6 lines)
Lines 105-107 Link Here
105
  (and (match_code "mem")
105
  (and (match_code "mem")
106
       (ior (match_test "register_operand (XEXP (op, 0), mode)")
106
       (ior (match_test "register_operand (XEXP (op, 0), mode)")
107
            (match_test "CONSTANT_ADDRESS_P (XEXP (op, 0))"))))
107
            (match_test "CONSTANT_ADDRESS_P (XEXP (op, 0))"))))
108
109
110
;;
111
(define_predicate "pseudo_register_operand"
112
  (and (match_code "reg")
113
       (match_test "!HARD_REGISTER_P (op)")))
(-)avr.md (-38 / +106 lines)
Lines 980-996 Link Here
980
;;  - we know exactly which registers are clobbered (for QI and HI
980
;;  - we know exactly which registers are clobbered (for QI and HI
981
;;    modes, some of the call-used registers are preserved)
981
;;    modes, some of the call-used registers are preserved)
982
;;  - we get both the quotient and the remainder at no extra cost
982
;;  - we get both the quotient and the remainder at no extra cost
983
983
;;  - we split the patterns only after the first CSE passes because
984
(define_expand "divmodqi4"
984
;;    CSE has problems to operate on hard regs.
985
  [(set (reg:QI 24) (match_operand:QI 1 "register_operand" ""))
985
;; 
986
   (set (reg:QI 22) (match_operand:QI 2 "register_operand" ""))
986
(define_insn_and_split "divmodqi4"
987
  [(parallel [(set (match_operand:QI 0 "pseudo_register_operand" "") 
988
                   (div:QI (match_operand:QI 1 "pseudo_register_operand" "") 
989
                           (match_operand:QI 2 "pseudo_register_operand" "")))
990
              (set (match_operand:QI 3 "pseudo_register_operand" "") 
991
                   (mod:QI (match_dup 1) (match_dup 2)))
992
              (clobber (reg:QI 22)) 
993
              (clobber (reg:QI 23)) 
994
              (clobber (reg:QI 24)) 
995
              (clobber (reg:QI 25))])]
996
  ""
997
  "this divmodqi4 pattern should have been splitted;"
998
  ""
999
  [(set (reg:QI 24) (match_dup 1))
1000
   (set (reg:QI 22) (match_dup 2))
987
   (parallel [(set (reg:QI 24) (div:QI (reg:QI 24) (reg:QI 22)))
1001
   (parallel [(set (reg:QI 24) (div:QI (reg:QI 24) (reg:QI 22)))
988
	      (set (reg:QI 25) (mod:QI (reg:QI 24) (reg:QI 22)))
1002
	      (set (reg:QI 25) (mod:QI (reg:QI 24) (reg:QI 22)))
989
	      (clobber (reg:QI 22))
1003
	      (clobber (reg:QI 22))
990
	      (clobber (reg:QI 23))])
1004
	      (clobber (reg:QI 23))])
991
   (set (match_operand:QI 0 "register_operand" "") (reg:QI 24))
1005
   (set (match_dup 0) (reg:QI 24))
992
   (set (match_operand:QI 3 "register_operand" "") (reg:QI 25))]
1006
   (set (match_dup 3) (reg:QI 25))]
993
  ""
994
  "")
1007
  "")
995
1008
996
(define_insn "*divmodqi4_call"
1009
(define_insn "*divmodqi4_call"
Lines 1003-1017 Link Here
1003
  [(set_attr "type" "xcall")
1016
  [(set_attr "type" "xcall")
1004
   (set_attr "cc" "clobber")])
1017
   (set_attr "cc" "clobber")])
1005
1018
1006
(define_expand "udivmodqi4"
1019
(define_insn_and_split "udivmodqi4"
1007
  [(set (reg:QI 24) (match_operand:QI 1 "register_operand" ""))
1020
 [(parallel [(set (match_operand:QI 0 "pseudo_register_operand" "") 
1008
   (set (reg:QI 22) (match_operand:QI 2 "register_operand" ""))
1021
                  (udiv:QI (match_operand:QI 1 "pseudo_register_operand" "") 
1022
                           (match_operand:QI 2 "pseudo_register_operand" "")))
1023
	     (set (match_operand:QI 3 "pseudo_register_operand" "") 
1024
                  (umod:QI (match_dup 1) (match_dup 2)))
1025
             (clobber (reg:QI 22))
1026
             (clobber (reg:QI 23))
1027
             (clobber (reg:QI 24))
1028
             (clobber (reg:QI 25))])]
1029
  ""
1030
  "this udivmodqi4 pattern should have been splitted;"
1031
  "" 
1032
  [(set (reg:QI 24) (match_dup 1))
1033
   (set (reg:QI 22) (match_dup 2))
1009
   (parallel [(set (reg:QI 24) (udiv:QI (reg:QI 24) (reg:QI 22)))
1034
   (parallel [(set (reg:QI 24) (udiv:QI (reg:QI 24) (reg:QI 22)))
1010
	      (set (reg:QI 25) (umod:QI (reg:QI 24) (reg:QI 22)))
1035
	      (set (reg:QI 25) (umod:QI (reg:QI 24) (reg:QI 22)))
1011
	      (clobber (reg:QI 23))])
1036
	      (clobber (reg:QI 23))])
1012
   (set (match_operand:QI 0 "register_operand" "") (reg:QI 24))
1037
   (set (match_dup 0) (reg:QI 24))
1013
   (set (match_operand:QI 3 "register_operand" "") (reg:QI 25))]
1038
   (set (match_dup 3) (reg:QI 25))]
1014
  ""
1015
  "")
1039
  "")
1016
1040
1017
(define_insn "*udivmodqi4_call"
1041
(define_insn "*udivmodqi4_call"
Lines 1023-1039 Link Here
1023
  [(set_attr "type" "xcall")
1047
  [(set_attr "type" "xcall")
1024
   (set_attr "cc" "clobber")])
1048
   (set_attr "cc" "clobber")])
1025
1049
1026
(define_expand "divmodhi4"
1050
(define_insn_and_split "divmodhi4"
1027
  [(set (reg:HI 24) (match_operand:HI 1 "register_operand" ""))
1051
  [(parallel [(set (match_operand:HI 0 "pseudo_register_operand" "") 
1028
   (set (reg:HI 22) (match_operand:HI 2 "register_operand" ""))
1052
                   (div:HI (match_operand:HI 1 "pseudo_register_operand" "") 
1053
                           (match_operand:HI 2 "pseudo_register_operand" "")))
1054
              (set (match_operand:HI 3 "pseudo_register_operand" "") 
1055
                   (mod:HI (match_dup 1) (match_dup 2)))
1056
              (clobber (reg:QI 21))
1057
              (clobber (reg:HI 22))
1058
              (clobber (reg:HI 24))
1059
              (clobber (reg:HI 26))])]
1060
  ""
1061
  "this should have been splitted;"
1062
  ""
1063
  [(set (reg:HI 24) (match_dup 1))
1064
   (set (reg:HI 22) (match_dup 2))
1029
   (parallel [(set (reg:HI 22) (div:HI (reg:HI 24) (reg:HI 22)))
1065
   (parallel [(set (reg:HI 22) (div:HI (reg:HI 24) (reg:HI 22)))
1030
	      (set (reg:HI 24) (mod:HI (reg:HI 24) (reg:HI 22)))
1066
	      (set (reg:HI 24) (mod:HI (reg:HI 24) (reg:HI 22)))
1031
	      (clobber (reg:HI 26))
1067
	      (clobber (reg:HI 26))
1032
	      (clobber (reg:QI 21))])
1068
	      (clobber (reg:QI 21))])
1033
   (set (match_operand:HI 0 "register_operand" "") (reg:HI 22))
1069
   (set (match_dup 0) (reg:HI 22))
1034
   (set (match_operand:HI 3 "register_operand" "") (reg:HI 24))]
1070
   (set (match_dup 3) (reg:HI 24))]
1035
  ""
1071
  "") 
1036
  "")
1037
1072
1038
(define_insn "*divmodhi4_call"
1073
(define_insn "*divmodhi4_call"
1039
  [(set (reg:HI 22) (div:HI (reg:HI 24) (reg:HI 22)))
1074
  [(set (reg:HI 22) (div:HI (reg:HI 24) (reg:HI 22)))
Lines 1045-1060 Link Here
1045
  [(set_attr "type" "xcall")
1080
  [(set_attr "type" "xcall")
1046
   (set_attr "cc" "clobber")])
1081
   (set_attr "cc" "clobber")])
1047
1082
1048
(define_expand "udivmodhi4"
1083
(define_insn_and_split "udivmodhi4"
1049
  [(set (reg:HI 24) (match_operand:HI 1 "register_operand" ""))
1084
  [(parallel [(set (match_operand:HI 0 "pseudo_register_operand" "") 
1050
   (set (reg:HI 22) (match_operand:HI 2 "register_operand" ""))
1085
                   (udiv:HI (match_operand:HI 1 "pseudo_register_operand" "")
1086
                            (match_operand:HI 2 "pseudo_register_operand" "")))
1087
	      (set (match_operand:HI 3 "pseudo_register_operand" "") 
1088
                   (umod:HI (match_dup 1) (match_dup 2)))
1089
              (clobber (reg:QI 21))
1090
              (clobber (reg:HI 22))
1091
              (clobber (reg:HI 24))
1092
              (clobber (reg:HI 26))])]
1093
  ""
1094
  "this udivmodhi4 pattern should have been splitted.;"
1095
  ""
1096
  [(set (reg:HI 24) (match_dup 1))
1097
   (set (reg:HI 22) (match_dup 2))
1051
   (parallel [(set (reg:HI 22) (udiv:HI (reg:HI 24) (reg:HI 22)))
1098
   (parallel [(set (reg:HI 22) (udiv:HI (reg:HI 24) (reg:HI 22)))
1052
	      (set (reg:HI 24) (umod:HI (reg:HI 24) (reg:HI 22)))
1099
	      (set (reg:HI 24) (umod:HI (reg:HI 24) (reg:HI 22)))
1053
	      (clobber (reg:HI 26))
1100
	      (clobber (reg:HI 26))
1054
	      (clobber (reg:QI 21))])
1101
	      (clobber (reg:QI 21))])
1055
   (set (match_operand:HI 0 "register_operand" "") (reg:HI 22))
1102
   (set (match_dup 0) (reg:HI 22))
1056
   (set (match_operand:HI 3 "register_operand" "") (reg:HI 24))]
1103
   (set (match_dup 3) (reg:HI 24))]
1057
  ""
1058
  "")
1104
  "")
1059
1105
1060
(define_insn "*udivmodhi4_call"
1106
(define_insn "*udivmodhi4_call"
Lines 1067-1082 Link Here
1067
  [(set_attr "type" "xcall")
1113
  [(set_attr "type" "xcall")
1068
   (set_attr "cc" "clobber")])
1114
   (set_attr "cc" "clobber")])
1069
1115
1070
(define_expand "divmodsi4"
1116
(define_insn_and_split "divmodsi4"
1071
  [(set (reg:SI 22) (match_operand:SI 1 "register_operand" ""))
1117
  [(parallel [(set (match_operand:SI 0 "pseudo_register_operand" "") 
1072
   (set (reg:SI 18) (match_operand:SI 2 "register_operand" ""))
1118
                   (div:SI (match_operand:SI 1 "pseudo_register_operand" "") 
1119
                           (match_operand:SI 2 "pseudo_register_operand" "")))
1120
              (set (match_operand:SI 3 "pseudo_register_operand" "") 
1121
                   (mod:SI (match_dup 1) (match_dup 2)))
1122
              (clobber (reg:SI 18))
1123
              (clobber (reg:SI 22))
1124
              (clobber (reg:HI 26))
1125
              (clobber (reg:HI 30))])]
1126
  ""
1127
  "this divmodsi4 pattern should have been splitted;" 
1128
  ""
1129
  [(set (reg:SI 22) (match_dup 1))
1130
   (set (reg:SI 18) (match_dup 2))
1073
   (parallel [(set (reg:SI 18) (div:SI (reg:SI 22) (reg:SI 18)))
1131
   (parallel [(set (reg:SI 18) (div:SI (reg:SI 22) (reg:SI 18)))
1074
	      (set (reg:SI 22) (mod:SI (reg:SI 22) (reg:SI 18)))
1132
	      (set (reg:SI 22) (mod:SI (reg:SI 22) (reg:SI 18)))
1075
	      (clobber (reg:HI 26))
1133
	      (clobber (reg:HI 26))
1076
	      (clobber (reg:HI 30))])
1134
	      (clobber (reg:HI 30))])
1077
   (set (match_operand:SI 0 "register_operand" "") (reg:SI 18))
1135
   (set (match_dup 0) (reg:SI 18))
1078
   (set (match_operand:SI 3 "register_operand" "") (reg:SI 22))]
1136
   (set (match_dup 3) (reg:SI 22))]
1079
  ""
1080
  "")
1137
  "")
1081
1138
1082
(define_insn "*divmodsi4_call"
1139
(define_insn "*divmodsi4_call"
Lines 1089-1104 Link Here
1089
  [(set_attr "type" "xcall")
1146
  [(set_attr "type" "xcall")
1090
   (set_attr "cc" "clobber")])
1147
   (set_attr "cc" "clobber")])
1091
1148
1092
(define_expand "udivmodsi4"
1149
(define_insn_and_split "udivmodsi4"
1093
  [(set (reg:SI 22) (match_operand:SI 1 "register_operand" ""))
1150
  [(parallel [(set (match_operand:SI 0 "pseudo_register_operand" "") 
1094
   (set (reg:SI 18) (match_operand:SI 2 "register_operand" ""))
1151
                   (udiv:SI (match_operand:SI 1 "pseudo_register_operand" "") 
1152
                           (match_operand:SI 2 "pseudo_register_operand" "")))
1153
              (set (match_operand:SI 3 "pseudo_register_operand" "") 
1154
                   (umod:SI (match_dup 1) (match_dup 2)))
1155
              (clobber (reg:SI 18))
1156
              (clobber (reg:SI 22))
1157
              (clobber (reg:HI 26))
1158
              (clobber (reg:HI 30))])]
1159
  ""
1160
  "this udivmodsi4 pattern should have been splitted;"
1161
  ""
1162
  [(set (reg:SI 22) (match_dup 1))
1163
   (set (reg:SI 18) (match_dup 2))
1095
   (parallel [(set (reg:SI 18) (udiv:SI (reg:SI 22) (reg:SI 18)))
1164
   (parallel [(set (reg:SI 18) (udiv:SI (reg:SI 22) (reg:SI 18)))
1096
	      (set (reg:SI 22) (umod:SI (reg:SI 22) (reg:SI 18)))
1165
	      (set (reg:SI 22) (umod:SI (reg:SI 22) (reg:SI 18)))
1097
	      (clobber (reg:HI 26))
1166
	      (clobber (reg:HI 26))
1098
	      (clobber (reg:HI 30))])
1167
	      (clobber (reg:HI 30))])
1099
   (set (match_operand:SI 0 "register_operand" "") (reg:SI 18))
1168
   (set (match_dup 0) (reg:SI 18))
1100
   (set (match_operand:SI 3 "register_operand" "") (reg:SI 22))]
1169
   (set (match_dup 3) (reg:SI 22))]
1101
  ""
1102
  "")
1170
  "")
1103
1171
1104
(define_insn "*udivmodsi4_call"
1172
(define_insn "*udivmodsi4_call"

Return to bug 23726