| @@ -2138,1999 +2138,1999 @@ | | | @@ -2138,1999 +2138,1999 @@ |
2138 | && !reg_overlap_mentioned_p (operands[0], operands[4])" | | 2138 | && !reg_overlap_mentioned_p (operands[0], operands[4])" |
2139 | [(parallel [(set (reg:CC_NOOV CC_REGNUM) | | 2139 | [(parallel [(set (reg:CC_NOOV CC_REGNUM) |
2140 | (compare:CC_NOOV (and:SI (match_dup 1) (match_dup 2)) | | 2140 | (compare:CC_NOOV (and:SI (match_dup 1) (match_dup 2)) |
2141 | (const_int 0))) | | 2141 | (const_int 0))) |
2142 | (set (match_dup 0) (and:SI (match_dup 1) (match_dup 2)))]) | | 2142 | (set (match_dup 0) (and:SI (match_dup 1) (match_dup 2)))]) |
2143 | (set (match_dup 0) | | 2143 | (set (match_dup 0) |
2144 | (if_then_else:SI (eq (reg:CC_NOOV CC_REGNUM) (const_int 0)) | | 2144 | (if_then_else:SI (eq (reg:CC_NOOV CC_REGNUM) (const_int 0)) |
2145 | (match_dup 0) (match_dup 4)))] | | 2145 | (match_dup 0) (match_dup 4)))] |
2146 | " | | 2146 | " |
2147 | operands[2] = GEN_INT (((1 << INTVAL (operands[2])) - 1) | | 2147 | operands[2] = GEN_INT (((1 << INTVAL (operands[2])) - 1) |
2148 | << INTVAL (operands[3])); | | 2148 | << INTVAL (operands[3])); |
2149 | " | | 2149 | " |
2150 | [(set_attr "conds" "clob") | | 2150 | [(set_attr "conds" "clob") |
2151 | (set_attr "length" "8")] | | 2151 | (set_attr "length" "8")] |
2152 | ) | | 2152 | ) |
2153 | | | 2153 | |
2154 | (define_insn_and_split "*ite_ne_zeroextractsi_shifted" | | 2154 | (define_insn_and_split "*ite_ne_zeroextractsi_shifted" |
2155 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 2155 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
2156 | (if_then_else:SI (ne (zero_extract:SI | | 2156 | (if_then_else:SI (ne (zero_extract:SI |
2157 | (match_operand:SI 1 "s_register_operand" "r") | | 2157 | (match_operand:SI 1 "s_register_operand" "r") |
2158 | (match_operand:SI 2 "const_int_operand" "n") | | 2158 | (match_operand:SI 2 "const_int_operand" "n") |
2159 | (const_int 0)) | | 2159 | (const_int 0)) |
2160 | (const_int 0)) | | 2160 | (const_int 0)) |
2161 | (match_operand:SI 3 "arm_not_operand" "rIK") | | 2161 | (match_operand:SI 3 "arm_not_operand" "rIK") |
2162 | (const_int 0))) | | 2162 | (const_int 0))) |
2163 | (clobber (reg:CC CC_REGNUM))] | | 2163 | (clobber (reg:CC CC_REGNUM))] |
2164 | "TARGET_ARM && !reg_overlap_mentioned_p (operands[0], operands[3])" | | 2164 | "TARGET_ARM && !reg_overlap_mentioned_p (operands[0], operands[3])" |
2165 | "#" | | 2165 | "#" |
2166 | "TARGET_ARM && !reg_overlap_mentioned_p (operands[0], operands[3])" | | 2166 | "TARGET_ARM && !reg_overlap_mentioned_p (operands[0], operands[3])" |
2167 | [(parallel [(set (reg:CC_NOOV CC_REGNUM) | | 2167 | [(parallel [(set (reg:CC_NOOV CC_REGNUM) |
2168 | (compare:CC_NOOV (ashift:SI (match_dup 1) (match_dup 2)) | | 2168 | (compare:CC_NOOV (ashift:SI (match_dup 1) (match_dup 2)) |
2169 | (const_int 0))) | | 2169 | (const_int 0))) |
2170 | (set (match_dup 0) (ashift:SI (match_dup 1) (match_dup 2)))]) | | 2170 | (set (match_dup 0) (ashift:SI (match_dup 1) (match_dup 2)))]) |
2171 | (set (match_dup 0) | | 2171 | (set (match_dup 0) |
2172 | (if_then_else:SI (eq (reg:CC_NOOV CC_REGNUM) (const_int 0)) | | 2172 | (if_then_else:SI (eq (reg:CC_NOOV CC_REGNUM) (const_int 0)) |
2173 | (match_dup 0) (match_dup 3)))] | | 2173 | (match_dup 0) (match_dup 3)))] |
2174 | " | | 2174 | " |
2175 | operands[2] = GEN_INT (32 - INTVAL (operands[2])); | | 2175 | operands[2] = GEN_INT (32 - INTVAL (operands[2])); |
2176 | " | | 2176 | " |
2177 | [(set_attr "conds" "clob") | | 2177 | [(set_attr "conds" "clob") |
2178 | (set_attr "length" "8")] | | 2178 | (set_attr "length" "8")] |
2179 | ) | | 2179 | ) |
2180 | | | 2180 | |
2181 | (define_split | | 2181 | (define_split |
2182 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2182 | [(set (match_operand:SI 0 "s_register_operand" "") |
2183 | (zero_extract:SI (match_operand:SI 1 "s_register_operand" "") | | 2183 | (zero_extract:SI (match_operand:SI 1 "s_register_operand" "") |
2184 | (match_operand:SI 2 "const_int_operand" "") | | 2184 | (match_operand:SI 2 "const_int_operand" "") |
2185 | (match_operand:SI 3 "const_int_operand" ""))) | | 2185 | (match_operand:SI 3 "const_int_operand" ""))) |
2186 | (clobber (match_operand:SI 4 "s_register_operand" ""))] | | 2186 | (clobber (match_operand:SI 4 "s_register_operand" ""))] |
2187 | "TARGET_THUMB1" | | 2187 | "TARGET_THUMB1" |
2188 | [(set (match_dup 4) (ashift:SI (match_dup 1) (match_dup 2))) | | 2188 | [(set (match_dup 4) (ashift:SI (match_dup 1) (match_dup 2))) |
2189 | (set (match_dup 0) (lshiftrt:SI (match_dup 4) (match_dup 3)))] | | 2189 | (set (match_dup 0) (lshiftrt:SI (match_dup 4) (match_dup 3)))] |
2190 | "{ | | 2190 | "{ |
2191 | HOST_WIDE_INT temp = INTVAL (operands[2]); | | 2191 | HOST_WIDE_INT temp = INTVAL (operands[2]); |
2192 | | | 2192 | |
2193 | operands[2] = GEN_INT (32 - temp - INTVAL (operands[3])); | | 2193 | operands[2] = GEN_INT (32 - temp - INTVAL (operands[3])); |
2194 | operands[3] = GEN_INT (32 - temp); | | 2194 | operands[3] = GEN_INT (32 - temp); |
2195 | }" | | 2195 | }" |
2196 | ) | | 2196 | ) |
2197 | | | 2197 | |
2198 | ;; ??? Use Thumb-2 has bitfield insert/extract instructions. | | 2198 | ;; ??? Use Thumb-2 has bitfield insert/extract instructions. |
2199 | (define_split | | 2199 | (define_split |
2200 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2200 | [(set (match_operand:SI 0 "s_register_operand" "") |
2201 | (match_operator:SI 1 "shiftable_operator" | | 2201 | (match_operator:SI 1 "shiftable_operator" |
2202 | [(zero_extract:SI (match_operand:SI 2 "s_register_operand" "") | | 2202 | [(zero_extract:SI (match_operand:SI 2 "s_register_operand" "") |
2203 | (match_operand:SI 3 "const_int_operand" "") | | 2203 | (match_operand:SI 3 "const_int_operand" "") |
2204 | (match_operand:SI 4 "const_int_operand" "")) | | 2204 | (match_operand:SI 4 "const_int_operand" "")) |
2205 | (match_operand:SI 5 "s_register_operand" "")])) | | 2205 | (match_operand:SI 5 "s_register_operand" "")])) |
2206 | (clobber (match_operand:SI 6 "s_register_operand" ""))] | | 2206 | (clobber (match_operand:SI 6 "s_register_operand" ""))] |
2207 | "TARGET_ARM" | | 2207 | "TARGET_ARM" |
2208 | [(set (match_dup 6) (ashift:SI (match_dup 2) (match_dup 3))) | | 2208 | [(set (match_dup 6) (ashift:SI (match_dup 2) (match_dup 3))) |
2209 | (set (match_dup 0) | | 2209 | (set (match_dup 0) |
2210 | (match_op_dup 1 | | 2210 | (match_op_dup 1 |
2211 | [(lshiftrt:SI (match_dup 6) (match_dup 4)) | | 2211 | [(lshiftrt:SI (match_dup 6) (match_dup 4)) |
2212 | (match_dup 5)]))] | | 2212 | (match_dup 5)]))] |
2213 | "{ | | 2213 | "{ |
2214 | HOST_WIDE_INT temp = INTVAL (operands[3]); | | 2214 | HOST_WIDE_INT temp = INTVAL (operands[3]); |
2215 | | | 2215 | |
2216 | operands[3] = GEN_INT (32 - temp - INTVAL (operands[4])); | | 2216 | operands[3] = GEN_INT (32 - temp - INTVAL (operands[4])); |
2217 | operands[4] = GEN_INT (32 - temp); | | 2217 | operands[4] = GEN_INT (32 - temp); |
2218 | }" | | 2218 | }" |
2219 | ) | | 2219 | ) |
2220 | | | 2220 | |
2221 | (define_split | | 2221 | (define_split |
2222 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2222 | [(set (match_operand:SI 0 "s_register_operand" "") |
2223 | (sign_extract:SI (match_operand:SI 1 "s_register_operand" "") | | 2223 | (sign_extract:SI (match_operand:SI 1 "s_register_operand" "") |
2224 | (match_operand:SI 2 "const_int_operand" "") | | 2224 | (match_operand:SI 2 "const_int_operand" "") |
2225 | (match_operand:SI 3 "const_int_operand" "")))] | | 2225 | (match_operand:SI 3 "const_int_operand" "")))] |
2226 | "TARGET_THUMB1" | | 2226 | "TARGET_THUMB1" |
2227 | [(set (match_dup 0) (ashift:SI (match_dup 1) (match_dup 2))) | | 2227 | [(set (match_dup 0) (ashift:SI (match_dup 1) (match_dup 2))) |
2228 | (set (match_dup 0) (ashiftrt:SI (match_dup 0) (match_dup 3)))] | | 2228 | (set (match_dup 0) (ashiftrt:SI (match_dup 0) (match_dup 3)))] |
2229 | "{ | | 2229 | "{ |
2230 | HOST_WIDE_INT temp = INTVAL (operands[2]); | | 2230 | HOST_WIDE_INT temp = INTVAL (operands[2]); |
2231 | | | 2231 | |
2232 | operands[2] = GEN_INT (32 - temp - INTVAL (operands[3])); | | 2232 | operands[2] = GEN_INT (32 - temp - INTVAL (operands[3])); |
2233 | operands[3] = GEN_INT (32 - temp); | | 2233 | operands[3] = GEN_INT (32 - temp); |
2234 | }" | | 2234 | }" |
2235 | ) | | 2235 | ) |
2236 | | | 2236 | |
2237 | (define_split | | 2237 | (define_split |
2238 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2238 | [(set (match_operand:SI 0 "s_register_operand" "") |
2239 | (match_operator:SI 1 "shiftable_operator" | | 2239 | (match_operator:SI 1 "shiftable_operator" |
2240 | [(sign_extract:SI (match_operand:SI 2 "s_register_operand" "") | | 2240 | [(sign_extract:SI (match_operand:SI 2 "s_register_operand" "") |
2241 | (match_operand:SI 3 "const_int_operand" "") | | 2241 | (match_operand:SI 3 "const_int_operand" "") |
2242 | (match_operand:SI 4 "const_int_operand" "")) | | 2242 | (match_operand:SI 4 "const_int_operand" "")) |
2243 | (match_operand:SI 5 "s_register_operand" "")])) | | 2243 | (match_operand:SI 5 "s_register_operand" "")])) |
2244 | (clobber (match_operand:SI 6 "s_register_operand" ""))] | | 2244 | (clobber (match_operand:SI 6 "s_register_operand" ""))] |
2245 | "TARGET_ARM" | | 2245 | "TARGET_ARM" |
2246 | [(set (match_dup 6) (ashift:SI (match_dup 2) (match_dup 3))) | | 2246 | [(set (match_dup 6) (ashift:SI (match_dup 2) (match_dup 3))) |
2247 | (set (match_dup 0) | | 2247 | (set (match_dup 0) |
2248 | (match_op_dup 1 | | 2248 | (match_op_dup 1 |
2249 | [(ashiftrt:SI (match_dup 6) (match_dup 4)) | | 2249 | [(ashiftrt:SI (match_dup 6) (match_dup 4)) |
2250 | (match_dup 5)]))] | | 2250 | (match_dup 5)]))] |
2251 | "{ | | 2251 | "{ |
2252 | HOST_WIDE_INT temp = INTVAL (operands[3]); | | 2252 | HOST_WIDE_INT temp = INTVAL (operands[3]); |
2253 | | | 2253 | |
2254 | operands[3] = GEN_INT (32 - temp - INTVAL (operands[4])); | | 2254 | operands[3] = GEN_INT (32 - temp - INTVAL (operands[4])); |
2255 | operands[4] = GEN_INT (32 - temp); | | 2255 | operands[4] = GEN_INT (32 - temp); |
2256 | }" | | 2256 | }" |
2257 | ) | | 2257 | ) |
2258 | | | 2258 | |
2259 | ;;; ??? This pattern is bogus. If operand3 has bits outside the range | | 2259 | ;;; ??? This pattern is bogus. If operand3 has bits outside the range |
2260 | ;;; represented by the bitfield, then this will produce incorrect results. | | 2260 | ;;; represented by the bitfield, then this will produce incorrect results. |
2261 | ;;; Somewhere, the value needs to be truncated. On targets like the m68k, | | 2261 | ;;; Somewhere, the value needs to be truncated. On targets like the m68k, |
2262 | ;;; which have a real bit-field insert instruction, the truncation happens | | 2262 | ;;; which have a real bit-field insert instruction, the truncation happens |
2263 | ;;; in the bit-field insert instruction itself. Since arm does not have a | | 2263 | ;;; in the bit-field insert instruction itself. Since arm does not have a |
2264 | ;;; bit-field insert instruction, we would have to emit code here to truncate | | 2264 | ;;; bit-field insert instruction, we would have to emit code here to truncate |
2265 | ;;; the value before we insert. This loses some of the advantage of having | | 2265 | ;;; the value before we insert. This loses some of the advantage of having |
2266 | ;;; this insv pattern, so this pattern needs to be reevalutated. | | 2266 | ;;; this insv pattern, so this pattern needs to be reevalutated. |
2267 | | | 2267 | |
2268 | (define_expand "insv" | | 2268 | (define_expand "insv" |
2269 | [(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "") | | 2269 | [(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "") |
2270 | (match_operand:SI 1 "general_operand" "") | | 2270 | (match_operand:SI 1 "general_operand" "") |
2271 | (match_operand:SI 2 "general_operand" "")) | | 2271 | (match_operand:SI 2 "general_operand" "")) |
2272 | (match_operand:SI 3 "reg_or_int_operand" ""))] | | 2272 | (match_operand:SI 3 "reg_or_int_operand" ""))] |
2273 | "TARGET_ARM || arm_arch_thumb2" | | 2273 | "TARGET_ARM || arm_arch_thumb2" |
2274 | " | | 2274 | " |
2275 | { | | 2275 | { |
2276 | int start_bit = INTVAL (operands[2]); | | 2276 | int start_bit = INTVAL (operands[2]); |
2277 | int width = INTVAL (operands[1]); | | 2277 | int width = INTVAL (operands[1]); |
2278 | HOST_WIDE_INT mask = (((HOST_WIDE_INT)1) << width) - 1; | | 2278 | HOST_WIDE_INT mask = (((HOST_WIDE_INT)1) << width) - 1; |
2279 | rtx target, subtarget; | | 2279 | rtx target, subtarget; |
2280 | | | 2280 | |
2281 | if (arm_arch_thumb2) | | 2281 | if (arm_arch_thumb2) |
2282 | { | | 2282 | { |
2283 | bool use_bfi = TRUE; | | 2283 | bool use_bfi = TRUE; |
2284 | | | 2284 | |
2285 | if (GET_CODE (operands[3]) == CONST_INT) | | 2285 | if (GET_CODE (operands[3]) == CONST_INT) |
2286 | { | | 2286 | { |
2287 | HOST_WIDE_INT val = INTVAL (operands[3]) & mask; | | 2287 | HOST_WIDE_INT val = INTVAL (operands[3]) & mask; |
2288 | | | 2288 | |
2289 | if (val == 0) | | 2289 | if (val == 0) |
2290 | { | | 2290 | { |
2291 | emit_insn (gen_insv_zero (operands[0], operands[1], | | 2291 | emit_insn (gen_insv_zero (operands[0], operands[1], |
2292 | operands[2])); | | 2292 | operands[2])); |
2293 | DONE; | | 2293 | DONE; |
2294 | } | | 2294 | } |
2295 | | | 2295 | |
2296 | /* See if the set can be done with a single orr instruction. */ | | 2296 | /* See if the set can be done with a single orr instruction. */ |
2297 | if (val == mask && const_ok_for_arm (val << start_bit)) | | 2297 | if (val == mask && const_ok_for_arm (val << start_bit)) |
2298 | use_bfi = FALSE; | | 2298 | use_bfi = FALSE; |
2299 | } | | 2299 | } |
2300 | | | 2300 | |
2301 | if (use_bfi) | | 2301 | if (use_bfi) |
2302 | { | | 2302 | { |
2303 | if (GET_CODE (operands[3]) != REG) | | 2303 | if (GET_CODE (operands[3]) != REG) |
2304 | operands[3] = force_reg (SImode, operands[3]); | | 2304 | operands[3] = force_reg (SImode, operands[3]); |
2305 | | | 2305 | |
2306 | emit_insn (gen_insv_t2 (operands[0], operands[1], operands[2], | | 2306 | emit_insn (gen_insv_t2 (operands[0], operands[1], operands[2], |
2307 | operands[3])); | | 2307 | operands[3])); |
2308 | DONE; | | 2308 | DONE; |
2309 | } | | 2309 | } |
2310 | } | | 2310 | } |
2311 | | | 2311 | |
2312 | target = copy_rtx (operands[0]); | | 2312 | target = copy_rtx (operands[0]); |
2313 | /* Avoid using a subreg as a subtarget, and avoid writing a paradoxical | | 2313 | /* Avoid using a subreg as a subtarget, and avoid writing a paradoxical |
2314 | subreg as the final target. */ | | 2314 | subreg as the final target. */ |
2315 | if (GET_CODE (target) == SUBREG) | | 2315 | if (GET_CODE (target) == SUBREG) |
2316 | { | | 2316 | { |
2317 | subtarget = gen_reg_rtx (SImode); | | 2317 | subtarget = gen_reg_rtx (SImode); |
2318 | if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (target))) | | 2318 | if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (target))) |
2319 | < GET_MODE_SIZE (SImode)) | | 2319 | < GET_MODE_SIZE (SImode)) |
2320 | target = SUBREG_REG (target); | | 2320 | target = SUBREG_REG (target); |
2321 | } | | 2321 | } |
2322 | else | | 2322 | else |
2323 | subtarget = target; | | 2323 | subtarget = target; |
2324 | | | 2324 | |
2325 | if (GET_CODE (operands[3]) == CONST_INT) | | 2325 | if (GET_CODE (operands[3]) == CONST_INT) |
2326 | { | | 2326 | { |
2327 | /* Since we are inserting a known constant, we may be able to | | 2327 | /* Since we are inserting a known constant, we may be able to |
2328 | reduce the number of bits that we have to clear so that | | 2328 | reduce the number of bits that we have to clear so that |
2329 | the mask becomes simple. */ | | 2329 | the mask becomes simple. */ |
2330 | /* ??? This code does not check to see if the new mask is actually | | 2330 | /* ??? This code does not check to see if the new mask is actually |
2331 | simpler. It may not be. */ | | 2331 | simpler. It may not be. */ |
2332 | rtx op1 = gen_reg_rtx (SImode); | | 2332 | rtx op1 = gen_reg_rtx (SImode); |
2333 | /* ??? Truncate operand3 to fit in the bitfield. See comment before | | 2333 | /* ??? Truncate operand3 to fit in the bitfield. See comment before |
2334 | start of this pattern. */ | | 2334 | start of this pattern. */ |
2335 | HOST_WIDE_INT op3_value = mask & INTVAL (operands[3]); | | 2335 | HOST_WIDE_INT op3_value = mask & INTVAL (operands[3]); |
2336 | HOST_WIDE_INT mask2 = ((mask & ~op3_value) << start_bit); | | 2336 | HOST_WIDE_INT mask2 = ((mask & ~op3_value) << start_bit); |
2337 | | | 2337 | |
2338 | emit_insn (gen_andsi3 (op1, operands[0], | | 2338 | emit_insn (gen_andsi3 (op1, operands[0], |
2339 | gen_int_mode (~mask2, SImode))); | | 2339 | gen_int_mode (~mask2, SImode))); |
2340 | emit_insn (gen_iorsi3 (subtarget, op1, | | 2340 | emit_insn (gen_iorsi3 (subtarget, op1, |
2341 | gen_int_mode (op3_value << start_bit, SImode))); | | 2341 | gen_int_mode (op3_value << start_bit, SImode))); |
2342 | } | | 2342 | } |
2343 | else if (start_bit == 0 | | 2343 | else if (start_bit == 0 |
2344 | && !(const_ok_for_arm (mask) | | 2344 | && !(const_ok_for_arm (mask) |
2345 | || const_ok_for_arm (~mask))) | | 2345 | || const_ok_for_arm (~mask))) |
2346 | { | | 2346 | { |
2347 | /* A Trick, since we are setting the bottom bits in the word, | | 2347 | /* A Trick, since we are setting the bottom bits in the word, |
2348 | we can shift operand[3] up, operand[0] down, OR them together | | 2348 | we can shift operand[3] up, operand[0] down, OR them together |
2349 | and rotate the result back again. This takes 3 insns, and | | 2349 | and rotate the result back again. This takes 3 insns, and |
2350 | the third might be mergeable into another op. */ | | 2350 | the third might be mergeable into another op. */ |
2351 | /* The shift up copes with the possibility that operand[3] is | | 2351 | /* The shift up copes with the possibility that operand[3] is |
2352 | wider than the bitfield. */ | | 2352 | wider than the bitfield. */ |
2353 | rtx op0 = gen_reg_rtx (SImode); | | 2353 | rtx op0 = gen_reg_rtx (SImode); |
2354 | rtx op1 = gen_reg_rtx (SImode); | | 2354 | rtx op1 = gen_reg_rtx (SImode); |
2355 | | | 2355 | |
2356 | emit_insn (gen_ashlsi3 (op0, operands[3], GEN_INT (32 - width))); | | 2356 | emit_insn (gen_ashlsi3 (op0, operands[3], GEN_INT (32 - width))); |
2357 | emit_insn (gen_lshrsi3 (op1, operands[0], operands[1])); | | 2357 | emit_insn (gen_lshrsi3 (op1, operands[0], operands[1])); |
2358 | emit_insn (gen_iorsi3 (op1, op1, op0)); | | 2358 | emit_insn (gen_iorsi3 (op1, op1, op0)); |
2359 | emit_insn (gen_rotlsi3 (subtarget, op1, operands[1])); | | 2359 | emit_insn (gen_rotlsi3 (subtarget, op1, operands[1])); |
2360 | } | | 2360 | } |
2361 | else if ((width + start_bit == 32) | | 2361 | else if ((width + start_bit == 32) |
2362 | && !(const_ok_for_arm (mask) | | 2362 | && !(const_ok_for_arm (mask) |
2363 | || const_ok_for_arm (~mask))) | | 2363 | || const_ok_for_arm (~mask))) |
2364 | { | | 2364 | { |
2365 | /* Similar trick, but slightly less efficient. */ | | 2365 | /* Similar trick, but slightly less efficient. */ |
2366 | | | 2366 | |
2367 | rtx op0 = gen_reg_rtx (SImode); | | 2367 | rtx op0 = gen_reg_rtx (SImode); |
2368 | rtx op1 = gen_reg_rtx (SImode); | | 2368 | rtx op1 = gen_reg_rtx (SImode); |
2369 | | | 2369 | |
2370 | emit_insn (gen_ashlsi3 (op0, operands[3], GEN_INT (32 - width))); | | 2370 | emit_insn (gen_ashlsi3 (op0, operands[3], GEN_INT (32 - width))); |
2371 | emit_insn (gen_ashlsi3 (op1, operands[0], operands[1])); | | 2371 | emit_insn (gen_ashlsi3 (op1, operands[0], operands[1])); |
2372 | emit_insn (gen_lshrsi3 (op1, op1, operands[1])); | | 2372 | emit_insn (gen_lshrsi3 (op1, op1, operands[1])); |
2373 | emit_insn (gen_iorsi3 (subtarget, op1, op0)); | | 2373 | emit_insn (gen_iorsi3 (subtarget, op1, op0)); |
2374 | } | | 2374 | } |
2375 | else | | 2375 | else |
2376 | { | | 2376 | { |
2377 | rtx op0 = gen_int_mode (mask, SImode); | | 2377 | rtx op0 = gen_int_mode (mask, SImode); |
2378 | rtx op1 = gen_reg_rtx (SImode); | | 2378 | rtx op1 = gen_reg_rtx (SImode); |
2379 | rtx op2 = gen_reg_rtx (SImode); | | 2379 | rtx op2 = gen_reg_rtx (SImode); |
2380 | | | 2380 | |
2381 | if (!(const_ok_for_arm (mask) || const_ok_for_arm (~mask))) | | 2381 | if (!(const_ok_for_arm (mask) || const_ok_for_arm (~mask))) |
2382 | { | | 2382 | { |
2383 | rtx tmp = gen_reg_rtx (SImode); | | 2383 | rtx tmp = gen_reg_rtx (SImode); |
2384 | | | 2384 | |
2385 | emit_insn (gen_movsi (tmp, op0)); | | 2385 | emit_insn (gen_movsi (tmp, op0)); |
2386 | op0 = tmp; | | 2386 | op0 = tmp; |
2387 | } | | 2387 | } |
2388 | | | 2388 | |
2389 | /* Mask out any bits in operand[3] that are not needed. */ | | 2389 | /* Mask out any bits in operand[3] that are not needed. */ |
2390 | emit_insn (gen_andsi3 (op1, operands[3], op0)); | | 2390 | emit_insn (gen_andsi3 (op1, operands[3], op0)); |
2391 | | | 2391 | |
2392 | if (GET_CODE (op0) == CONST_INT | | 2392 | if (GET_CODE (op0) == CONST_INT |
2393 | && (const_ok_for_arm (mask << start_bit) | | 2393 | && (const_ok_for_arm (mask << start_bit) |
2394 | || const_ok_for_arm (~(mask << start_bit)))) | | 2394 | || const_ok_for_arm (~(mask << start_bit)))) |
2395 | { | | 2395 | { |
2396 | op0 = gen_int_mode (~(mask << start_bit), SImode); | | 2396 | op0 = gen_int_mode (~(mask << start_bit), SImode); |
2397 | emit_insn (gen_andsi3 (op2, operands[0], op0)); | | 2397 | emit_insn (gen_andsi3 (op2, operands[0], op0)); |
2398 | } | | 2398 | } |
2399 | else | | 2399 | else |
2400 | { | | 2400 | { |
2401 | if (GET_CODE (op0) == CONST_INT) | | 2401 | if (GET_CODE (op0) == CONST_INT) |
2402 | { | | 2402 | { |
2403 | rtx tmp = gen_reg_rtx (SImode); | | 2403 | rtx tmp = gen_reg_rtx (SImode); |
2404 | | | 2404 | |
2405 | emit_insn (gen_movsi (tmp, op0)); | | 2405 | emit_insn (gen_movsi (tmp, op0)); |
2406 | op0 = tmp; | | 2406 | op0 = tmp; |
2407 | } | | 2407 | } |
2408 | | | 2408 | |
2409 | if (start_bit != 0) | | 2409 | if (start_bit != 0) |
2410 | emit_insn (gen_ashlsi3 (op0, op0, operands[2])); | | 2410 | emit_insn (gen_ashlsi3 (op0, op0, operands[2])); |
2411 | | | 2411 | |
2412 | emit_insn (gen_andsi_notsi_si (op2, operands[0], op0)); | | 2412 | emit_insn (gen_andsi_notsi_si (op2, operands[0], op0)); |
2413 | } | | 2413 | } |
2414 | | | 2414 | |
2415 | if (start_bit != 0) | | 2415 | if (start_bit != 0) |
2416 | emit_insn (gen_ashlsi3 (op1, op1, operands[2])); | | 2416 | emit_insn (gen_ashlsi3 (op1, op1, operands[2])); |
2417 | | | 2417 | |
2418 | emit_insn (gen_iorsi3 (subtarget, op1, op2)); | | 2418 | emit_insn (gen_iorsi3 (subtarget, op1, op2)); |
2419 | } | | 2419 | } |
2420 | | | 2420 | |
2421 | if (subtarget != target) | | 2421 | if (subtarget != target) |
2422 | { | | 2422 | { |
2423 | /* If TARGET is still a SUBREG, then it must be wider than a word, | | 2423 | /* If TARGET is still a SUBREG, then it must be wider than a word, |
2424 | so we must be careful only to set the subword we were asked to. */ | | 2424 | so we must be careful only to set the subword we were asked to. */ |
2425 | if (GET_CODE (target) == SUBREG) | | 2425 | if (GET_CODE (target) == SUBREG) |
2426 | emit_move_insn (target, subtarget); | | 2426 | emit_move_insn (target, subtarget); |
2427 | else | | 2427 | else |
2428 | emit_move_insn (target, gen_lowpart (GET_MODE (target), subtarget)); | | 2428 | emit_move_insn (target, gen_lowpart (GET_MODE (target), subtarget)); |
2429 | } | | 2429 | } |
2430 | | | 2430 | |
2431 | DONE; | | 2431 | DONE; |
2432 | }" | | 2432 | }" |
2433 | ) | | 2433 | ) |
2434 | | | 2434 | |
2435 | (define_insn "insv_zero" | | 2435 | (define_insn "insv_zero" |
2436 | [(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "+r") | | 2436 | [(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "+r") |
2437 | (match_operand:SI 1 "const_int_operand" "M") | | 2437 | (match_operand:SI 1 "const_int_operand" "M") |
2438 | (match_operand:SI 2 "const_int_operand" "M")) | | 2438 | (match_operand:SI 2 "const_int_operand" "M")) |
2439 | (const_int 0))] | | 2439 | (const_int 0))] |
2440 | "arm_arch_thumb2" | | 2440 | "arm_arch_thumb2" |
2441 | "bfc%?\t%0, %2, %1" | | 2441 | "bfc%?\t%0, %2, %1" |
2442 | [(set_attr "length" "4") | | 2442 | [(set_attr "length" "4") |
2443 | (set_attr "predicable" "yes")] | | 2443 | (set_attr "predicable" "yes")] |
2444 | ) | | 2444 | ) |
2445 | | | 2445 | |
2446 | (define_insn "insv_t2" | | 2446 | (define_insn "insv_t2" |
2447 | [(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "+r") | | 2447 | [(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "+r") |
2448 | (match_operand:SI 1 "const_int_operand" "M") | | 2448 | (match_operand:SI 1 "const_int_operand" "M") |
2449 | (match_operand:SI 2 "const_int_operand" "M")) | | 2449 | (match_operand:SI 2 "const_int_operand" "M")) |
2450 | (match_operand:SI 3 "s_register_operand" "r"))] | | 2450 | (match_operand:SI 3 "s_register_operand" "r"))] |
2451 | "arm_arch_thumb2" | | 2451 | "arm_arch_thumb2" |
2452 | "bfi%?\t%0, %3, %2, %1" | | 2452 | "bfi%?\t%0, %3, %2, %1" |
2453 | [(set_attr "length" "4") | | 2453 | [(set_attr "length" "4") |
2454 | (set_attr "predicable" "yes")] | | 2454 | (set_attr "predicable" "yes")] |
2455 | ) | | 2455 | ) |
2456 | | | 2456 | |
2457 | ; constants for op 2 will never be given to these patterns. | | 2457 | ; constants for op 2 will never be given to these patterns. |
2458 | (define_insn_and_split "*anddi_notdi_di" | | 2458 | (define_insn_and_split "*anddi_notdi_di" |
2459 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") | | 2459 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") |
2460 | (and:DI (not:DI (match_operand:DI 1 "s_register_operand" "0,r")) | | 2460 | (and:DI (not:DI (match_operand:DI 1 "s_register_operand" "0,r")) |
2461 | (match_operand:DI 2 "s_register_operand" "r,0")))] | | 2461 | (match_operand:DI 2 "s_register_operand" "r,0")))] |
2462 | "TARGET_32BIT" | | 2462 | "TARGET_32BIT" |
2463 | "#" | | 2463 | "#" |
2464 | "TARGET_32BIT && reload_completed && ! IS_IWMMXT_REGNUM (REGNO (operands[0]))" | | 2464 | "TARGET_32BIT && reload_completed && ! IS_IWMMXT_REGNUM (REGNO (operands[0]))" |
2465 | [(set (match_dup 0) (and:SI (not:SI (match_dup 1)) (match_dup 2))) | | 2465 | [(set (match_dup 0) (and:SI (not:SI (match_dup 1)) (match_dup 2))) |
2466 | (set (match_dup 3) (and:SI (not:SI (match_dup 4)) (match_dup 5)))] | | 2466 | (set (match_dup 3) (and:SI (not:SI (match_dup 4)) (match_dup 5)))] |
2467 | " | | 2467 | " |
2468 | { | | 2468 | { |
2469 | operands[3] = gen_highpart (SImode, operands[0]); | | 2469 | operands[3] = gen_highpart (SImode, operands[0]); |
2470 | operands[0] = gen_lowpart (SImode, operands[0]); | | 2470 | operands[0] = gen_lowpart (SImode, operands[0]); |
2471 | operands[4] = gen_highpart (SImode, operands[1]); | | 2471 | operands[4] = gen_highpart (SImode, operands[1]); |
2472 | operands[1] = gen_lowpart (SImode, operands[1]); | | 2472 | operands[1] = gen_lowpart (SImode, operands[1]); |
2473 | operands[5] = gen_highpart (SImode, operands[2]); | | 2473 | operands[5] = gen_highpart (SImode, operands[2]); |
2474 | operands[2] = gen_lowpart (SImode, operands[2]); | | 2474 | operands[2] = gen_lowpart (SImode, operands[2]); |
2475 | }" | | 2475 | }" |
2476 | [(set_attr "length" "8") | | 2476 | [(set_attr "length" "8") |
2477 | (set_attr "predicable" "yes")] | | 2477 | (set_attr "predicable" "yes")] |
2478 | ) | | 2478 | ) |
2479 | | | 2479 | |
2480 | (define_insn_and_split "*anddi_notzesidi_di" | | 2480 | (define_insn_and_split "*anddi_notzesidi_di" |
2481 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") | | 2481 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") |
2482 | (and:DI (not:DI (zero_extend:DI | | 2482 | (and:DI (not:DI (zero_extend:DI |
2483 | (match_operand:SI 2 "s_register_operand" "r,r"))) | | 2483 | (match_operand:SI 2 "s_register_operand" "r,r"))) |
2484 | (match_operand:DI 1 "s_register_operand" "0,?r")))] | | 2484 | (match_operand:DI 1 "s_register_operand" "0,?r")))] |
2485 | "TARGET_32BIT" | | 2485 | "TARGET_32BIT" |
2486 | "@ | | 2486 | "@ |
2487 | bic%?\\t%Q0, %Q1, %2 | | 2487 | bic%?\\t%Q0, %Q1, %2 |
2488 | #" | | 2488 | #" |
2489 | ; (not (zero_extend ...)) allows us to just copy the high word from | | 2489 | ; (not (zero_extend ...)) allows us to just copy the high word from |
2490 | ; operand1 to operand0. | | 2490 | ; operand1 to operand0. |
2491 | "TARGET_32BIT | | 2491 | "TARGET_32BIT |
2492 | && reload_completed | | 2492 | && reload_completed |
2493 | && operands[0] != operands[1]" | | 2493 | && operands[0] != operands[1]" |
2494 | [(set (match_dup 0) (and:SI (not:SI (match_dup 2)) (match_dup 1))) | | 2494 | [(set (match_dup 0) (and:SI (not:SI (match_dup 2)) (match_dup 1))) |
2495 | (set (match_dup 3) (match_dup 4))] | | 2495 | (set (match_dup 3) (match_dup 4))] |
2496 | " | | 2496 | " |
2497 | { | | 2497 | { |
2498 | operands[3] = gen_highpart (SImode, operands[0]); | | 2498 | operands[3] = gen_highpart (SImode, operands[0]); |
2499 | operands[0] = gen_lowpart (SImode, operands[0]); | | 2499 | operands[0] = gen_lowpart (SImode, operands[0]); |
2500 | operands[4] = gen_highpart (SImode, operands[1]); | | 2500 | operands[4] = gen_highpart (SImode, operands[1]); |
2501 | operands[1] = gen_lowpart (SImode, operands[1]); | | 2501 | operands[1] = gen_lowpart (SImode, operands[1]); |
2502 | }" | | 2502 | }" |
2503 | [(set_attr "length" "4,8") | | 2503 | [(set_attr "length" "4,8") |
2504 | (set_attr "predicable" "yes")] | | 2504 | (set_attr "predicable" "yes")] |
2505 | ) | | 2505 | ) |
2506 | | | 2506 | |
2507 | (define_insn_and_split "*anddi_notsesidi_di" | | 2507 | (define_insn_and_split "*anddi_notsesidi_di" |
2508 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") | | 2508 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") |
2509 | (and:DI (not:DI (sign_extend:DI | | 2509 | (and:DI (not:DI (sign_extend:DI |
2510 | (match_operand:SI 2 "s_register_operand" "r,r"))) | | 2510 | (match_operand:SI 2 "s_register_operand" "r,r"))) |
2511 | (match_operand:DI 1 "s_register_operand" "0,r")))] | | 2511 | (match_operand:DI 1 "s_register_operand" "0,r")))] |
2512 | "TARGET_32BIT" | | 2512 | "TARGET_32BIT" |
2513 | "#" | | 2513 | "#" |
2514 | "TARGET_32BIT && reload_completed" | | 2514 | "TARGET_32BIT && reload_completed" |
2515 | [(set (match_dup 0) (and:SI (not:SI (match_dup 2)) (match_dup 1))) | | 2515 | [(set (match_dup 0) (and:SI (not:SI (match_dup 2)) (match_dup 1))) |
2516 | (set (match_dup 3) (and:SI (not:SI | | 2516 | (set (match_dup 3) (and:SI (not:SI |
2517 | (ashiftrt:SI (match_dup 2) (const_int 31))) | | 2517 | (ashiftrt:SI (match_dup 2) (const_int 31))) |
2518 | (match_dup 4)))] | | 2518 | (match_dup 4)))] |
2519 | " | | 2519 | " |
2520 | { | | 2520 | { |
2521 | operands[3] = gen_highpart (SImode, operands[0]); | | 2521 | operands[3] = gen_highpart (SImode, operands[0]); |
2522 | operands[0] = gen_lowpart (SImode, operands[0]); | | 2522 | operands[0] = gen_lowpart (SImode, operands[0]); |
2523 | operands[4] = gen_highpart (SImode, operands[1]); | | 2523 | operands[4] = gen_highpart (SImode, operands[1]); |
2524 | operands[1] = gen_lowpart (SImode, operands[1]); | | 2524 | operands[1] = gen_lowpart (SImode, operands[1]); |
2525 | }" | | 2525 | }" |
2526 | [(set_attr "length" "8") | | 2526 | [(set_attr "length" "8") |
2527 | (set_attr "predicable" "yes")] | | 2527 | (set_attr "predicable" "yes")] |
2528 | ) | | 2528 | ) |
2529 | | | 2529 | |
2530 | (define_insn "andsi_notsi_si" | | 2530 | (define_insn "andsi_notsi_si" |
2531 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 2531 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
2532 | (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r")) | | 2532 | (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r")) |
2533 | (match_operand:SI 1 "s_register_operand" "r")))] | | 2533 | (match_operand:SI 1 "s_register_operand" "r")))] |
2534 | "TARGET_32BIT" | | 2534 | "TARGET_32BIT" |
2535 | "bic%?\\t%0, %1, %2" | | 2535 | "bic%?\\t%0, %1, %2" |
2536 | [(set_attr "predicable" "yes")] | | 2536 | [(set_attr "predicable" "yes")] |
2537 | ) | | 2537 | ) |
2538 | | | 2538 | |
2539 | (define_insn "bicsi3" | | 2539 | (define_insn "bicsi3" |
2540 | [(set (match_operand:SI 0 "register_operand" "=l") | | 2540 | [(set (match_operand:SI 0 "register_operand" "=l") |
2541 | (and:SI (not:SI (match_operand:SI 1 "register_operand" "l")) | | 2541 | (and:SI (not:SI (match_operand:SI 1 "register_operand" "l")) |
2542 | (match_operand:SI 2 "register_operand" "0")))] | | 2542 | (match_operand:SI 2 "register_operand" "0")))] |
2543 | "TARGET_THUMB1" | | 2543 | "TARGET_THUMB1" |
2544 | "bic\\t%0, %0, %1" | | 2544 | "bic\\t%0, %0, %1" |
2545 | [(set_attr "length" "2")] | | 2545 | [(set_attr "length" "2")] |
2546 | ) | | 2546 | ) |
2547 | | | 2547 | |
2548 | (define_insn "andsi_not_shiftsi_si" | | 2548 | (define_insn "andsi_not_shiftsi_si" |
2549 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 2549 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
2550 | (and:SI (not:SI (match_operator:SI 4 "shift_operator" | | 2550 | (and:SI (not:SI (match_operator:SI 4 "shift_operator" |
2551 | [(match_operand:SI 2 "s_register_operand" "r") | | 2551 | [(match_operand:SI 2 "s_register_operand" "r") |
2552 | (match_operand:SI 3 "arm_rhs_operand" "rM")])) | | 2552 | (match_operand:SI 3 "arm_rhs_operand" "rM")])) |
2553 | (match_operand:SI 1 "s_register_operand" "r")))] | | 2553 | (match_operand:SI 1 "s_register_operand" "r")))] |
2554 | "TARGET_ARM" | | 2554 | "TARGET_ARM" |
2555 | "bic%?\\t%0, %1, %2%S4" | | 2555 | "bic%?\\t%0, %1, %2%S4" |
2556 | [(set_attr "predicable" "yes") | | 2556 | [(set_attr "predicable" "yes") |
2557 | (set_attr "shift" "2") | | 2557 | (set_attr "shift" "2") |
2558 | (set (attr "type") (if_then_else (match_operand 3 "const_int_operand" "") | | 2558 | (set (attr "type") (if_then_else (match_operand 3 "const_int_operand" "") |
2559 | (const_string "alu_shift") | | 2559 | (const_string "alu_shift") |
2560 | (const_string "alu_shift_reg")))] | | 2560 | (const_string "alu_shift_reg")))] |
2561 | ) | | 2561 | ) |
2562 | | | 2562 | |
2563 | (define_insn "*andsi_notsi_si_compare0" | | 2563 | (define_insn "*andsi_notsi_si_compare0" |
2564 | [(set (reg:CC_NOOV CC_REGNUM) | | 2564 | [(set (reg:CC_NOOV CC_REGNUM) |
2565 | (compare:CC_NOOV | | 2565 | (compare:CC_NOOV |
2566 | (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r")) | | 2566 | (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r")) |
2567 | (match_operand:SI 1 "s_register_operand" "r")) | | 2567 | (match_operand:SI 1 "s_register_operand" "r")) |
2568 | (const_int 0))) | | 2568 | (const_int 0))) |
2569 | (set (match_operand:SI 0 "s_register_operand" "=r") | | 2569 | (set (match_operand:SI 0 "s_register_operand" "=r") |
2570 | (and:SI (not:SI (match_dup 2)) (match_dup 1)))] | | 2570 | (and:SI (not:SI (match_dup 2)) (match_dup 1)))] |
2571 | "TARGET_32BIT" | | 2571 | "TARGET_32BIT" |
2572 | "bic%.\\t%0, %1, %2" | | 2572 | "bic%.\\t%0, %1, %2" |
2573 | [(set_attr "conds" "set")] | | 2573 | [(set_attr "conds" "set")] |
2574 | ) | | 2574 | ) |
2575 | | | 2575 | |
2576 | (define_insn "*andsi_notsi_si_compare0_scratch" | | 2576 | (define_insn "*andsi_notsi_si_compare0_scratch" |
2577 | [(set (reg:CC_NOOV CC_REGNUM) | | 2577 | [(set (reg:CC_NOOV CC_REGNUM) |
2578 | (compare:CC_NOOV | | 2578 | (compare:CC_NOOV |
2579 | (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r")) | | 2579 | (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r")) |
2580 | (match_operand:SI 1 "s_register_operand" "r")) | | 2580 | (match_operand:SI 1 "s_register_operand" "r")) |
2581 | (const_int 0))) | | 2581 | (const_int 0))) |
2582 | (clobber (match_scratch:SI 0 "=r"))] | | 2582 | (clobber (match_scratch:SI 0 "=r"))] |
2583 | "TARGET_32BIT" | | 2583 | "TARGET_32BIT" |
2584 | "bic%.\\t%0, %1, %2" | | 2584 | "bic%.\\t%0, %1, %2" |
2585 | [(set_attr "conds" "set")] | | 2585 | [(set_attr "conds" "set")] |
2586 | ) | | 2586 | ) |
2587 | | | 2587 | |
2588 | (define_insn "iordi3" | | 2588 | (define_insn "iordi3" |
2589 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") | | 2589 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") |
2590 | (ior:DI (match_operand:DI 1 "s_register_operand" "%0,r") | | 2590 | (ior:DI (match_operand:DI 1 "s_register_operand" "%0,r") |
2591 | (match_operand:DI 2 "s_register_operand" "r,r")))] | | 2591 | (match_operand:DI 2 "s_register_operand" "r,r")))] |
2592 | "TARGET_32BIT && ! TARGET_IWMMXT" | | 2592 | "TARGET_32BIT && ! TARGET_IWMMXT" |
2593 | "#" | | 2593 | "#" |
2594 | [(set_attr "length" "8") | | 2594 | [(set_attr "length" "8") |
2595 | (set_attr "predicable" "yes")] | | 2595 | (set_attr "predicable" "yes")] |
2596 | ) | | 2596 | ) |
2597 | | | 2597 | |
2598 | (define_insn "*iordi_zesidi_di" | | 2598 | (define_insn "*iordi_zesidi_di" |
2599 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") | | 2599 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") |
2600 | (ior:DI (zero_extend:DI | | 2600 | (ior:DI (zero_extend:DI |
2601 | (match_operand:SI 2 "s_register_operand" "r,r")) | | 2601 | (match_operand:SI 2 "s_register_operand" "r,r")) |
2602 | (match_operand:DI 1 "s_register_operand" "0,?r")))] | | 2602 | (match_operand:DI 1 "s_register_operand" "0,?r")))] |
2603 | "TARGET_32BIT" | | 2603 | "TARGET_32BIT" |
2604 | "@ | | 2604 | "@ |
2605 | orr%?\\t%Q0, %Q1, %2 | | 2605 | orr%?\\t%Q0, %Q1, %2 |
2606 | #" | | 2606 | #" |
2607 | [(set_attr "length" "4,8") | | 2607 | [(set_attr "length" "4,8") |
2608 | (set_attr "predicable" "yes")] | | 2608 | (set_attr "predicable" "yes")] |
2609 | ) | | 2609 | ) |
2610 | | | 2610 | |
2611 | (define_insn "*iordi_sesidi_di" | | 2611 | (define_insn "*iordi_sesidi_di" |
2612 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") | | 2612 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") |
2613 | (ior:DI (sign_extend:DI | | 2613 | (ior:DI (sign_extend:DI |
2614 | (match_operand:SI 2 "s_register_operand" "r,r")) | | 2614 | (match_operand:SI 2 "s_register_operand" "r,r")) |
2615 | (match_operand:DI 1 "s_register_operand" "0,r")))] | | 2615 | (match_operand:DI 1 "s_register_operand" "0,r")))] |
2616 | "TARGET_32BIT" | | 2616 | "TARGET_32BIT" |
2617 | "#" | | 2617 | "#" |
2618 | [(set_attr "length" "8") | | 2618 | [(set_attr "length" "8") |
2619 | (set_attr "predicable" "yes")] | | 2619 | (set_attr "predicable" "yes")] |
2620 | ) | | 2620 | ) |
2621 | | | 2621 | |
2622 | (define_expand "iorsi3" | | 2622 | (define_expand "iorsi3" |
2623 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2623 | [(set (match_operand:SI 0 "s_register_operand" "") |
2624 | (ior:SI (match_operand:SI 1 "s_register_operand" "") | | 2624 | (ior:SI (match_operand:SI 1 "s_register_operand" "") |
2625 | (match_operand:SI 2 "reg_or_int_operand" "")))] | | 2625 | (match_operand:SI 2 "reg_or_int_operand" "")))] |
2626 | "TARGET_EITHER" | | 2626 | "TARGET_EITHER" |
2627 | " | | 2627 | " |
2628 | if (GET_CODE (operands[2]) == CONST_INT) | | 2628 | if (GET_CODE (operands[2]) == CONST_INT) |
2629 | { | | 2629 | { |
2630 | if (TARGET_32BIT) | | 2630 | if (TARGET_32BIT) |
2631 | { | | 2631 | { |
2632 | arm_split_constant (IOR, SImode, NULL_RTX, | | 2632 | arm_split_constant (IOR, SImode, NULL_RTX, |
2633 | INTVAL (operands[2]), operands[0], operands[1], | | 2633 | INTVAL (operands[2]), operands[0], operands[1], |
2634 | optimize && can_create_pseudo_p ()); | | 2634 | optimize && can_create_pseudo_p ()); |
2635 | DONE; | | 2635 | DONE; |
2636 | } | | 2636 | } |
2637 | else /* TARGET_THUMB1 */ | | 2637 | else /* TARGET_THUMB1 */ |
2638 | { | | 2638 | { |
2639 | rtx tmp = force_reg (SImode, operands[2]); | | 2639 | rtx tmp = force_reg (SImode, operands[2]); |
2640 | if (rtx_equal_p (operands[0], operands[1])) | | 2640 | if (rtx_equal_p (operands[0], operands[1])) |
2641 | operands[2] = tmp; | | 2641 | operands[2] = tmp; |
2642 | else | | 2642 | else |
2643 | { | | 2643 | { |
2644 | operands[2] = operands[1]; | | 2644 | operands[2] = operands[1]; |
2645 | operands[1] = tmp; | | 2645 | operands[1] = tmp; |
2646 | } | | 2646 | } |
2647 | } | | 2647 | } |
2648 | } | | 2648 | } |
2649 | " | | 2649 | " |
2650 | ) | | 2650 | ) |
2651 | | | 2651 | |
2652 | (define_insn_and_split "*arm_iorsi3" | | 2652 | (define_insn_and_split "*arm_iorsi3" |
2653 | [(set (match_operand:SI 0 "s_register_operand" "=r,r") | | 2653 | [(set (match_operand:SI 0 "s_register_operand" "=r,r") |
2654 | (ior:SI (match_operand:SI 1 "s_register_operand" "r,r") | | 2654 | (ior:SI (match_operand:SI 1 "s_register_operand" "r,r") |
2655 | (match_operand:SI 2 "reg_or_int_operand" "rI,?n")))] | | 2655 | (match_operand:SI 2 "reg_or_int_operand" "rI,?n")))] |
2656 | "TARGET_ARM" | | 2656 | "TARGET_ARM" |
2657 | "@ | | 2657 | "@ |
2658 | orr%?\\t%0, %1, %2 | | 2658 | orr%?\\t%0, %1, %2 |
2659 | #" | | 2659 | #" |
2660 | "TARGET_ARM | | 2660 | "TARGET_ARM |
2661 | && GET_CODE (operands[2]) == CONST_INT | | 2661 | && GET_CODE (operands[2]) == CONST_INT |
2662 | && !const_ok_for_arm (INTVAL (operands[2]))" | | 2662 | && !const_ok_for_arm (INTVAL (operands[2]))" |
2663 | [(clobber (const_int 0))] | | 2663 | [(clobber (const_int 0))] |
2664 | " | | 2664 | " |
2665 | arm_split_constant (IOR, SImode, curr_insn, | | 2665 | arm_split_constant (IOR, SImode, curr_insn, |
2666 | INTVAL (operands[2]), operands[0], operands[1], 0); | | 2666 | INTVAL (operands[2]), operands[0], operands[1], 0); |
2667 | DONE; | | 2667 | DONE; |
2668 | " | | 2668 | " |
2669 | [(set_attr "length" "4,16") | | 2669 | [(set_attr "length" "4,16") |
2670 | (set_attr "predicable" "yes")] | | 2670 | (set_attr "predicable" "yes")] |
2671 | ) | | 2671 | ) |
2672 | | | 2672 | |
2673 | (define_insn "*thumb1_iorsi3" | | 2673 | (define_insn "*thumb1_iorsi3" |
2674 | [(set (match_operand:SI 0 "register_operand" "=l") | | 2674 | [(set (match_operand:SI 0 "register_operand" "=l") |
2675 | (ior:SI (match_operand:SI 1 "register_operand" "%0") | | 2675 | (ior:SI (match_operand:SI 1 "register_operand" "%0") |
2676 | (match_operand:SI 2 "register_operand" "l")))] | | 2676 | (match_operand:SI 2 "register_operand" "l")))] |
2677 | "TARGET_THUMB1" | | 2677 | "TARGET_THUMB1" |
2678 | "orr\\t%0, %0, %2" | | 2678 | "orr\\t%0, %0, %2" |
2679 | [(set_attr "length" "2")] | | 2679 | [(set_attr "length" "2")] |
2680 | ) | | 2680 | ) |
2681 | | | 2681 | |
2682 | (define_peephole2 | | 2682 | (define_peephole2 |
2683 | [(match_scratch:SI 3 "r") | | 2683 | [(match_scratch:SI 3 "r") |
2684 | (set (match_operand:SI 0 "arm_general_register_operand" "") | | 2684 | (set (match_operand:SI 0 "arm_general_register_operand" "") |
2685 | (ior:SI (match_operand:SI 1 "arm_general_register_operand" "") | | 2685 | (ior:SI (match_operand:SI 1 "arm_general_register_operand" "") |
2686 | (match_operand:SI 2 "const_int_operand" "")))] | | 2686 | (match_operand:SI 2 "const_int_operand" "")))] |
2687 | "TARGET_ARM | | 2687 | "TARGET_ARM |
2688 | && !const_ok_for_arm (INTVAL (operands[2])) | | 2688 | && !const_ok_for_arm (INTVAL (operands[2])) |
2689 | && const_ok_for_arm (~INTVAL (operands[2]))" | | 2689 | && const_ok_for_arm (~INTVAL (operands[2]))" |
2690 | [(set (match_dup 3) (match_dup 2)) | | 2690 | [(set (match_dup 3) (match_dup 2)) |
2691 | (set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))] | | 2691 | (set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))] |
2692 | "" | | 2692 | "" |
2693 | ) | | 2693 | ) |
2694 | | | 2694 | |
2695 | (define_insn "*iorsi3_compare0" | | 2695 | (define_insn "*iorsi3_compare0" |
2696 | [(set (reg:CC_NOOV CC_REGNUM) | | 2696 | [(set (reg:CC_NOOV CC_REGNUM) |
2697 | (compare:CC_NOOV (ior:SI (match_operand:SI 1 "s_register_operand" "%r") | | 2697 | (compare:CC_NOOV (ior:SI (match_operand:SI 1 "s_register_operand" "%r") |
2698 | (match_operand:SI 2 "arm_rhs_operand" "rI")) | | 2698 | (match_operand:SI 2 "arm_rhs_operand" "rI")) |
2699 | (const_int 0))) | | 2699 | (const_int 0))) |
2700 | (set (match_operand:SI 0 "s_register_operand" "=r") | | 2700 | (set (match_operand:SI 0 "s_register_operand" "=r") |
2701 | (ior:SI (match_dup 1) (match_dup 2)))] | | 2701 | (ior:SI (match_dup 1) (match_dup 2)))] |
2702 | "TARGET_32BIT" | | 2702 | "TARGET_32BIT" |
2703 | "orr%.\\t%0, %1, %2" | | 2703 | "orr%.\\t%0, %1, %2" |
2704 | [(set_attr "conds" "set")] | | 2704 | [(set_attr "conds" "set")] |
2705 | ) | | 2705 | ) |
2706 | | | 2706 | |
2707 | (define_insn "*iorsi3_compare0_scratch" | | 2707 | (define_insn "*iorsi3_compare0_scratch" |
2708 | [(set (reg:CC_NOOV CC_REGNUM) | | 2708 | [(set (reg:CC_NOOV CC_REGNUM) |
2709 | (compare:CC_NOOV (ior:SI (match_operand:SI 1 "s_register_operand" "%r") | | 2709 | (compare:CC_NOOV (ior:SI (match_operand:SI 1 "s_register_operand" "%r") |
2710 | (match_operand:SI 2 "arm_rhs_operand" "rI")) | | 2710 | (match_operand:SI 2 "arm_rhs_operand" "rI")) |
2711 | (const_int 0))) | | 2711 | (const_int 0))) |
2712 | (clobber (match_scratch:SI 0 "=r"))] | | 2712 | (clobber (match_scratch:SI 0 "=r"))] |
2713 | "TARGET_32BIT" | | 2713 | "TARGET_32BIT" |
2714 | "orr%.\\t%0, %1, %2" | | 2714 | "orr%.\\t%0, %1, %2" |
2715 | [(set_attr "conds" "set")] | | 2715 | [(set_attr "conds" "set")] |
2716 | ) | | 2716 | ) |
2717 | | | 2717 | |
2718 | (define_insn "xordi3" | | 2718 | (define_insn "xordi3" |
2719 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") | | 2719 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") |
2720 | (xor:DI (match_operand:DI 1 "s_register_operand" "%0,r") | | 2720 | (xor:DI (match_operand:DI 1 "s_register_operand" "%0,r") |
2721 | (match_operand:DI 2 "s_register_operand" "r,r")))] | | 2721 | (match_operand:DI 2 "s_register_operand" "r,r")))] |
2722 | "TARGET_32BIT && !TARGET_IWMMXT" | | 2722 | "TARGET_32BIT && !TARGET_IWMMXT" |
2723 | "#" | | 2723 | "#" |
2724 | [(set_attr "length" "8") | | 2724 | [(set_attr "length" "8") |
2725 | (set_attr "predicable" "yes")] | | 2725 | (set_attr "predicable" "yes")] |
2726 | ) | | 2726 | ) |
2727 | | | 2727 | |
2728 | (define_insn "*xordi_zesidi_di" | | 2728 | (define_insn "*xordi_zesidi_di" |
2729 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") | | 2729 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") |
2730 | (xor:DI (zero_extend:DI | | 2730 | (xor:DI (zero_extend:DI |
2731 | (match_operand:SI 2 "s_register_operand" "r,r")) | | 2731 | (match_operand:SI 2 "s_register_operand" "r,r")) |
2732 | (match_operand:DI 1 "s_register_operand" "0,?r")))] | | 2732 | (match_operand:DI 1 "s_register_operand" "0,?r")))] |
2733 | "TARGET_32BIT" | | 2733 | "TARGET_32BIT" |
2734 | "@ | | 2734 | "@ |
2735 | eor%?\\t%Q0, %Q1, %2 | | 2735 | eor%?\\t%Q0, %Q1, %2 |
2736 | #" | | 2736 | #" |
2737 | [(set_attr "length" "4,8") | | 2737 | [(set_attr "length" "4,8") |
2738 | (set_attr "predicable" "yes")] | | 2738 | (set_attr "predicable" "yes")] |
2739 | ) | | 2739 | ) |
2740 | | | 2740 | |
2741 | (define_insn "*xordi_sesidi_di" | | 2741 | (define_insn "*xordi_sesidi_di" |
2742 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") | | 2742 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") |
2743 | (xor:DI (sign_extend:DI | | 2743 | (xor:DI (sign_extend:DI |
2744 | (match_operand:SI 2 "s_register_operand" "r,r")) | | 2744 | (match_operand:SI 2 "s_register_operand" "r,r")) |
2745 | (match_operand:DI 1 "s_register_operand" "0,r")))] | | 2745 | (match_operand:DI 1 "s_register_operand" "0,r")))] |
2746 | "TARGET_32BIT" | | 2746 | "TARGET_32BIT" |
2747 | "#" | | 2747 | "#" |
2748 | [(set_attr "length" "8") | | 2748 | [(set_attr "length" "8") |
2749 | (set_attr "predicable" "yes")] | | 2749 | (set_attr "predicable" "yes")] |
2750 | ) | | 2750 | ) |
2751 | | | 2751 | |
2752 | (define_expand "xorsi3" | | 2752 | (define_expand "xorsi3" |
2753 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2753 | [(set (match_operand:SI 0 "s_register_operand" "") |
2754 | (xor:SI (match_operand:SI 1 "s_register_operand" "") | | 2754 | (xor:SI (match_operand:SI 1 "s_register_operand" "") |
2755 | (match_operand:SI 2 "reg_or_int_operand" "")))] | | 2755 | (match_operand:SI 2 "reg_or_int_operand" "")))] |
2756 | "TARGET_EITHER" | | 2756 | "TARGET_EITHER" |
2757 | "if (GET_CODE (operands[2]) == CONST_INT) | | 2757 | "if (GET_CODE (operands[2]) == CONST_INT) |
2758 | { | | 2758 | { |
2759 | if (TARGET_32BIT) | | 2759 | if (TARGET_32BIT) |
2760 | { | | 2760 | { |
2761 | arm_split_constant (XOR, SImode, NULL_RTX, | | 2761 | arm_split_constant (XOR, SImode, NULL_RTX, |
2762 | INTVAL (operands[2]), operands[0], operands[1], | | 2762 | INTVAL (operands[2]), operands[0], operands[1], |
2763 | optimize && can_create_pseudo_p ()); | | 2763 | optimize && can_create_pseudo_p ()); |
2764 | DONE; | | 2764 | DONE; |
2765 | } | | 2765 | } |
2766 | else /* TARGET_THUMB1 */ | | 2766 | else /* TARGET_THUMB1 */ |
2767 | { | | 2767 | { |
2768 | rtx tmp = force_reg (SImode, operands[2]); | | 2768 | rtx tmp = force_reg (SImode, operands[2]); |
2769 | if (rtx_equal_p (operands[0], operands[1])) | | 2769 | if (rtx_equal_p (operands[0], operands[1])) |
2770 | operands[2] = tmp; | | 2770 | operands[2] = tmp; |
2771 | else | | 2771 | else |
2772 | { | | 2772 | { |
2773 | operands[2] = operands[1]; | | 2773 | operands[2] = operands[1]; |
2774 | operands[1] = tmp; | | 2774 | operands[1] = tmp; |
2775 | } | | 2775 | } |
2776 | } | | 2776 | } |
2777 | }" | | 2777 | }" |
2778 | ) | | 2778 | ) |
2779 | | | 2779 | |
2780 | (define_insn "*arm_xorsi3" | | 2780 | (define_insn "*arm_xorsi3" |
2781 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 2781 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
2782 | (xor:SI (match_operand:SI 1 "s_register_operand" "r") | | 2782 | (xor:SI (match_operand:SI 1 "s_register_operand" "r") |
2783 | (match_operand:SI 2 "arm_rhs_operand" "rI")))] | | 2783 | (match_operand:SI 2 "arm_rhs_operand" "rI")))] |
2784 | "TARGET_32BIT" | | 2784 | "TARGET_32BIT" |
2785 | "eor%?\\t%0, %1, %2" | | 2785 | "eor%?\\t%0, %1, %2" |
2786 | [(set_attr "predicable" "yes")] | | 2786 | [(set_attr "predicable" "yes")] |
2787 | ) | | 2787 | ) |
2788 | | | 2788 | |
2789 | (define_insn "*thumb1_xorsi3" | | 2789 | (define_insn "*thumb1_xorsi3" |
2790 | [(set (match_operand:SI 0 "register_operand" "=l") | | 2790 | [(set (match_operand:SI 0 "register_operand" "=l") |
2791 | (xor:SI (match_operand:SI 1 "register_operand" "%0") | | 2791 | (xor:SI (match_operand:SI 1 "register_operand" "%0") |
2792 | (match_operand:SI 2 "register_operand" "l")))] | | 2792 | (match_operand:SI 2 "register_operand" "l")))] |
2793 | "TARGET_THUMB1" | | 2793 | "TARGET_THUMB1" |
2794 | "eor\\t%0, %0, %2" | | 2794 | "eor\\t%0, %0, %2" |
2795 | [(set_attr "length" "2")] | | 2795 | [(set_attr "length" "2")] |
2796 | ) | | 2796 | ) |
2797 | | | 2797 | |
2798 | (define_insn "*xorsi3_compare0" | | 2798 | (define_insn "*xorsi3_compare0" |
2799 | [(set (reg:CC_NOOV CC_REGNUM) | | 2799 | [(set (reg:CC_NOOV CC_REGNUM) |
2800 | (compare:CC_NOOV (xor:SI (match_operand:SI 1 "s_register_operand" "r") | | 2800 | (compare:CC_NOOV (xor:SI (match_operand:SI 1 "s_register_operand" "r") |
2801 | (match_operand:SI 2 "arm_rhs_operand" "rI")) | | 2801 | (match_operand:SI 2 "arm_rhs_operand" "rI")) |
2802 | (const_int 0))) | | 2802 | (const_int 0))) |
2803 | (set (match_operand:SI 0 "s_register_operand" "=r") | | 2803 | (set (match_operand:SI 0 "s_register_operand" "=r") |
2804 | (xor:SI (match_dup 1) (match_dup 2)))] | | 2804 | (xor:SI (match_dup 1) (match_dup 2)))] |
2805 | "TARGET_32BIT" | | 2805 | "TARGET_32BIT" |
2806 | "eor%.\\t%0, %1, %2" | | 2806 | "eor%.\\t%0, %1, %2" |
2807 | [(set_attr "conds" "set")] | | 2807 | [(set_attr "conds" "set")] |
2808 | ) | | 2808 | ) |
2809 | | | 2809 | |
2810 | (define_insn "*xorsi3_compare0_scratch" | | 2810 | (define_insn "*xorsi3_compare0_scratch" |
2811 | [(set (reg:CC_NOOV CC_REGNUM) | | 2811 | [(set (reg:CC_NOOV CC_REGNUM) |
2812 | (compare:CC_NOOV (xor:SI (match_operand:SI 0 "s_register_operand" "r") | | 2812 | (compare:CC_NOOV (xor:SI (match_operand:SI 0 "s_register_operand" "r") |
2813 | (match_operand:SI 1 "arm_rhs_operand" "rI")) | | 2813 | (match_operand:SI 1 "arm_rhs_operand" "rI")) |
2814 | (const_int 0)))] | | 2814 | (const_int 0)))] |
2815 | "TARGET_32BIT" | | 2815 | "TARGET_32BIT" |
2816 | "teq%?\\t%0, %1" | | 2816 | "teq%?\\t%0, %1" |
2817 | [(set_attr "conds" "set")] | | 2817 | [(set_attr "conds" "set")] |
2818 | ) | | 2818 | ) |
2819 | | | 2819 | |
2820 | ; By splitting (IOR (AND (NOT A) (NOT B)) C) as D = AND (IOR A B) (NOT C), | | 2820 | ; By splitting (IOR (AND (NOT A) (NOT B)) C) as D = AND (IOR A B) (NOT C), |
2821 | ; (NOT D) we can sometimes merge the final NOT into one of the following | | 2821 | ; (NOT D) we can sometimes merge the final NOT into one of the following |
2822 | ; insns. | | 2822 | ; insns. |
2823 | | | 2823 | |
2824 | (define_split | | 2824 | (define_split |
2825 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2825 | [(set (match_operand:SI 0 "s_register_operand" "") |
2826 | (ior:SI (and:SI (not:SI (match_operand:SI 1 "s_register_operand" "")) | | 2826 | (ior:SI (and:SI (not:SI (match_operand:SI 1 "s_register_operand" "")) |
2827 | (not:SI (match_operand:SI 2 "arm_rhs_operand" ""))) | | 2827 | (not:SI (match_operand:SI 2 "arm_rhs_operand" ""))) |
2828 | (match_operand:SI 3 "arm_rhs_operand" ""))) | | 2828 | (match_operand:SI 3 "arm_rhs_operand" ""))) |
2829 | (clobber (match_operand:SI 4 "s_register_operand" ""))] | | 2829 | (clobber (match_operand:SI 4 "s_register_operand" ""))] |
2830 | "TARGET_32BIT" | | 2830 | "TARGET_32BIT" |
2831 | [(set (match_dup 4) (and:SI (ior:SI (match_dup 1) (match_dup 2)) | | 2831 | [(set (match_dup 4) (and:SI (ior:SI (match_dup 1) (match_dup 2)) |
2832 | (not:SI (match_dup 3)))) | | 2832 | (not:SI (match_dup 3)))) |
2833 | (set (match_dup 0) (not:SI (match_dup 4)))] | | 2833 | (set (match_dup 0) (not:SI (match_dup 4)))] |
2834 | "" | | 2834 | "" |
2835 | ) | | 2835 | ) |
2836 | | | 2836 | |
2837 | (define_insn "*andsi_iorsi3_notsi" | | 2837 | (define_insn "*andsi_iorsi3_notsi" |
2838 | [(set (match_operand:SI 0 "s_register_operand" "=&r,&r,&r") | | 2838 | [(set (match_operand:SI 0 "s_register_operand" "=&r,&r,&r") |
2839 | (and:SI (ior:SI (match_operand:SI 1 "s_register_operand" "%0,r,r") | | 2839 | (and:SI (ior:SI (match_operand:SI 1 "s_register_operand" "%0,r,r") |
2840 | (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")) | | 2840 | (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")) |
2841 | (not:SI (match_operand:SI 3 "arm_rhs_operand" "rI,rI,rI"))))] | | 2841 | (not:SI (match_operand:SI 3 "arm_rhs_operand" "rI,rI,rI"))))] |
2842 | "TARGET_32BIT" | | 2842 | "TARGET_32BIT" |
2843 | "orr%?\\t%0, %1, %2\;bic%?\\t%0, %0, %3" | | 2843 | "orr%?\\t%0, %1, %2\;bic%?\\t%0, %0, %3" |
2844 | [(set_attr "length" "8") | | 2844 | [(set_attr "length" "8") |
2845 | (set_attr "ce_count" "2") | | 2845 | (set_attr "ce_count" "2") |
2846 | (set_attr "predicable" "yes")] | | 2846 | (set_attr "predicable" "yes")] |
2847 | ) | | 2847 | ) |
2848 | | | 2848 | |
2849 | ; ??? Are these four splitters still beneficial when the Thumb-2 bitfield | | 2849 | ; ??? Are these four splitters still beneficial when the Thumb-2 bitfield |
2850 | ; insns are available? | | 2850 | ; insns are available? |
2851 | (define_split | | 2851 | (define_split |
2852 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2852 | [(set (match_operand:SI 0 "s_register_operand" "") |
2853 | (match_operator:SI 1 "logical_binary_operator" | | 2853 | (match_operator:SI 1 "logical_binary_operator" |
2854 | [(zero_extract:SI (match_operand:SI 2 "s_register_operand" "") | | 2854 | [(zero_extract:SI (match_operand:SI 2 "s_register_operand" "") |
2855 | (match_operand:SI 3 "const_int_operand" "") | | 2855 | (match_operand:SI 3 "const_int_operand" "") |
2856 | (match_operand:SI 4 "const_int_operand" "")) | | 2856 | (match_operand:SI 4 "const_int_operand" "")) |
2857 | (match_operator:SI 9 "logical_binary_operator" | | 2857 | (match_operator:SI 9 "logical_binary_operator" |
2858 | [(lshiftrt:SI (match_operand:SI 5 "s_register_operand" "") | | 2858 | [(lshiftrt:SI (match_operand:SI 5 "s_register_operand" "") |
2859 | (match_operand:SI 6 "const_int_operand" "")) | | 2859 | (match_operand:SI 6 "const_int_operand" "")) |
2860 | (match_operand:SI 7 "s_register_operand" "")])])) | | 2860 | (match_operand:SI 7 "s_register_operand" "")])])) |
2861 | (clobber (match_operand:SI 8 "s_register_operand" ""))] | | 2861 | (clobber (match_operand:SI 8 "s_register_operand" ""))] |
2862 | "TARGET_32BIT | | 2862 | "TARGET_32BIT |
2863 | && GET_CODE (operands[1]) == GET_CODE (operands[9]) | | 2863 | && GET_CODE (operands[1]) == GET_CODE (operands[9]) |
2864 | && INTVAL (operands[3]) == 32 - INTVAL (operands[6])" | | 2864 | && INTVAL (operands[3]) == 32 - INTVAL (operands[6])" |
2865 | [(set (match_dup 8) | | 2865 | [(set (match_dup 8) |
2866 | (match_op_dup 1 | | 2866 | (match_op_dup 1 |
2867 | [(ashift:SI (match_dup 2) (match_dup 4)) | | 2867 | [(ashift:SI (match_dup 2) (match_dup 4)) |
2868 | (match_dup 5)])) | | 2868 | (match_dup 5)])) |
2869 | (set (match_dup 0) | | 2869 | (set (match_dup 0) |
2870 | (match_op_dup 1 | | 2870 | (match_op_dup 1 |
2871 | [(lshiftrt:SI (match_dup 8) (match_dup 6)) | | 2871 | [(lshiftrt:SI (match_dup 8) (match_dup 6)) |
2872 | (match_dup 7)]))] | | 2872 | (match_dup 7)]))] |
2873 | " | | 2873 | " |
2874 | operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); | | 2874 | operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); |
2875 | ") | | 2875 | ") |
2876 | | | 2876 | |
2877 | (define_split | | 2877 | (define_split |
2878 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2878 | [(set (match_operand:SI 0 "s_register_operand" "") |
2879 | (match_operator:SI 1 "logical_binary_operator" | | 2879 | (match_operator:SI 1 "logical_binary_operator" |
2880 | [(match_operator:SI 9 "logical_binary_operator" | | 2880 | [(match_operator:SI 9 "logical_binary_operator" |
2881 | [(lshiftrt:SI (match_operand:SI 5 "s_register_operand" "") | | 2881 | [(lshiftrt:SI (match_operand:SI 5 "s_register_operand" "") |
2882 | (match_operand:SI 6 "const_int_operand" "")) | | 2882 | (match_operand:SI 6 "const_int_operand" "")) |
2883 | (match_operand:SI 7 "s_register_operand" "")]) | | 2883 | (match_operand:SI 7 "s_register_operand" "")]) |
2884 | (zero_extract:SI (match_operand:SI 2 "s_register_operand" "") | | 2884 | (zero_extract:SI (match_operand:SI 2 "s_register_operand" "") |
2885 | (match_operand:SI 3 "const_int_operand" "") | | 2885 | (match_operand:SI 3 "const_int_operand" "") |
2886 | (match_operand:SI 4 "const_int_operand" ""))])) | | 2886 | (match_operand:SI 4 "const_int_operand" ""))])) |
2887 | (clobber (match_operand:SI 8 "s_register_operand" ""))] | | 2887 | (clobber (match_operand:SI 8 "s_register_operand" ""))] |
2888 | "TARGET_32BIT | | 2888 | "TARGET_32BIT |
2889 | && GET_CODE (operands[1]) == GET_CODE (operands[9]) | | 2889 | && GET_CODE (operands[1]) == GET_CODE (operands[9]) |
2890 | && INTVAL (operands[3]) == 32 - INTVAL (operands[6])" | | 2890 | && INTVAL (operands[3]) == 32 - INTVAL (operands[6])" |
2891 | [(set (match_dup 8) | | 2891 | [(set (match_dup 8) |
2892 | (match_op_dup 1 | | 2892 | (match_op_dup 1 |
2893 | [(ashift:SI (match_dup 2) (match_dup 4)) | | 2893 | [(ashift:SI (match_dup 2) (match_dup 4)) |
2894 | (match_dup 5)])) | | 2894 | (match_dup 5)])) |
2895 | (set (match_dup 0) | | 2895 | (set (match_dup 0) |
2896 | (match_op_dup 1 | | 2896 | (match_op_dup 1 |
2897 | [(lshiftrt:SI (match_dup 8) (match_dup 6)) | | 2897 | [(lshiftrt:SI (match_dup 8) (match_dup 6)) |
2898 | (match_dup 7)]))] | | 2898 | (match_dup 7)]))] |
2899 | " | | 2899 | " |
2900 | operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); | | 2900 | operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); |
2901 | ") | | 2901 | ") |
2902 | | | 2902 | |
2903 | (define_split | | 2903 | (define_split |
2904 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2904 | [(set (match_operand:SI 0 "s_register_operand" "") |
2905 | (match_operator:SI 1 "logical_binary_operator" | | 2905 | (match_operator:SI 1 "logical_binary_operator" |
2906 | [(sign_extract:SI (match_operand:SI 2 "s_register_operand" "") | | 2906 | [(sign_extract:SI (match_operand:SI 2 "s_register_operand" "") |
2907 | (match_operand:SI 3 "const_int_operand" "") | | 2907 | (match_operand:SI 3 "const_int_operand" "") |
2908 | (match_operand:SI 4 "const_int_operand" "")) | | 2908 | (match_operand:SI 4 "const_int_operand" "")) |
2909 | (match_operator:SI 9 "logical_binary_operator" | | 2909 | (match_operator:SI 9 "logical_binary_operator" |
2910 | [(ashiftrt:SI (match_operand:SI 5 "s_register_operand" "") | | 2910 | [(ashiftrt:SI (match_operand:SI 5 "s_register_operand" "") |
2911 | (match_operand:SI 6 "const_int_operand" "")) | | 2911 | (match_operand:SI 6 "const_int_operand" "")) |
2912 | (match_operand:SI 7 "s_register_operand" "")])])) | | 2912 | (match_operand:SI 7 "s_register_operand" "")])])) |
2913 | (clobber (match_operand:SI 8 "s_register_operand" ""))] | | 2913 | (clobber (match_operand:SI 8 "s_register_operand" ""))] |
2914 | "TARGET_32BIT | | 2914 | "TARGET_32BIT |
2915 | && GET_CODE (operands[1]) == GET_CODE (operands[9]) | | 2915 | && GET_CODE (operands[1]) == GET_CODE (operands[9]) |
2916 | && INTVAL (operands[3]) == 32 - INTVAL (operands[6])" | | 2916 | && INTVAL (operands[3]) == 32 - INTVAL (operands[6])" |
2917 | [(set (match_dup 8) | | 2917 | [(set (match_dup 8) |
2918 | (match_op_dup 1 | | 2918 | (match_op_dup 1 |
2919 | [(ashift:SI (match_dup 2) (match_dup 4)) | | 2919 | [(ashift:SI (match_dup 2) (match_dup 4)) |
2920 | (match_dup 5)])) | | 2920 | (match_dup 5)])) |
2921 | (set (match_dup 0) | | 2921 | (set (match_dup 0) |
2922 | (match_op_dup 1 | | 2922 | (match_op_dup 1 |
2923 | [(ashiftrt:SI (match_dup 8) (match_dup 6)) | | 2923 | [(ashiftrt:SI (match_dup 8) (match_dup 6)) |
2924 | (match_dup 7)]))] | | 2924 | (match_dup 7)]))] |
2925 | " | | 2925 | " |
2926 | operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); | | 2926 | operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); |
2927 | ") | | 2927 | ") |
2928 | | | 2928 | |
2929 | (define_split | | 2929 | (define_split |
2930 | [(set (match_operand:SI 0 "s_register_operand" "") | | 2930 | [(set (match_operand:SI 0 "s_register_operand" "") |
2931 | (match_operator:SI 1 "logical_binary_operator" | | 2931 | (match_operator:SI 1 "logical_binary_operator" |
2932 | [(match_operator:SI 9 "logical_binary_operator" | | 2932 | [(match_operator:SI 9 "logical_binary_operator" |
2933 | [(ashiftrt:SI (match_operand:SI 5 "s_register_operand" "") | | 2933 | [(ashiftrt:SI (match_operand:SI 5 "s_register_operand" "") |
2934 | (match_operand:SI 6 "const_int_operand" "")) | | 2934 | (match_operand:SI 6 "const_int_operand" "")) |
2935 | (match_operand:SI 7 "s_register_operand" "")]) | | 2935 | (match_operand:SI 7 "s_register_operand" "")]) |
2936 | (sign_extract:SI (match_operand:SI 2 "s_register_operand" "") | | 2936 | (sign_extract:SI (match_operand:SI 2 "s_register_operand" "") |
2937 | (match_operand:SI 3 "const_int_operand" "") | | 2937 | (match_operand:SI 3 "const_int_operand" "") |
2938 | (match_operand:SI 4 "const_int_operand" ""))])) | | 2938 | (match_operand:SI 4 "const_int_operand" ""))])) |
2939 | (clobber (match_operand:SI 8 "s_register_operand" ""))] | | 2939 | (clobber (match_operand:SI 8 "s_register_operand" ""))] |
2940 | "TARGET_32BIT | | 2940 | "TARGET_32BIT |
2941 | && GET_CODE (operands[1]) == GET_CODE (operands[9]) | | 2941 | && GET_CODE (operands[1]) == GET_CODE (operands[9]) |
2942 | && INTVAL (operands[3]) == 32 - INTVAL (operands[6])" | | 2942 | && INTVAL (operands[3]) == 32 - INTVAL (operands[6])" |
2943 | [(set (match_dup 8) | | 2943 | [(set (match_dup 8) |
2944 | (match_op_dup 1 | | 2944 | (match_op_dup 1 |
2945 | [(ashift:SI (match_dup 2) (match_dup 4)) | | 2945 | [(ashift:SI (match_dup 2) (match_dup 4)) |
2946 | (match_dup 5)])) | | 2946 | (match_dup 5)])) |
2947 | (set (match_dup 0) | | 2947 | (set (match_dup 0) |
2948 | (match_op_dup 1 | | 2948 | (match_op_dup 1 |
2949 | [(ashiftrt:SI (match_dup 8) (match_dup 6)) | | 2949 | [(ashiftrt:SI (match_dup 8) (match_dup 6)) |
2950 | (match_dup 7)]))] | | 2950 | (match_dup 7)]))] |
2951 | " | | 2951 | " |
2952 | operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); | | 2952 | operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); |
2953 | ") | | 2953 | ") |
2954 | | | 2954 | |
2955 | | | 2955 | |
2956 | ;; Minimum and maximum insns | | 2956 | ;; Minimum and maximum insns |
2957 | | | 2957 | |
2958 | (define_expand "smaxsi3" | | 2958 | (define_expand "smaxsi3" |
2959 | [(parallel [ | | 2959 | [(parallel [ |
2960 | (set (match_operand:SI 0 "s_register_operand" "") | | 2960 | (set (match_operand:SI 0 "s_register_operand" "") |
2961 | (smax:SI (match_operand:SI 1 "s_register_operand" "") | | 2961 | (smax:SI (match_operand:SI 1 "s_register_operand" "") |
2962 | (match_operand:SI 2 "arm_rhs_operand" ""))) | | 2962 | (match_operand:SI 2 "arm_rhs_operand" ""))) |
2963 | (clobber (reg:CC CC_REGNUM))])] | | 2963 | (clobber (reg:CC CC_REGNUM))])] |
2964 | "TARGET_32BIT" | | 2964 | "TARGET_32BIT" |
2965 | " | | 2965 | " |
2966 | if (operands[2] == const0_rtx || operands[2] == constm1_rtx) | | 2966 | if (operands[2] == const0_rtx || operands[2] == constm1_rtx) |
2967 | { | | 2967 | { |
2968 | /* No need for a clobber of the condition code register here. */ | | 2968 | /* No need for a clobber of the condition code register here. */ |
2969 | emit_insn (gen_rtx_SET (VOIDmode, operands[0], | | 2969 | emit_insn (gen_rtx_SET (VOIDmode, operands[0], |
2970 | gen_rtx_SMAX (SImode, operands[1], | | 2970 | gen_rtx_SMAX (SImode, operands[1], |
2971 | operands[2]))); | | 2971 | operands[2]))); |
2972 | DONE; | | 2972 | DONE; |
2973 | } | | 2973 | } |
2974 | ") | | 2974 | ") |
2975 | | | 2975 | |
2976 | (define_insn "*smax_0" | | 2976 | (define_insn "*smax_0" |
2977 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 2977 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
2978 | (smax:SI (match_operand:SI 1 "s_register_operand" "r") | | 2978 | (smax:SI (match_operand:SI 1 "s_register_operand" "r") |
2979 | (const_int 0)))] | | 2979 | (const_int 0)))] |
2980 | "TARGET_32BIT" | | 2980 | "TARGET_32BIT" |
2981 | "bic%?\\t%0, %1, %1, asr #31" | | 2981 | "bic%?\\t%0, %1, %1, asr #31" |
2982 | [(set_attr "predicable" "yes")] | | 2982 | [(set_attr "predicable" "yes")] |
2983 | ) | | 2983 | ) |
2984 | | | 2984 | |
2985 | (define_insn "*smax_m1" | | 2985 | (define_insn "*smax_m1" |
2986 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 2986 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
2987 | (smax:SI (match_operand:SI 1 "s_register_operand" "r") | | 2987 | (smax:SI (match_operand:SI 1 "s_register_operand" "r") |
2988 | (const_int -1)))] | | 2988 | (const_int -1)))] |
2989 | "TARGET_32BIT" | | 2989 | "TARGET_32BIT" |
2990 | "orr%?\\t%0, %1, %1, asr #31" | | 2990 | "orr%?\\t%0, %1, %1, asr #31" |
2991 | [(set_attr "predicable" "yes")] | | 2991 | [(set_attr "predicable" "yes")] |
2992 | ) | | 2992 | ) |
2993 | | | 2993 | |
2994 | (define_insn "*arm_smax_insn" | | 2994 | (define_insn "*arm_smax_insn" |
2995 | [(set (match_operand:SI 0 "s_register_operand" "=r,r") | | 2995 | [(set (match_operand:SI 0 "s_register_operand" "=r,r") |
2996 | (smax:SI (match_operand:SI 1 "s_register_operand" "%0,?r") | | 2996 | (smax:SI (match_operand:SI 1 "s_register_operand" "%0,?r") |
2997 | (match_operand:SI 2 "arm_rhs_operand" "rI,rI"))) | | 2997 | (match_operand:SI 2 "arm_rhs_operand" "rI,rI"))) |
2998 | (clobber (reg:CC CC_REGNUM))] | | 2998 | (clobber (reg:CC CC_REGNUM))] |
2999 | "TARGET_ARM" | | 2999 | "TARGET_ARM" |
3000 | "@ | | 3000 | "@ |
3001 | cmp\\t%1, %2\;movlt\\t%0, %2 | | 3001 | cmp\\t%1, %2\;movlt\\t%0, %2 |
3002 | cmp\\t%1, %2\;movge\\t%0, %1\;movlt\\t%0, %2" | | 3002 | cmp\\t%1, %2\;movge\\t%0, %1\;movlt\\t%0, %2" |
3003 | [(set_attr "conds" "clob") | | 3003 | [(set_attr "conds" "clob") |
3004 | (set_attr "length" "8,12")] | | 3004 | (set_attr "length" "8,12")] |
3005 | ) | | 3005 | ) |
3006 | | | 3006 | |
3007 | (define_expand "sminsi3" | | 3007 | (define_expand "sminsi3" |
3008 | [(parallel [ | | 3008 | [(parallel [ |
3009 | (set (match_operand:SI 0 "s_register_operand" "") | | 3009 | (set (match_operand:SI 0 "s_register_operand" "") |
3010 | (smin:SI (match_operand:SI 1 "s_register_operand" "") | | 3010 | (smin:SI (match_operand:SI 1 "s_register_operand" "") |
3011 | (match_operand:SI 2 "arm_rhs_operand" ""))) | | 3011 | (match_operand:SI 2 "arm_rhs_operand" ""))) |
3012 | (clobber (reg:CC CC_REGNUM))])] | | 3012 | (clobber (reg:CC CC_REGNUM))])] |
3013 | "TARGET_32BIT" | | 3013 | "TARGET_32BIT" |
3014 | " | | 3014 | " |
3015 | if (operands[2] == const0_rtx) | | 3015 | if (operands[2] == const0_rtx) |
3016 | { | | 3016 | { |
3017 | /* No need for a clobber of the condition code register here. */ | | 3017 | /* No need for a clobber of the condition code register here. */ |
3018 | emit_insn (gen_rtx_SET (VOIDmode, operands[0], | | 3018 | emit_insn (gen_rtx_SET (VOIDmode, operands[0], |
3019 | gen_rtx_SMIN (SImode, operands[1], | | 3019 | gen_rtx_SMIN (SImode, operands[1], |
3020 | operands[2]))); | | 3020 | operands[2]))); |
3021 | DONE; | | 3021 | DONE; |
3022 | } | | 3022 | } |
3023 | ") | | 3023 | ") |
3024 | | | 3024 | |
3025 | (define_insn "*smin_0" | | 3025 | (define_insn "*smin_0" |
3026 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 3026 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
3027 | (smin:SI (match_operand:SI 1 "s_register_operand" "r") | | 3027 | (smin:SI (match_operand:SI 1 "s_register_operand" "r") |
3028 | (const_int 0)))] | | 3028 | (const_int 0)))] |
3029 | "TARGET_32BIT" | | 3029 | "TARGET_32BIT" |
3030 | "and%?\\t%0, %1, %1, asr #31" | | 3030 | "and%?\\t%0, %1, %1, asr #31" |
3031 | [(set_attr "predicable" "yes")] | | 3031 | [(set_attr "predicable" "yes")] |
3032 | ) | | 3032 | ) |
3033 | | | 3033 | |
3034 | (define_insn "*arm_smin_insn" | | 3034 | (define_insn "*arm_smin_insn" |
3035 | [(set (match_operand:SI 0 "s_register_operand" "=r,r") | | 3035 | [(set (match_operand:SI 0 "s_register_operand" "=r,r") |
3036 | (smin:SI (match_operand:SI 1 "s_register_operand" "%0,?r") | | 3036 | (smin:SI (match_operand:SI 1 "s_register_operand" "%0,?r") |
3037 | (match_operand:SI 2 "arm_rhs_operand" "rI,rI"))) | | 3037 | (match_operand:SI 2 "arm_rhs_operand" "rI,rI"))) |
3038 | (clobber (reg:CC CC_REGNUM))] | | 3038 | (clobber (reg:CC CC_REGNUM))] |
3039 | "TARGET_ARM" | | 3039 | "TARGET_ARM" |
3040 | "@ | | 3040 | "@ |
3041 | cmp\\t%1, %2\;movge\\t%0, %2 | | 3041 | cmp\\t%1, %2\;movge\\t%0, %2 |
3042 | cmp\\t%1, %2\;movlt\\t%0, %1\;movge\\t%0, %2" | | 3042 | cmp\\t%1, %2\;movlt\\t%0, %1\;movge\\t%0, %2" |
3043 | [(set_attr "conds" "clob") | | 3043 | [(set_attr "conds" "clob") |
3044 | (set_attr "length" "8,12")] | | 3044 | (set_attr "length" "8,12")] |
3045 | ) | | 3045 | ) |
3046 | | | 3046 | |
3047 | (define_expand "umaxsi3" | | 3047 | (define_expand "umaxsi3" |
3048 | [(parallel [ | | 3048 | [(parallel [ |
3049 | (set (match_operand:SI 0 "s_register_operand" "") | | 3049 | (set (match_operand:SI 0 "s_register_operand" "") |
3050 | (umax:SI (match_operand:SI 1 "s_register_operand" "") | | 3050 | (umax:SI (match_operand:SI 1 "s_register_operand" "") |
3051 | (match_operand:SI 2 "arm_rhs_operand" ""))) | | 3051 | (match_operand:SI 2 "arm_rhs_operand" ""))) |
3052 | (clobber (reg:CC CC_REGNUM))])] | | 3052 | (clobber (reg:CC CC_REGNUM))])] |
3053 | "TARGET_32BIT" | | 3053 | "TARGET_32BIT" |
3054 | "" | | 3054 | "" |
3055 | ) | | 3055 | ) |
3056 | | | 3056 | |
3057 | (define_insn "*arm_umaxsi3" | | 3057 | (define_insn "*arm_umaxsi3" |
3058 | [(set (match_operand:SI 0 "s_register_operand" "=r,r,r") | | 3058 | [(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
3059 | (umax:SI (match_operand:SI 1 "s_register_operand" "0,r,?r") | | 3059 | (umax:SI (match_operand:SI 1 "s_register_operand" "0,r,?r") |
3060 | (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI"))) | | 3060 | (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI"))) |
3061 | (clobber (reg:CC CC_REGNUM))] | | 3061 | (clobber (reg:CC CC_REGNUM))] |
3062 | "TARGET_ARM" | | 3062 | "TARGET_ARM" |
3063 | "@ | | 3063 | "@ |
3064 | cmp\\t%1, %2\;movcc\\t%0, %2 | | 3064 | cmp\\t%1, %2\;movcc\\t%0, %2 |
3065 | cmp\\t%1, %2\;movcs\\t%0, %1 | | 3065 | cmp\\t%1, %2\;movcs\\t%0, %1 |
3066 | cmp\\t%1, %2\;movcs\\t%0, %1\;movcc\\t%0, %2" | | 3066 | cmp\\t%1, %2\;movcs\\t%0, %1\;movcc\\t%0, %2" |
3067 | [(set_attr "conds" "clob") | | 3067 | [(set_attr "conds" "clob") |
3068 | (set_attr "length" "8,8,12")] | | 3068 | (set_attr "length" "8,8,12")] |
3069 | ) | | 3069 | ) |
3070 | | | 3070 | |
3071 | (define_expand "uminsi3" | | 3071 | (define_expand "uminsi3" |
3072 | [(parallel [ | | 3072 | [(parallel [ |
3073 | (set (match_operand:SI 0 "s_register_operand" "") | | 3073 | (set (match_operand:SI 0 "s_register_operand" "") |
3074 | (umin:SI (match_operand:SI 1 "s_register_operand" "") | | 3074 | (umin:SI (match_operand:SI 1 "s_register_operand" "") |
3075 | (match_operand:SI 2 "arm_rhs_operand" ""))) | | 3075 | (match_operand:SI 2 "arm_rhs_operand" ""))) |
3076 | (clobber (reg:CC CC_REGNUM))])] | | 3076 | (clobber (reg:CC CC_REGNUM))])] |
3077 | "TARGET_32BIT" | | 3077 | "TARGET_32BIT" |
3078 | "" | | 3078 | "" |
3079 | ) | | 3079 | ) |
3080 | | | 3080 | |
3081 | (define_insn "*arm_uminsi3" | | 3081 | (define_insn "*arm_uminsi3" |
3082 | [(set (match_operand:SI 0 "s_register_operand" "=r,r,r") | | 3082 | [(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
3083 | (umin:SI (match_operand:SI 1 "s_register_operand" "0,r,?r") | | 3083 | (umin:SI (match_operand:SI 1 "s_register_operand" "0,r,?r") |
3084 | (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI"))) | | 3084 | (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI"))) |
3085 | (clobber (reg:CC CC_REGNUM))] | | 3085 | (clobber (reg:CC CC_REGNUM))] |
3086 | "TARGET_ARM" | | 3086 | "TARGET_ARM" |
3087 | "@ | | 3087 | "@ |
3088 | cmp\\t%1, %2\;movcs\\t%0, %2 | | 3088 | cmp\\t%1, %2\;movcs\\t%0, %2 |
3089 | cmp\\t%1, %2\;movcc\\t%0, %1 | | 3089 | cmp\\t%1, %2\;movcc\\t%0, %1 |
3090 | cmp\\t%1, %2\;movcc\\t%0, %1\;movcs\\t%0, %2" | | 3090 | cmp\\t%1, %2\;movcc\\t%0, %1\;movcs\\t%0, %2" |
3091 | [(set_attr "conds" "clob") | | 3091 | [(set_attr "conds" "clob") |
3092 | (set_attr "length" "8,8,12")] | | 3092 | (set_attr "length" "8,8,12")] |
3093 | ) | | 3093 | ) |
3094 | | | 3094 | |
3095 | (define_insn "*store_minmaxsi" | | 3095 | (define_insn "*store_minmaxsi" |
3096 | [(set (match_operand:SI 0 "memory_operand" "=m") | | 3096 | [(set (match_operand:SI 0 "memory_operand" "=m") |
3097 | (match_operator:SI 3 "minmax_operator" | | 3097 | (match_operator:SI 3 "minmax_operator" |
3098 | [(match_operand:SI 1 "s_register_operand" "r") | | 3098 | [(match_operand:SI 1 "s_register_operand" "r") |
3099 | (match_operand:SI 2 "s_register_operand" "r")])) | | 3099 | (match_operand:SI 2 "s_register_operand" "r")])) |
3100 | (clobber (reg:CC CC_REGNUM))] | | 3100 | (clobber (reg:CC CC_REGNUM))] |
3101 | "TARGET_32BIT" | | 3101 | "TARGET_32BIT" |
3102 | "* | | 3102 | "* |
3103 | operands[3] = gen_rtx_fmt_ee (minmax_code (operands[3]), SImode, | | 3103 | operands[3] = gen_rtx_fmt_ee (minmax_code (operands[3]), SImode, |
3104 | operands[1], operands[2]); | | 3104 | operands[1], operands[2]); |
3105 | output_asm_insn (\"cmp\\t%1, %2\", operands); | | 3105 | output_asm_insn (\"cmp\\t%1, %2\", operands); |
3106 | if (TARGET_THUMB2) | | 3106 | if (TARGET_THUMB2) |
3107 | output_asm_insn (\"ite\t%d3\", operands); | | 3107 | output_asm_insn (\"ite\t%d3\", operands); |
3108 | output_asm_insn (\"str%d3\\t%1, %0\", operands); | | 3108 | output_asm_insn (\"str%d3\\t%1, %0\", operands); |
3109 | output_asm_insn (\"str%D3\\t%2, %0\", operands); | | 3109 | output_asm_insn (\"str%D3\\t%2, %0\", operands); |
3110 | return \"\"; | | 3110 | return \"\"; |
3111 | " | | 3111 | " |
3112 | [(set_attr "conds" "clob") | | 3112 | [(set_attr "conds" "clob") |
3113 | (set (attr "length") | | 3113 | (set (attr "length") |
3114 | (if_then_else (eq_attr "is_thumb" "yes") | | 3114 | (if_then_else (eq_attr "is_thumb" "yes") |
3115 | (const_int 14) | | 3115 | (const_int 14) |
3116 | (const_int 12))) | | 3116 | (const_int 12))) |
3117 | (set_attr "type" "store1")] | | 3117 | (set_attr "type" "store1")] |
3118 | ) | | 3118 | ) |
3119 | | | 3119 | |
3120 | ; Reject the frame pointer in operand[1], since reloading this after | | 3120 | ; Reject the frame pointer in operand[1], since reloading this after |
3121 | ; it has been eliminated can cause carnage. | | 3121 | ; it has been eliminated can cause carnage. |
3122 | (define_insn "*minmax_arithsi" | | 3122 | (define_insn "*minmax_arithsi" |
3123 | [(set (match_operand:SI 0 "s_register_operand" "=r,r") | | 3123 | [(set (match_operand:SI 0 "s_register_operand" "=r,r") |
3124 | (match_operator:SI 4 "shiftable_operator" | | 3124 | (match_operator:SI 4 "shiftable_operator" |
3125 | [(match_operator:SI 5 "minmax_operator" | | 3125 | [(match_operator:SI 5 "minmax_operator" |
3126 | [(match_operand:SI 2 "s_register_operand" "r,r") | | 3126 | [(match_operand:SI 2 "s_register_operand" "r,r") |
3127 | (match_operand:SI 3 "arm_rhs_operand" "rI,rI")]) | | 3127 | (match_operand:SI 3 "arm_rhs_operand" "rI,rI")]) |
3128 | (match_operand:SI 1 "s_register_operand" "0,?r")])) | | 3128 | (match_operand:SI 1 "s_register_operand" "0,?r")])) |
3129 | (clobber (reg:CC CC_REGNUM))] | | 3129 | (clobber (reg:CC CC_REGNUM))] |
3130 | "TARGET_32BIT && !arm_eliminable_register (operands[1])" | | 3130 | "TARGET_32BIT && !arm_eliminable_register (operands[1])" |
3131 | "* | | 3131 | "* |
3132 | { | | 3132 | { |
3133 | enum rtx_code code = GET_CODE (operands[4]); | | 3133 | enum rtx_code code = GET_CODE (operands[4]); |
3134 | bool need_else; | | 3134 | bool need_else; |
3135 | | | 3135 | |
3136 | if (which_alternative != 0 || operands[3] != const0_rtx | | 3136 | if (which_alternative != 0 || operands[3] != const0_rtx |
3137 | || (code != PLUS && code != MINUS && code != IOR && code != XOR)) | | 3137 | || (code != PLUS && code != IOR && code != XOR)) |
3138 | need_else = true; | | 3138 | need_else = true; |
3139 | else | | 3139 | else |
3140 | need_else = false; | | 3140 | need_else = false; |
3141 | | | 3141 | |
3142 | operands[5] = gen_rtx_fmt_ee (minmax_code (operands[5]), SImode, | | 3142 | operands[5] = gen_rtx_fmt_ee (minmax_code (operands[5]), SImode, |
3143 | operands[2], operands[3]); | | 3143 | operands[2], operands[3]); |
3144 | output_asm_insn (\"cmp\\t%2, %3\", operands); | | 3144 | output_asm_insn (\"cmp\\t%2, %3\", operands); |
3145 | if (TARGET_THUMB2) | | 3145 | if (TARGET_THUMB2) |
3146 | { | | 3146 | { |
3147 | if (need_else) | | 3147 | if (need_else) |
3148 | output_asm_insn (\"ite\\t%d5\", operands); | | 3148 | output_asm_insn (\"ite\\t%d5\", operands); |
3149 | else | | 3149 | else |
3150 | output_asm_insn (\"it\\t%d5\", operands); | | 3150 | output_asm_insn (\"it\\t%d5\", operands); |
3151 | } | | 3151 | } |
3152 | output_asm_insn (\"%i4%d5\\t%0, %1, %2\", operands); | | 3152 | output_asm_insn (\"%i4%d5\\t%0, %1, %2\", operands); |
3153 | if (need_else) | | 3153 | if (need_else) |
3154 | output_asm_insn (\"%i4%D5\\t%0, %1, %3\", operands); | | 3154 | output_asm_insn (\"%i4%D5\\t%0, %1, %3\", operands); |
3155 | return \"\"; | | 3155 | return \"\"; |
3156 | }" | | 3156 | }" |
3157 | [(set_attr "conds" "clob") | | 3157 | [(set_attr "conds" "clob") |
3158 | (set (attr "length") | | 3158 | (set (attr "length") |
3159 | (if_then_else (eq_attr "is_thumb" "yes") | | 3159 | (if_then_else (eq_attr "is_thumb" "yes") |
3160 | (const_int 14) | | 3160 | (const_int 14) |
3161 | (const_int 12)))] | | 3161 | (const_int 12)))] |
3162 | ) | | 3162 | ) |
3163 | | | 3163 | |
3164 | | | 3164 | |
3165 | ;; Shift and rotation insns | | 3165 | ;; Shift and rotation insns |
3166 | | | 3166 | |
3167 | (define_expand "ashldi3" | | 3167 | (define_expand "ashldi3" |
3168 | [(set (match_operand:DI 0 "s_register_operand" "") | | 3168 | [(set (match_operand:DI 0 "s_register_operand" "") |
3169 | (ashift:DI (match_operand:DI 1 "s_register_operand" "") | | 3169 | (ashift:DI (match_operand:DI 1 "s_register_operand" "") |
3170 | (match_operand:SI 2 "reg_or_int_operand" "")))] | | 3170 | (match_operand:SI 2 "reg_or_int_operand" "")))] |
3171 | "TARGET_32BIT" | | 3171 | "TARGET_32BIT" |
3172 | " | | 3172 | " |
3173 | if (GET_CODE (operands[2]) == CONST_INT) | | 3173 | if (GET_CODE (operands[2]) == CONST_INT) |
3174 | { | | 3174 | { |
3175 | if ((HOST_WIDE_INT) INTVAL (operands[2]) == 1) | | 3175 | if ((HOST_WIDE_INT) INTVAL (operands[2]) == 1) |
3176 | { | | 3176 | { |
3177 | emit_insn (gen_arm_ashldi3_1bit (operands[0], operands[1])); | | 3177 | emit_insn (gen_arm_ashldi3_1bit (operands[0], operands[1])); |
3178 | DONE; | | 3178 | DONE; |
3179 | } | | 3179 | } |
3180 | /* Ideally we shouldn't fail here if we could know that operands[1] | | 3180 | /* Ideally we shouldn't fail here if we could know that operands[1] |
3181 | ends up already living in an iwmmxt register. Otherwise it's | | 3181 | ends up already living in an iwmmxt register. Otherwise it's |
3182 | cheaper to have the alternate code being generated than moving | | 3182 | cheaper to have the alternate code being generated than moving |
3183 | values to iwmmxt regs and back. */ | | 3183 | values to iwmmxt regs and back. */ |
3184 | FAIL; | | 3184 | FAIL; |
3185 | } | | 3185 | } |
3186 | else if (!TARGET_REALLY_IWMMXT && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)) | | 3186 | else if (!TARGET_REALLY_IWMMXT && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)) |
3187 | FAIL; | | 3187 | FAIL; |
3188 | " | | 3188 | " |
3189 | ) | | 3189 | ) |
3190 | | | 3190 | |
3191 | (define_insn "arm_ashldi3_1bit" | | 3191 | (define_insn "arm_ashldi3_1bit" |
3192 | [(set (match_operand:DI 0 "s_register_operand" "=&r,r") | | 3192 | [(set (match_operand:DI 0 "s_register_operand" "=&r,r") |
3193 | (ashift:DI (match_operand:DI 1 "s_register_operand" "0,r") | | 3193 | (ashift:DI (match_operand:DI 1 "s_register_operand" "0,r") |
3194 | (const_int 1))) | | 3194 | (const_int 1))) |
3195 | (clobber (reg:CC CC_REGNUM))] | | 3195 | (clobber (reg:CC CC_REGNUM))] |
3196 | "TARGET_32BIT" | | 3196 | "TARGET_32BIT" |
3197 | "movs\\t%Q0, %Q1, asl #1\;adc\\t%R0, %R1, %R1" | | 3197 | "movs\\t%Q0, %Q1, asl #1\;adc\\t%R0, %R1, %R1" |
3198 | [(set_attr "conds" "clob") | | 3198 | [(set_attr "conds" "clob") |
3199 | (set_attr "length" "8")] | | 3199 | (set_attr "length" "8")] |
3200 | ) | | 3200 | ) |
3201 | | | 3201 | |
3202 | (define_expand "ashlsi3" | | 3202 | (define_expand "ashlsi3" |
3203 | [(set (match_operand:SI 0 "s_register_operand" "") | | 3203 | [(set (match_operand:SI 0 "s_register_operand" "") |
3204 | (ashift:SI (match_operand:SI 1 "s_register_operand" "") | | 3204 | (ashift:SI (match_operand:SI 1 "s_register_operand" "") |
3205 | (match_operand:SI 2 "arm_rhs_operand" "")))] | | 3205 | (match_operand:SI 2 "arm_rhs_operand" "")))] |
3206 | "TARGET_EITHER" | | 3206 | "TARGET_EITHER" |
3207 | " | | 3207 | " |
3208 | if (GET_CODE (operands[2]) == CONST_INT | | 3208 | if (GET_CODE (operands[2]) == CONST_INT |
3209 | && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31) | | 3209 | && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31) |
3210 | { | | 3210 | { |
3211 | emit_insn (gen_movsi (operands[0], const0_rtx)); | | 3211 | emit_insn (gen_movsi (operands[0], const0_rtx)); |
3212 | DONE; | | 3212 | DONE; |
3213 | } | | 3213 | } |
3214 | " | | 3214 | " |
3215 | ) | | 3215 | ) |
3216 | | | 3216 | |
3217 | (define_insn "*thumb1_ashlsi3" | | 3217 | (define_insn "*thumb1_ashlsi3" |
3218 | [(set (match_operand:SI 0 "register_operand" "=l,l") | | 3218 | [(set (match_operand:SI 0 "register_operand" "=l,l") |
3219 | (ashift:SI (match_operand:SI 1 "register_operand" "l,0") | | 3219 | (ashift:SI (match_operand:SI 1 "register_operand" "l,0") |
3220 | (match_operand:SI 2 "nonmemory_operand" "N,l")))] | | 3220 | (match_operand:SI 2 "nonmemory_operand" "N,l")))] |
3221 | "TARGET_THUMB1" | | 3221 | "TARGET_THUMB1" |
3222 | "lsl\\t%0, %1, %2" | | 3222 | "lsl\\t%0, %1, %2" |
3223 | [(set_attr "length" "2")] | | 3223 | [(set_attr "length" "2")] |
3224 | ) | | 3224 | ) |
3225 | | | 3225 | |
3226 | (define_expand "ashrdi3" | | 3226 | (define_expand "ashrdi3" |
3227 | [(set (match_operand:DI 0 "s_register_operand" "") | | 3227 | [(set (match_operand:DI 0 "s_register_operand" "") |
3228 | (ashiftrt:DI (match_operand:DI 1 "s_register_operand" "") | | 3228 | (ashiftrt:DI (match_operand:DI 1 "s_register_operand" "") |
3229 | (match_operand:SI 2 "reg_or_int_operand" "")))] | | 3229 | (match_operand:SI 2 "reg_or_int_operand" "")))] |
3230 | "TARGET_32BIT" | | 3230 | "TARGET_32BIT" |
3231 | " | | 3231 | " |
3232 | if (GET_CODE (operands[2]) == CONST_INT) | | 3232 | if (GET_CODE (operands[2]) == CONST_INT) |
3233 | { | | 3233 | { |
3234 | if ((HOST_WIDE_INT) INTVAL (operands[2]) == 1) | | 3234 | if ((HOST_WIDE_INT) INTVAL (operands[2]) == 1) |
3235 | { | | 3235 | { |
3236 | emit_insn (gen_arm_ashrdi3_1bit (operands[0], operands[1])); | | 3236 | emit_insn (gen_arm_ashrdi3_1bit (operands[0], operands[1])); |
3237 | DONE; | | 3237 | DONE; |
3238 | } | | 3238 | } |
3239 | /* Ideally we shouldn't fail here if we could know that operands[1] | | 3239 | /* Ideally we shouldn't fail here if we could know that operands[1] |
3240 | ends up already living in an iwmmxt register. Otherwise it's | | 3240 | ends up already living in an iwmmxt register. Otherwise it's |
3241 | cheaper to have the alternate code being generated than moving | | 3241 | cheaper to have the alternate code being generated than moving |
3242 | values to iwmmxt regs and back. */ | | 3242 | values to iwmmxt regs and back. */ |
3243 | FAIL; | | 3243 | FAIL; |
3244 | } | | 3244 | } |
3245 | else if (!TARGET_REALLY_IWMMXT) | | 3245 | else if (!TARGET_REALLY_IWMMXT) |
3246 | FAIL; | | 3246 | FAIL; |
3247 | " | | 3247 | " |
3248 | ) | | 3248 | ) |
3249 | | | 3249 | |
3250 | (define_insn "arm_ashrdi3_1bit" | | 3250 | (define_insn "arm_ashrdi3_1bit" |
3251 | [(set (match_operand:DI 0 "s_register_operand" "=&r,r") | | 3251 | [(set (match_operand:DI 0 "s_register_operand" "=&r,r") |
3252 | (ashiftrt:DI (match_operand:DI 1 "s_register_operand" "0,r") | | 3252 | (ashiftrt:DI (match_operand:DI 1 "s_register_operand" "0,r") |
3253 | (const_int 1))) | | 3253 | (const_int 1))) |
3254 | (clobber (reg:CC CC_REGNUM))] | | 3254 | (clobber (reg:CC CC_REGNUM))] |
3255 | "TARGET_32BIT" | | 3255 | "TARGET_32BIT" |
3256 | "movs\\t%R0, %R1, asr #1\;mov\\t%Q0, %Q1, rrx" | | 3256 | "movs\\t%R0, %R1, asr #1\;mov\\t%Q0, %Q1, rrx" |
3257 | [(set_attr "conds" "clob") | | 3257 | [(set_attr "conds" "clob") |
3258 | (set_attr "length" "8")] | | 3258 | (set_attr "length" "8")] |
3259 | ) | | 3259 | ) |
3260 | | | 3260 | |
3261 | (define_expand "ashrsi3" | | 3261 | (define_expand "ashrsi3" |
3262 | [(set (match_operand:SI 0 "s_register_operand" "") | | 3262 | [(set (match_operand:SI 0 "s_register_operand" "") |
3263 | (ashiftrt:SI (match_operand:SI 1 "s_register_operand" "") | | 3263 | (ashiftrt:SI (match_operand:SI 1 "s_register_operand" "") |
3264 | (match_operand:SI 2 "arm_rhs_operand" "")))] | | 3264 | (match_operand:SI 2 "arm_rhs_operand" "")))] |
3265 | "TARGET_EITHER" | | 3265 | "TARGET_EITHER" |
3266 | " | | 3266 | " |
3267 | if (GET_CODE (operands[2]) == CONST_INT | | 3267 | if (GET_CODE (operands[2]) == CONST_INT |
3268 | && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31) | | 3268 | && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31) |
3269 | operands[2] = GEN_INT (31); | | 3269 | operands[2] = GEN_INT (31); |
3270 | " | | 3270 | " |
3271 | ) | | 3271 | ) |
3272 | | | 3272 | |
3273 | (define_insn "*thumb1_ashrsi3" | | 3273 | (define_insn "*thumb1_ashrsi3" |
3274 | [(set (match_operand:SI 0 "register_operand" "=l,l") | | 3274 | [(set (match_operand:SI 0 "register_operand" "=l,l") |
3275 | (ashiftrt:SI (match_operand:SI 1 "register_operand" "l,0") | | 3275 | (ashiftrt:SI (match_operand:SI 1 "register_operand" "l,0") |
3276 | (match_operand:SI 2 "nonmemory_operand" "N,l")))] | | 3276 | (match_operand:SI 2 "nonmemory_operand" "N,l")))] |
3277 | "TARGET_THUMB1" | | 3277 | "TARGET_THUMB1" |
3278 | "asr\\t%0, %1, %2" | | 3278 | "asr\\t%0, %1, %2" |
3279 | [(set_attr "length" "2")] | | 3279 | [(set_attr "length" "2")] |
3280 | ) | | 3280 | ) |
3281 | | | 3281 | |
3282 | (define_expand "lshrdi3" | | 3282 | (define_expand "lshrdi3" |
3283 | [(set (match_operand:DI 0 "s_register_operand" "") | | 3283 | [(set (match_operand:DI 0 "s_register_operand" "") |
3284 | (lshiftrt:DI (match_operand:DI 1 "s_register_operand" "") | | 3284 | (lshiftrt:DI (match_operand:DI 1 "s_register_operand" "") |
3285 | (match_operand:SI 2 "reg_or_int_operand" "")))] | | 3285 | (match_operand:SI 2 "reg_or_int_operand" "")))] |
3286 | "TARGET_32BIT" | | 3286 | "TARGET_32BIT" |
3287 | " | | 3287 | " |
3288 | if (GET_CODE (operands[2]) == CONST_INT) | | 3288 | if (GET_CODE (operands[2]) == CONST_INT) |
3289 | { | | 3289 | { |
3290 | if ((HOST_WIDE_INT) INTVAL (operands[2]) == 1) | | 3290 | if ((HOST_WIDE_INT) INTVAL (operands[2]) == 1) |
3291 | { | | 3291 | { |
3292 | emit_insn (gen_arm_lshrdi3_1bit (operands[0], operands[1])); | | 3292 | emit_insn (gen_arm_lshrdi3_1bit (operands[0], operands[1])); |
3293 | DONE; | | 3293 | DONE; |
3294 | } | | 3294 | } |
3295 | /* Ideally we shouldn't fail here if we could know that operands[1] | | 3295 | /* Ideally we shouldn't fail here if we could know that operands[1] |
3296 | ends up already living in an iwmmxt register. Otherwise it's | | 3296 | ends up already living in an iwmmxt register. Otherwise it's |
3297 | cheaper to have the alternate code being generated than moving | | 3297 | cheaper to have the alternate code being generated than moving |
3298 | values to iwmmxt regs and back. */ | | 3298 | values to iwmmxt regs and back. */ |
3299 | FAIL; | | 3299 | FAIL; |
3300 | } | | 3300 | } |
3301 | else if (!TARGET_REALLY_IWMMXT) | | 3301 | else if (!TARGET_REALLY_IWMMXT) |
3302 | FAIL; | | 3302 | FAIL; |
3303 | " | | 3303 | " |
3304 | ) | | 3304 | ) |
3305 | | | 3305 | |
3306 | (define_insn "arm_lshrdi3_1bit" | | 3306 | (define_insn "arm_lshrdi3_1bit" |
3307 | [(set (match_operand:DI 0 "s_register_operand" "=&r,r") | | 3307 | [(set (match_operand:DI 0 "s_register_operand" "=&r,r") |
3308 | (lshiftrt:DI (match_operand:DI 1 "s_register_operand" "0,r") | | 3308 | (lshiftrt:DI (match_operand:DI 1 "s_register_operand" "0,r") |
3309 | (const_int 1))) | | 3309 | (const_int 1))) |
3310 | (clobber (reg:CC CC_REGNUM))] | | 3310 | (clobber (reg:CC CC_REGNUM))] |
3311 | "TARGET_32BIT" | | 3311 | "TARGET_32BIT" |
3312 | "movs\\t%R0, %R1, lsr #1\;mov\\t%Q0, %Q1, rrx" | | 3312 | "movs\\t%R0, %R1, lsr #1\;mov\\t%Q0, %Q1, rrx" |
3313 | [(set_attr "conds" "clob") | | 3313 | [(set_attr "conds" "clob") |
3314 | (set_attr "length" "8")] | | 3314 | (set_attr "length" "8")] |
3315 | ) | | 3315 | ) |
3316 | | | 3316 | |
3317 | (define_expand "lshrsi3" | | 3317 | (define_expand "lshrsi3" |
3318 | [(set (match_operand:SI 0 "s_register_operand" "") | | 3318 | [(set (match_operand:SI 0 "s_register_operand" "") |
3319 | (lshiftrt:SI (match_operand:SI 1 "s_register_operand" "") | | 3319 | (lshiftrt:SI (match_operand:SI 1 "s_register_operand" "") |
3320 | (match_operand:SI 2 "arm_rhs_operand" "")))] | | 3320 | (match_operand:SI 2 "arm_rhs_operand" "")))] |
3321 | "TARGET_EITHER" | | 3321 | "TARGET_EITHER" |
3322 | " | | 3322 | " |
3323 | if (GET_CODE (operands[2]) == CONST_INT | | 3323 | if (GET_CODE (operands[2]) == CONST_INT |
3324 | && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31) | | 3324 | && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31) |
3325 | { | | 3325 | { |
3326 | emit_insn (gen_movsi (operands[0], const0_rtx)); | | 3326 | emit_insn (gen_movsi (operands[0], const0_rtx)); |
3327 | DONE; | | 3327 | DONE; |
3328 | } | | 3328 | } |
3329 | " | | 3329 | " |
3330 | ) | | 3330 | ) |
3331 | | | 3331 | |
3332 | (define_insn "*thumb1_lshrsi3" | | 3332 | (define_insn "*thumb1_lshrsi3" |
3333 | [(set (match_operand:SI 0 "register_operand" "=l,l") | | 3333 | [(set (match_operand:SI 0 "register_operand" "=l,l") |
3334 | (lshiftrt:SI (match_operand:SI 1 "register_operand" "l,0") | | 3334 | (lshiftrt:SI (match_operand:SI 1 "register_operand" "l,0") |
3335 | (match_operand:SI 2 "nonmemory_operand" "N,l")))] | | 3335 | (match_operand:SI 2 "nonmemory_operand" "N,l")))] |
3336 | "TARGET_THUMB1" | | 3336 | "TARGET_THUMB1" |
3337 | "lsr\\t%0, %1, %2" | | 3337 | "lsr\\t%0, %1, %2" |
3338 | [(set_attr "length" "2")] | | 3338 | [(set_attr "length" "2")] |
3339 | ) | | 3339 | ) |
3340 | | | 3340 | |
3341 | (define_expand "rotlsi3" | | 3341 | (define_expand "rotlsi3" |
3342 | [(set (match_operand:SI 0 "s_register_operand" "") | | 3342 | [(set (match_operand:SI 0 "s_register_operand" "") |
3343 | (rotatert:SI (match_operand:SI 1 "s_register_operand" "") | | 3343 | (rotatert:SI (match_operand:SI 1 "s_register_operand" "") |
3344 | (match_operand:SI 2 "reg_or_int_operand" "")))] | | 3344 | (match_operand:SI 2 "reg_or_int_operand" "")))] |
3345 | "TARGET_32BIT" | | 3345 | "TARGET_32BIT" |
3346 | " | | 3346 | " |
3347 | if (GET_CODE (operands[2]) == CONST_INT) | | 3347 | if (GET_CODE (operands[2]) == CONST_INT) |
3348 | operands[2] = GEN_INT ((32 - INTVAL (operands[2])) % 32); | | 3348 | operands[2] = GEN_INT ((32 - INTVAL (operands[2])) % 32); |
3349 | else | | 3349 | else |
3350 | { | | 3350 | { |
3351 | rtx reg = gen_reg_rtx (SImode); | | 3351 | rtx reg = gen_reg_rtx (SImode); |
3352 | emit_insn (gen_subsi3 (reg, GEN_INT (32), operands[2])); | | 3352 | emit_insn (gen_subsi3 (reg, GEN_INT (32), operands[2])); |
3353 | operands[2] = reg; | | 3353 | operands[2] = reg; |
3354 | } | | 3354 | } |
3355 | " | | 3355 | " |
3356 | ) | | 3356 | ) |
3357 | | | 3357 | |
3358 | (define_expand "rotrsi3" | | 3358 | (define_expand "rotrsi3" |
3359 | [(set (match_operand:SI 0 "s_register_operand" "") | | 3359 | [(set (match_operand:SI 0 "s_register_operand" "") |
3360 | (rotatert:SI (match_operand:SI 1 "s_register_operand" "") | | 3360 | (rotatert:SI (match_operand:SI 1 "s_register_operand" "") |
3361 | (match_operand:SI 2 "arm_rhs_operand" "")))] | | 3361 | (match_operand:SI 2 "arm_rhs_operand" "")))] |
3362 | "TARGET_EITHER" | | 3362 | "TARGET_EITHER" |
3363 | " | | 3363 | " |
3364 | if (TARGET_32BIT) | | 3364 | if (TARGET_32BIT) |
3365 | { | | 3365 | { |
3366 | if (GET_CODE (operands[2]) == CONST_INT | | 3366 | if (GET_CODE (operands[2]) == CONST_INT |
3367 | && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31) | | 3367 | && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31) |
3368 | operands[2] = GEN_INT (INTVAL (operands[2]) % 32); | | 3368 | operands[2] = GEN_INT (INTVAL (operands[2]) % 32); |
3369 | } | | 3369 | } |
3370 | else /* TARGET_THUMB1 */ | | 3370 | else /* TARGET_THUMB1 */ |
3371 | { | | 3371 | { |
3372 | if (GET_CODE (operands [2]) == CONST_INT) | | 3372 | if (GET_CODE (operands [2]) == CONST_INT) |
3373 | operands [2] = force_reg (SImode, operands[2]); | | 3373 | operands [2] = force_reg (SImode, operands[2]); |
3374 | } | | 3374 | } |
3375 | " | | 3375 | " |
3376 | ) | | 3376 | ) |
3377 | | | 3377 | |
3378 | (define_insn "*thumb1_rotrsi3" | | 3378 | (define_insn "*thumb1_rotrsi3" |
3379 | [(set (match_operand:SI 0 "register_operand" "=l") | | 3379 | [(set (match_operand:SI 0 "register_operand" "=l") |
3380 | (rotatert:SI (match_operand:SI 1 "register_operand" "0") | | 3380 | (rotatert:SI (match_operand:SI 1 "register_operand" "0") |
3381 | (match_operand:SI 2 "register_operand" "l")))] | | 3381 | (match_operand:SI 2 "register_operand" "l")))] |
3382 | "TARGET_THUMB1" | | 3382 | "TARGET_THUMB1" |
3383 | "ror\\t%0, %0, %2" | | 3383 | "ror\\t%0, %0, %2" |
3384 | [(set_attr "length" "2")] | | 3384 | [(set_attr "length" "2")] |
3385 | ) | | 3385 | ) |
3386 | | | 3386 | |
3387 | (define_insn "*arm_shiftsi3" | | 3387 | (define_insn "*arm_shiftsi3" |
3388 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 3388 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
3389 | (match_operator:SI 3 "shift_operator" | | 3389 | (match_operator:SI 3 "shift_operator" |
3390 | [(match_operand:SI 1 "s_register_operand" "r") | | 3390 | [(match_operand:SI 1 "s_register_operand" "r") |
3391 | (match_operand:SI 2 "reg_or_int_operand" "rM")]))] | | 3391 | (match_operand:SI 2 "reg_or_int_operand" "rM")]))] |
3392 | "TARGET_32BIT" | | 3392 | "TARGET_32BIT" |
3393 | "* return arm_output_shift(operands, 0);" | | 3393 | "* return arm_output_shift(operands, 0);" |
3394 | [(set_attr "predicable" "yes") | | 3394 | [(set_attr "predicable" "yes") |
3395 | (set_attr "shift" "1") | | 3395 | (set_attr "shift" "1") |
3396 | (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") | | 3396 | (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") |
3397 | (const_string "alu_shift") | | 3397 | (const_string "alu_shift") |
3398 | (const_string "alu_shift_reg")))] | | 3398 | (const_string "alu_shift_reg")))] |
3399 | ) | | 3399 | ) |
3400 | | | 3400 | |
3401 | (define_insn "*shiftsi3_compare0" | | 3401 | (define_insn "*shiftsi3_compare0" |
3402 | [(set (reg:CC_NOOV CC_REGNUM) | | 3402 | [(set (reg:CC_NOOV CC_REGNUM) |
3403 | (compare:CC_NOOV (match_operator:SI 3 "shift_operator" | | 3403 | (compare:CC_NOOV (match_operator:SI 3 "shift_operator" |
3404 | [(match_operand:SI 1 "s_register_operand" "r") | | 3404 | [(match_operand:SI 1 "s_register_operand" "r") |
3405 | (match_operand:SI 2 "arm_rhs_operand" "rM")]) | | 3405 | (match_operand:SI 2 "arm_rhs_operand" "rM")]) |
3406 | (const_int 0))) | | 3406 | (const_int 0))) |
3407 | (set (match_operand:SI 0 "s_register_operand" "=r") | | 3407 | (set (match_operand:SI 0 "s_register_operand" "=r") |
3408 | (match_op_dup 3 [(match_dup 1) (match_dup 2)]))] | | 3408 | (match_op_dup 3 [(match_dup 1) (match_dup 2)]))] |
3409 | "TARGET_32BIT" | | 3409 | "TARGET_32BIT" |
3410 | "* return arm_output_shift(operands, 1);" | | 3410 | "* return arm_output_shift(operands, 1);" |
3411 | [(set_attr "conds" "set") | | 3411 | [(set_attr "conds" "set") |
3412 | (set_attr "shift" "1") | | 3412 | (set_attr "shift" "1") |
3413 | (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") | | 3413 | (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") |
3414 | (const_string "alu_shift") | | 3414 | (const_string "alu_shift") |
3415 | (const_string "alu_shift_reg")))] | | 3415 | (const_string "alu_shift_reg")))] |
3416 | ) | | 3416 | ) |
3417 | | | 3417 | |
3418 | (define_insn "*shiftsi3_compare0_scratch" | | 3418 | (define_insn "*shiftsi3_compare0_scratch" |
3419 | [(set (reg:CC_NOOV CC_REGNUM) | | 3419 | [(set (reg:CC_NOOV CC_REGNUM) |
3420 | (compare:CC_NOOV (match_operator:SI 3 "shift_operator" | | 3420 | (compare:CC_NOOV (match_operator:SI 3 "shift_operator" |
3421 | [(match_operand:SI 1 "s_register_operand" "r") | | 3421 | [(match_operand:SI 1 "s_register_operand" "r") |
3422 | (match_operand:SI 2 "arm_rhs_operand" "rM")]) | | 3422 | (match_operand:SI 2 "arm_rhs_operand" "rM")]) |
3423 | (const_int 0))) | | 3423 | (const_int 0))) |
3424 | (clobber (match_scratch:SI 0 "=r"))] | | 3424 | (clobber (match_scratch:SI 0 "=r"))] |
3425 | "TARGET_32BIT" | | 3425 | "TARGET_32BIT" |
3426 | "* return arm_output_shift(operands, 1);" | | 3426 | "* return arm_output_shift(operands, 1);" |
3427 | [(set_attr "conds" "set") | | 3427 | [(set_attr "conds" "set") |
3428 | (set_attr "shift" "1")] | | 3428 | (set_attr "shift" "1")] |
3429 | ) | | 3429 | ) |
3430 | | | 3430 | |
3431 | (define_insn "*arm_notsi_shiftsi" | | 3431 | (define_insn "*arm_notsi_shiftsi" |
3432 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 3432 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
3433 | (not:SI (match_operator:SI 3 "shift_operator" | | 3433 | (not:SI (match_operator:SI 3 "shift_operator" |
3434 | [(match_operand:SI 1 "s_register_operand" "r") | | 3434 | [(match_operand:SI 1 "s_register_operand" "r") |
3435 | (match_operand:SI 2 "arm_rhs_operand" "rM")])))] | | 3435 | (match_operand:SI 2 "arm_rhs_operand" "rM")])))] |
3436 | "TARGET_ARM" | | 3436 | "TARGET_ARM" |
3437 | "mvn%?\\t%0, %1%S3" | | 3437 | "mvn%?\\t%0, %1%S3" |
3438 | [(set_attr "predicable" "yes") | | 3438 | [(set_attr "predicable" "yes") |
3439 | (set_attr "shift" "1") | | 3439 | (set_attr "shift" "1") |
3440 | (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") | | 3440 | (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") |
3441 | (const_string "alu_shift") | | 3441 | (const_string "alu_shift") |
3442 | (const_string "alu_shift_reg")))] | | 3442 | (const_string "alu_shift_reg")))] |
3443 | ) | | 3443 | ) |
3444 | | | 3444 | |
3445 | (define_insn "*arm_notsi_shiftsi_compare0" | | 3445 | (define_insn "*arm_notsi_shiftsi_compare0" |
3446 | [(set (reg:CC_NOOV CC_REGNUM) | | 3446 | [(set (reg:CC_NOOV CC_REGNUM) |
3447 | (compare:CC_NOOV (not:SI (match_operator:SI 3 "shift_operator" | | 3447 | (compare:CC_NOOV (not:SI (match_operator:SI 3 "shift_operator" |
3448 | [(match_operand:SI 1 "s_register_operand" "r") | | 3448 | [(match_operand:SI 1 "s_register_operand" "r") |
3449 | (match_operand:SI 2 "arm_rhs_operand" "rM")])) | | 3449 | (match_operand:SI 2 "arm_rhs_operand" "rM")])) |
3450 | (const_int 0))) | | 3450 | (const_int 0))) |
3451 | (set (match_operand:SI 0 "s_register_operand" "=r") | | 3451 | (set (match_operand:SI 0 "s_register_operand" "=r") |
3452 | (not:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)])))] | | 3452 | (not:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)])))] |
3453 | "TARGET_ARM" | | 3453 | "TARGET_ARM" |
3454 | "mvn%.\\t%0, %1%S3" | | 3454 | "mvn%.\\t%0, %1%S3" |
3455 | [(set_attr "conds" "set") | | 3455 | [(set_attr "conds" "set") |
3456 | (set_attr "shift" "1") | | 3456 | (set_attr "shift" "1") |
3457 | (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") | | 3457 | (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") |
3458 | (const_string "alu_shift") | | 3458 | (const_string "alu_shift") |
3459 | (const_string "alu_shift_reg")))] | | 3459 | (const_string "alu_shift_reg")))] |
3460 | ) | | 3460 | ) |
3461 | | | 3461 | |
3462 | (define_insn "*arm_not_shiftsi_compare0_scratch" | | 3462 | (define_insn "*arm_not_shiftsi_compare0_scratch" |
3463 | [(set (reg:CC_NOOV CC_REGNUM) | | 3463 | [(set (reg:CC_NOOV CC_REGNUM) |
3464 | (compare:CC_NOOV (not:SI (match_operator:SI 3 "shift_operator" | | 3464 | (compare:CC_NOOV (not:SI (match_operator:SI 3 "shift_operator" |
3465 | [(match_operand:SI 1 "s_register_operand" "r") | | 3465 | [(match_operand:SI 1 "s_register_operand" "r") |
3466 | (match_operand:SI 2 "arm_rhs_operand" "rM")])) | | 3466 | (match_operand:SI 2 "arm_rhs_operand" "rM")])) |
3467 | (const_int 0))) | | 3467 | (const_int 0))) |
3468 | (clobber (match_scratch:SI 0 "=r"))] | | 3468 | (clobber (match_scratch:SI 0 "=r"))] |
3469 | "TARGET_ARM" | | 3469 | "TARGET_ARM" |
3470 | "mvn%.\\t%0, %1%S3" | | 3470 | "mvn%.\\t%0, %1%S3" |
3471 | [(set_attr "conds" "set") | | 3471 | [(set_attr "conds" "set") |
3472 | (set_attr "shift" "1") | | 3472 | (set_attr "shift" "1") |
3473 | (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") | | 3473 | (set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") |
3474 | (const_string "alu_shift") | | 3474 | (const_string "alu_shift") |
3475 | (const_string "alu_shift_reg")))] | | 3475 | (const_string "alu_shift_reg")))] |
3476 | ) | | 3476 | ) |
3477 | | | 3477 | |
3478 | ;; We don't really have extzv, but defining this using shifts helps | | 3478 | ;; We don't really have extzv, but defining this using shifts helps |
3479 | ;; to reduce register pressure later on. | | 3479 | ;; to reduce register pressure later on. |
3480 | | | 3480 | |
3481 | (define_expand "extzv" | | 3481 | (define_expand "extzv" |
3482 | [(set (match_dup 4) | | 3482 | [(set (match_dup 4) |
3483 | (ashift:SI (match_operand:SI 1 "register_operand" "") | | 3483 | (ashift:SI (match_operand:SI 1 "register_operand" "") |
3484 | (match_operand:SI 2 "const_int_operand" ""))) | | 3484 | (match_operand:SI 2 "const_int_operand" ""))) |
3485 | (set (match_operand:SI 0 "register_operand" "") | | 3485 | (set (match_operand:SI 0 "register_operand" "") |
3486 | (lshiftrt:SI (match_dup 4) | | 3486 | (lshiftrt:SI (match_dup 4) |
3487 | (match_operand:SI 3 "const_int_operand" "")))] | | 3487 | (match_operand:SI 3 "const_int_operand" "")))] |
3488 | "TARGET_THUMB1 || arm_arch_thumb2" | | 3488 | "TARGET_THUMB1 || arm_arch_thumb2" |
3489 | " | | 3489 | " |
3490 | { | | 3490 | { |
3491 | HOST_WIDE_INT lshift = 32 - INTVAL (operands[2]) - INTVAL (operands[3]); | | 3491 | HOST_WIDE_INT lshift = 32 - INTVAL (operands[2]) - INTVAL (operands[3]); |
3492 | HOST_WIDE_INT rshift = 32 - INTVAL (operands[2]); | | 3492 | HOST_WIDE_INT rshift = 32 - INTVAL (operands[2]); |
3493 | | | 3493 | |
3494 | if (arm_arch_thumb2) | | 3494 | if (arm_arch_thumb2) |
3495 | { | | 3495 | { |
3496 | emit_insn (gen_extzv_t2 (operands[0], operands[1], operands[2], | | 3496 | emit_insn (gen_extzv_t2 (operands[0], operands[1], operands[2], |
3497 | operands[3])); | | 3497 | operands[3])); |
3498 | DONE; | | 3498 | DONE; |
3499 | } | | 3499 | } |
3500 | | | 3500 | |
3501 | operands[3] = GEN_INT (rshift); | | 3501 | operands[3] = GEN_INT (rshift); |
3502 | | | 3502 | |
3503 | if (lshift == 0) | | 3503 | if (lshift == 0) |
3504 | { | | 3504 | { |
3505 | emit_insn (gen_lshrsi3 (operands[0], operands[1], operands[3])); | | 3505 | emit_insn (gen_lshrsi3 (operands[0], operands[1], operands[3])); |
3506 | DONE; | | 3506 | DONE; |
3507 | } | | 3507 | } |
3508 | | | 3508 | |
3509 | operands[2] = GEN_INT (lshift); | | 3509 | operands[2] = GEN_INT (lshift); |
3510 | operands[4] = gen_reg_rtx (SImode); | | 3510 | operands[4] = gen_reg_rtx (SImode); |
3511 | }" | | 3511 | }" |
3512 | ) | | 3512 | ) |
3513 | | | 3513 | |
3514 | (define_insn "extv" | | 3514 | (define_insn "extv" |
3515 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 3515 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
3516 | (sign_extract:SI (match_operand:SI 1 "s_register_operand" "r") | | 3516 | (sign_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
3517 | (match_operand:SI 2 "const_int_operand" "M") | | 3517 | (match_operand:SI 2 "const_int_operand" "M") |
3518 | (match_operand:SI 3 "const_int_operand" "M")))] | | 3518 | (match_operand:SI 3 "const_int_operand" "M")))] |
3519 | "arm_arch_thumb2" | | 3519 | "arm_arch_thumb2" |
3520 | "sbfx%?\t%0, %1, %3, %2" | | 3520 | "sbfx%?\t%0, %1, %3, %2" |
3521 | [(set_attr "length" "4") | | 3521 | [(set_attr "length" "4") |
3522 | (set_attr "predicable" "yes")] | | 3522 | (set_attr "predicable" "yes")] |
3523 | ) | | 3523 | ) |
3524 | | | 3524 | |
3525 | (define_insn "extzv_t2" | | 3525 | (define_insn "extzv_t2" |
3526 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 3526 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
3527 | (zero_extract:SI (match_operand:SI 1 "s_register_operand" "r") | | 3527 | (zero_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
3528 | (match_operand:SI 2 "const_int_operand" "M") | | 3528 | (match_operand:SI 2 "const_int_operand" "M") |
3529 | (match_operand:SI 3 "const_int_operand" "M")))] | | 3529 | (match_operand:SI 3 "const_int_operand" "M")))] |
3530 | "arm_arch_thumb2" | | 3530 | "arm_arch_thumb2" |
3531 | "ubfx%?\t%0, %1, %3, %2" | | 3531 | "ubfx%?\t%0, %1, %3, %2" |
3532 | [(set_attr "length" "4") | | 3532 | [(set_attr "length" "4") |
3533 | (set_attr "predicable" "yes")] | | 3533 | (set_attr "predicable" "yes")] |
3534 | ) | | 3534 | ) |
3535 | | | 3535 | |
3536 | | | 3536 | |
3537 | ;; Unary arithmetic insns | | 3537 | ;; Unary arithmetic insns |
3538 | | | 3538 | |
3539 | (define_expand "negdi2" | | 3539 | (define_expand "negdi2" |
3540 | [(parallel | | 3540 | [(parallel |
3541 | [(set (match_operand:DI 0 "s_register_operand" "") | | 3541 | [(set (match_operand:DI 0 "s_register_operand" "") |
3542 | (neg:DI (match_operand:DI 1 "s_register_operand" ""))) | | 3542 | (neg:DI (match_operand:DI 1 "s_register_operand" ""))) |
3543 | (clobber (reg:CC CC_REGNUM))])] | | 3543 | (clobber (reg:CC CC_REGNUM))])] |
3544 | "TARGET_EITHER" | | 3544 | "TARGET_EITHER" |
3545 | " | | 3545 | " |
3546 | if (TARGET_THUMB1) | | 3546 | if (TARGET_THUMB1) |
3547 | { | | 3547 | { |
3548 | if (GET_CODE (operands[1]) != REG) | | 3548 | if (GET_CODE (operands[1]) != REG) |
3549 | operands[1] = force_reg (DImode, operands[1]); | | 3549 | operands[1] = force_reg (DImode, operands[1]); |
3550 | } | | 3550 | } |
3551 | " | | 3551 | " |
3552 | ) | | 3552 | ) |
3553 | | | 3553 | |
3554 | ;; The constraints here are to prevent a *partial* overlap (where %Q0 == %R1). | | 3554 | ;; The constraints here are to prevent a *partial* overlap (where %Q0 == %R1). |
3555 | ;; The first alternative allows the common case of a *full* overlap. | | 3555 | ;; The first alternative allows the common case of a *full* overlap. |
3556 | (define_insn "*arm_negdi2" | | 3556 | (define_insn "*arm_negdi2" |
3557 | [(set (match_operand:DI 0 "s_register_operand" "=r,&r") | | 3557 | [(set (match_operand:DI 0 "s_register_operand" "=r,&r") |
3558 | (neg:DI (match_operand:DI 1 "s_register_operand" "0,r"))) | | 3558 | (neg:DI (match_operand:DI 1 "s_register_operand" "0,r"))) |
3559 | (clobber (reg:CC CC_REGNUM))] | | 3559 | (clobber (reg:CC CC_REGNUM))] |
3560 | "TARGET_ARM" | | 3560 | "TARGET_ARM" |
3561 | "rsbs\\t%Q0, %Q1, #0\;rsc\\t%R0, %R1, #0" | | 3561 | "rsbs\\t%Q0, %Q1, #0\;rsc\\t%R0, %R1, #0" |
3562 | [(set_attr "conds" "clob") | | 3562 | [(set_attr "conds" "clob") |
3563 | (set_attr "length" "8")] | | 3563 | (set_attr "length" "8")] |
3564 | ) | | 3564 | ) |
3565 | | | 3565 | |
3566 | (define_insn "*thumb1_negdi2" | | 3566 | (define_insn "*thumb1_negdi2" |
3567 | [(set (match_operand:DI 0 "register_operand" "=&l") | | 3567 | [(set (match_operand:DI 0 "register_operand" "=&l") |
3568 | (neg:DI (match_operand:DI 1 "register_operand" "l"))) | | 3568 | (neg:DI (match_operand:DI 1 "register_operand" "l"))) |
3569 | (clobber (reg:CC CC_REGNUM))] | | 3569 | (clobber (reg:CC CC_REGNUM))] |
3570 | "TARGET_THUMB1" | | 3570 | "TARGET_THUMB1" |
3571 | "mov\\t%R0, #0\;neg\\t%Q0, %Q1\;sbc\\t%R0, %R1" | | 3571 | "mov\\t%R0, #0\;neg\\t%Q0, %Q1\;sbc\\t%R0, %R1" |
3572 | [(set_attr "length" "6")] | | 3572 | [(set_attr "length" "6")] |
3573 | ) | | 3573 | ) |
3574 | | | 3574 | |
3575 | (define_expand "negsi2" | | 3575 | (define_expand "negsi2" |
3576 | [(set (match_operand:SI 0 "s_register_operand" "") | | 3576 | [(set (match_operand:SI 0 "s_register_operand" "") |
3577 | (neg:SI (match_operand:SI 1 "s_register_operand" "")))] | | 3577 | (neg:SI (match_operand:SI 1 "s_register_operand" "")))] |
3578 | "TARGET_EITHER" | | 3578 | "TARGET_EITHER" |
3579 | "" | | 3579 | "" |
3580 | ) | | 3580 | ) |
3581 | | | 3581 | |
3582 | (define_insn "*arm_negsi2" | | 3582 | (define_insn "*arm_negsi2" |
3583 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 3583 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
3584 | (neg:SI (match_operand:SI 1 "s_register_operand" "r")))] | | 3584 | (neg:SI (match_operand:SI 1 "s_register_operand" "r")))] |
3585 | "TARGET_32BIT" | | 3585 | "TARGET_32BIT" |
3586 | "rsb%?\\t%0, %1, #0" | | 3586 | "rsb%?\\t%0, %1, #0" |
3587 | [(set_attr "predicable" "yes")] | | 3587 | [(set_attr "predicable" "yes")] |
3588 | ) | | 3588 | ) |
3589 | | | 3589 | |
3590 | (define_insn "*thumb1_negsi2" | | 3590 | (define_insn "*thumb1_negsi2" |
3591 | [(set (match_operand:SI 0 "register_operand" "=l") | | 3591 | [(set (match_operand:SI 0 "register_operand" "=l") |
3592 | (neg:SI (match_operand:SI 1 "register_operand" "l")))] | | 3592 | (neg:SI (match_operand:SI 1 "register_operand" "l")))] |
3593 | "TARGET_THUMB1" | | 3593 | "TARGET_THUMB1" |
3594 | "neg\\t%0, %1" | | 3594 | "neg\\t%0, %1" |
3595 | [(set_attr "length" "2")] | | 3595 | [(set_attr "length" "2")] |
3596 | ) | | 3596 | ) |
3597 | | | 3597 | |
3598 | (define_expand "negsf2" | | 3598 | (define_expand "negsf2" |
3599 | [(set (match_operand:SF 0 "s_register_operand" "") | | 3599 | [(set (match_operand:SF 0 "s_register_operand" "") |
3600 | (neg:SF (match_operand:SF 1 "s_register_operand" "")))] | | 3600 | (neg:SF (match_operand:SF 1 "s_register_operand" "")))] |
3601 | "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" | | 3601 | "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" |
3602 | "" | | 3602 | "" |
3603 | ) | | 3603 | ) |
3604 | | | 3604 | |
3605 | (define_expand "negdf2" | | 3605 | (define_expand "negdf2" |
3606 | [(set (match_operand:DF 0 "s_register_operand" "") | | 3606 | [(set (match_operand:DF 0 "s_register_operand" "") |
3607 | (neg:DF (match_operand:DF 1 "s_register_operand" "")))] | | 3607 | (neg:DF (match_operand:DF 1 "s_register_operand" "")))] |
3608 | "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP_DOUBLE)" | | 3608 | "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP_DOUBLE)" |
3609 | "") | | 3609 | "") |
3610 | | | 3610 | |
3611 | ;; abssi2 doesn't really clobber the condition codes if a different register | | 3611 | ;; abssi2 doesn't really clobber the condition codes if a different register |
3612 | ;; is being set. To keep things simple, assume during rtl manipulations that | | 3612 | ;; is being set. To keep things simple, assume during rtl manipulations that |
3613 | ;; it does, but tell the final scan operator the truth. Similarly for | | 3613 | ;; it does, but tell the final scan operator the truth. Similarly for |
3614 | ;; (neg (abs...)) | | 3614 | ;; (neg (abs...)) |
3615 | | | 3615 | |
3616 | (define_expand "abssi2" | | 3616 | (define_expand "abssi2" |
3617 | [(parallel | | 3617 | [(parallel |
3618 | [(set (match_operand:SI 0 "s_register_operand" "") | | 3618 | [(set (match_operand:SI 0 "s_register_operand" "") |
3619 | (abs:SI (match_operand:SI 1 "s_register_operand" ""))) | | 3619 | (abs:SI (match_operand:SI 1 "s_register_operand" ""))) |
3620 | (clobber (match_dup 2))])] | | 3620 | (clobber (match_dup 2))])] |
3621 | "TARGET_EITHER" | | 3621 | "TARGET_EITHER" |
3622 | " | | 3622 | " |
3623 | if (TARGET_THUMB1) | | 3623 | if (TARGET_THUMB1) |
3624 | operands[2] = gen_rtx_SCRATCH (SImode); | | 3624 | operands[2] = gen_rtx_SCRATCH (SImode); |
3625 | else | | 3625 | else |
3626 | operands[2] = gen_rtx_REG (CCmode, CC_REGNUM); | | 3626 | operands[2] = gen_rtx_REG (CCmode, CC_REGNUM); |
3627 | ") | | 3627 | ") |
3628 | | | 3628 | |
3629 | (define_insn "*arm_abssi2" | | 3629 | (define_insn "*arm_abssi2" |
3630 | [(set (match_operand:SI 0 "s_register_operand" "=r,&r") | | 3630 | [(set (match_operand:SI 0 "s_register_operand" "=r,&r") |
3631 | (abs:SI (match_operand:SI 1 "s_register_operand" "0,r"))) | | 3631 | (abs:SI (match_operand:SI 1 "s_register_operand" "0,r"))) |
3632 | (clobber (reg:CC CC_REGNUM))] | | 3632 | (clobber (reg:CC CC_REGNUM))] |
3633 | "TARGET_ARM" | | 3633 | "TARGET_ARM" |
3634 | "@ | | 3634 | "@ |
3635 | cmp\\t%0, #0\;rsblt\\t%0, %0, #0 | | 3635 | cmp\\t%0, #0\;rsblt\\t%0, %0, #0 |
3636 | eor%?\\t%0, %1, %1, asr #31\;sub%?\\t%0, %0, %1, asr #31" | | 3636 | eor%?\\t%0, %1, %1, asr #31\;sub%?\\t%0, %0, %1, asr #31" |
3637 | [(set_attr "conds" "clob,*") | | 3637 | [(set_attr "conds" "clob,*") |
3638 | (set_attr "shift" "1") | | 3638 | (set_attr "shift" "1") |
3639 | ;; predicable can't be set based on the variant, so left as no | | 3639 | ;; predicable can't be set based on the variant, so left as no |
3640 | (set_attr "length" "8")] | | 3640 | (set_attr "length" "8")] |
3641 | ) | | 3641 | ) |
3642 | | | 3642 | |
3643 | (define_insn_and_split "*thumb1_abssi2" | | 3643 | (define_insn_and_split "*thumb1_abssi2" |
3644 | [(set (match_operand:SI 0 "s_register_operand" "=l") | | 3644 | [(set (match_operand:SI 0 "s_register_operand" "=l") |
3645 | (abs:SI (match_operand:SI 1 "s_register_operand" "l"))) | | 3645 | (abs:SI (match_operand:SI 1 "s_register_operand" "l"))) |
3646 | (clobber (match_scratch:SI 2 "=&l"))] | | 3646 | (clobber (match_scratch:SI 2 "=&l"))] |
3647 | "TARGET_THUMB1" | | 3647 | "TARGET_THUMB1" |
3648 | "#" | | 3648 | "#" |
3649 | "TARGET_THUMB1 && reload_completed" | | 3649 | "TARGET_THUMB1 && reload_completed" |
3650 | [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31))) | | 3650 | [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31))) |
3651 | (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2))) | | 3651 | (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2))) |
3652 | (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 2)))] | | 3652 | (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 2)))] |
3653 | "" | | 3653 | "" |
3654 | [(set_attr "length" "6")] | | 3654 | [(set_attr "length" "6")] |
3655 | ) | | 3655 | ) |
3656 | | | 3656 | |
3657 | (define_insn "*arm_neg_abssi2" | | 3657 | (define_insn "*arm_neg_abssi2" |
3658 | [(set (match_operand:SI 0 "s_register_operand" "=r,&r") | | 3658 | [(set (match_operand:SI 0 "s_register_operand" "=r,&r") |
3659 | (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "0,r")))) | | 3659 | (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "0,r")))) |
3660 | (clobber (reg:CC CC_REGNUM))] | | 3660 | (clobber (reg:CC CC_REGNUM))] |
3661 | "TARGET_ARM" | | 3661 | "TARGET_ARM" |
3662 | "@ | | 3662 | "@ |
3663 | cmp\\t%0, #0\;rsbgt\\t%0, %0, #0 | | 3663 | cmp\\t%0, #0\;rsbgt\\t%0, %0, #0 |
3664 | eor%?\\t%0, %1, %1, asr #31\;rsb%?\\t%0, %0, %1, asr #31" | | 3664 | eor%?\\t%0, %1, %1, asr #31\;rsb%?\\t%0, %0, %1, asr #31" |
3665 | [(set_attr "conds" "clob,*") | | 3665 | [(set_attr "conds" "clob,*") |
3666 | (set_attr "shift" "1") | | 3666 | (set_attr "shift" "1") |
3667 | ;; predicable can't be set based on the variant, so left as no | | 3667 | ;; predicable can't be set based on the variant, so left as no |
3668 | (set_attr "length" "8")] | | 3668 | (set_attr "length" "8")] |
3669 | ) | | 3669 | ) |
3670 | | | 3670 | |
3671 | (define_insn_and_split "*thumb1_neg_abssi2" | | 3671 | (define_insn_and_split "*thumb1_neg_abssi2" |
3672 | [(set (match_operand:SI 0 "s_register_operand" "=l") | | 3672 | [(set (match_operand:SI 0 "s_register_operand" "=l") |
3673 | (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "l")))) | | 3673 | (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "l")))) |
3674 | (clobber (match_scratch:SI 2 "=&l"))] | | 3674 | (clobber (match_scratch:SI 2 "=&l"))] |
3675 | "TARGET_THUMB1" | | 3675 | "TARGET_THUMB1" |
3676 | "#" | | 3676 | "#" |
3677 | "TARGET_THUMB1 && reload_completed" | | 3677 | "TARGET_THUMB1 && reload_completed" |
3678 | [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31))) | | 3678 | [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31))) |
3679 | (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 1))) | | 3679 | (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 1))) |
3680 | (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 2)))] | | 3680 | (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 2)))] |
3681 | "" | | 3681 | "" |
3682 | [(set_attr "length" "6")] | | 3682 | [(set_attr "length" "6")] |
3683 | ) | | 3683 | ) |
3684 | | | 3684 | |
3685 | (define_expand "abssf2" | | 3685 | (define_expand "abssf2" |
3686 | [(set (match_operand:SF 0 "s_register_operand" "") | | 3686 | [(set (match_operand:SF 0 "s_register_operand" "") |
3687 | (abs:SF (match_operand:SF 1 "s_register_operand" "")))] | | 3687 | (abs:SF (match_operand:SF 1 "s_register_operand" "")))] |
3688 | "TARGET_32BIT && TARGET_HARD_FLOAT" | | 3688 | "TARGET_32BIT && TARGET_HARD_FLOAT" |
3689 | "") | | 3689 | "") |
3690 | | | 3690 | |
3691 | (define_expand "absdf2" | | 3691 | (define_expand "absdf2" |
3692 | [(set (match_operand:DF 0 "s_register_operand" "") | | 3692 | [(set (match_operand:DF 0 "s_register_operand" "") |
3693 | (abs:DF (match_operand:DF 1 "s_register_operand" "")))] | | 3693 | (abs:DF (match_operand:DF 1 "s_register_operand" "")))] |
3694 | "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" | | 3694 | "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
3695 | "") | | 3695 | "") |
3696 | | | 3696 | |
3697 | (define_expand "sqrtsf2" | | 3697 | (define_expand "sqrtsf2" |
3698 | [(set (match_operand:SF 0 "s_register_operand" "") | | 3698 | [(set (match_operand:SF 0 "s_register_operand" "") |
3699 | (sqrt:SF (match_operand:SF 1 "s_register_operand" "")))] | | 3699 | (sqrt:SF (match_operand:SF 1 "s_register_operand" "")))] |
3700 | "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" | | 3700 | "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" |
3701 | "") | | 3701 | "") |
3702 | | | 3702 | |
3703 | (define_expand "sqrtdf2" | | 3703 | (define_expand "sqrtdf2" |
3704 | [(set (match_operand:DF 0 "s_register_operand" "") | | 3704 | [(set (match_operand:DF 0 "s_register_operand" "") |
3705 | (sqrt:DF (match_operand:DF 1 "s_register_operand" "")))] | | 3705 | (sqrt:DF (match_operand:DF 1 "s_register_operand" "")))] |
3706 | "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP_DOUBLE)" | | 3706 | "TARGET_32BIT && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP_DOUBLE)" |
3707 | "") | | 3707 | "") |
3708 | | | 3708 | |
3709 | (define_insn_and_split "one_cmpldi2" | | 3709 | (define_insn_and_split "one_cmpldi2" |
3710 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") | | 3710 | [(set (match_operand:DI 0 "s_register_operand" "=&r,&r") |
3711 | (not:DI (match_operand:DI 1 "s_register_operand" "0,r")))] | | 3711 | (not:DI (match_operand:DI 1 "s_register_operand" "0,r")))] |
3712 | "TARGET_32BIT" | | 3712 | "TARGET_32BIT" |
3713 | "#" | | 3713 | "#" |
3714 | "TARGET_32BIT && reload_completed" | | 3714 | "TARGET_32BIT && reload_completed" |
3715 | [(set (match_dup 0) (not:SI (match_dup 1))) | | 3715 | [(set (match_dup 0) (not:SI (match_dup 1))) |
3716 | (set (match_dup 2) (not:SI (match_dup 3)))] | | 3716 | (set (match_dup 2) (not:SI (match_dup 3)))] |
3717 | " | | 3717 | " |
3718 | { | | 3718 | { |
3719 | operands[2] = gen_highpart (SImode, operands[0]); | | 3719 | operands[2] = gen_highpart (SImode, operands[0]); |
3720 | operands[0] = gen_lowpart (SImode, operands[0]); | | 3720 | operands[0] = gen_lowpart (SImode, operands[0]); |
3721 | operands[3] = gen_highpart (SImode, operands[1]); | | 3721 | operands[3] = gen_highpart (SImode, operands[1]); |
3722 | operands[1] = gen_lowpart (SImode, operands[1]); | | 3722 | operands[1] = gen_lowpart (SImode, operands[1]); |
3723 | }" | | 3723 | }" |
3724 | [(set_attr "length" "8") | | 3724 | [(set_attr "length" "8") |
3725 | (set_attr "predicable" "yes")] | | 3725 | (set_attr "predicable" "yes")] |
3726 | ) | | 3726 | ) |
3727 | | | 3727 | |
3728 | (define_expand "one_cmplsi2" | | 3728 | (define_expand "one_cmplsi2" |
3729 | [(set (match_operand:SI 0 "s_register_operand" "") | | 3729 | [(set (match_operand:SI 0 "s_register_operand" "") |
3730 | (not:SI (match_operand:SI 1 "s_register_operand" "")))] | | 3730 | (not:SI (match_operand:SI 1 "s_register_operand" "")))] |
3731 | "TARGET_EITHER" | | 3731 | "TARGET_EITHER" |
3732 | "" | | 3732 | "" |
3733 | ) | | 3733 | ) |
3734 | | | 3734 | |
3735 | (define_insn "*arm_one_cmplsi2" | | 3735 | (define_insn "*arm_one_cmplsi2" |
3736 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 3736 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
3737 | (not:SI (match_operand:SI 1 "s_register_operand" "r")))] | | 3737 | (not:SI (match_operand:SI 1 "s_register_operand" "r")))] |
3738 | "TARGET_32BIT" | | 3738 | "TARGET_32BIT" |
3739 | "mvn%?\\t%0, %1" | | 3739 | "mvn%?\\t%0, %1" |
3740 | [(set_attr "predicable" "yes")] | | 3740 | [(set_attr "predicable" "yes")] |
3741 | ) | | 3741 | ) |
3742 | | | 3742 | |
3743 | (define_insn "*thumb1_one_cmplsi2" | | 3743 | (define_insn "*thumb1_one_cmplsi2" |
3744 | [(set (match_operand:SI 0 "register_operand" "=l") | | 3744 | [(set (match_operand:SI 0 "register_operand" "=l") |
3745 | (not:SI (match_operand:SI 1 "register_operand" "l")))] | | 3745 | (not:SI (match_operand:SI 1 "register_operand" "l")))] |
3746 | "TARGET_THUMB1" | | 3746 | "TARGET_THUMB1" |
3747 | "mvn\\t%0, %1" | | 3747 | "mvn\\t%0, %1" |
3748 | [(set_attr "length" "2")] | | 3748 | [(set_attr "length" "2")] |
3749 | ) | | 3749 | ) |
3750 | | | 3750 | |
3751 | (define_insn "*notsi_compare0" | | 3751 | (define_insn "*notsi_compare0" |
3752 | [(set (reg:CC_NOOV CC_REGNUM) | | 3752 | [(set (reg:CC_NOOV CC_REGNUM) |
3753 | (compare:CC_NOOV (not:SI (match_operand:SI 1 "s_register_operand" "r")) | | 3753 | (compare:CC_NOOV (not:SI (match_operand:SI 1 "s_register_operand" "r")) |
3754 | (const_int 0))) | | 3754 | (const_int 0))) |
3755 | (set (match_operand:SI 0 "s_register_operand" "=r") | | 3755 | (set (match_operand:SI 0 "s_register_operand" "=r") |
3756 | (not:SI (match_dup 1)))] | | 3756 | (not:SI (match_dup 1)))] |
3757 | "TARGET_32BIT" | | 3757 | "TARGET_32BIT" |
3758 | "mvn%.\\t%0, %1" | | 3758 | "mvn%.\\t%0, %1" |
3759 | [(set_attr "conds" "set")] | | 3759 | [(set_attr "conds" "set")] |
3760 | ) | | 3760 | ) |
3761 | | | 3761 | |
3762 | (define_insn "*notsi_compare0_scratch" | | 3762 | (define_insn "*notsi_compare0_scratch" |
3763 | [(set (reg:CC_NOOV CC_REGNUM) | | 3763 | [(set (reg:CC_NOOV CC_REGNUM) |
3764 | (compare:CC_NOOV (not:SI (match_operand:SI 1 "s_register_operand" "r")) | | 3764 | (compare:CC_NOOV (not:SI (match_operand:SI 1 "s_register_operand" "r")) |
3765 | (const_int 0))) | | 3765 | (const_int 0))) |
3766 | (clobber (match_scratch:SI 0 "=r"))] | | 3766 | (clobber (match_scratch:SI 0 "=r"))] |
3767 | "TARGET_32BIT" | | 3767 | "TARGET_32BIT" |
3768 | "mvn%.\\t%0, %1" | | 3768 | "mvn%.\\t%0, %1" |
3769 | [(set_attr "conds" "set")] | | 3769 | [(set_attr "conds" "set")] |
3770 | ) | | 3770 | ) |
3771 | | | 3771 | |
3772 | ;; Fixed <--> Floating conversion insns | | 3772 | ;; Fixed <--> Floating conversion insns |
3773 | | | 3773 | |
3774 | (define_expand "floatsihf2" | | 3774 | (define_expand "floatsihf2" |
3775 | [(set (match_operand:HF 0 "general_operand" "") | | 3775 | [(set (match_operand:HF 0 "general_operand" "") |
3776 | (float:HF (match_operand:SI 1 "general_operand" "")))] | | 3776 | (float:HF (match_operand:SI 1 "general_operand" "")))] |
3777 | "TARGET_EITHER" | | 3777 | "TARGET_EITHER" |
3778 | " | | 3778 | " |
3779 | { | | 3779 | { |
3780 | rtx op1 = gen_reg_rtx (SFmode); | | 3780 | rtx op1 = gen_reg_rtx (SFmode); |
3781 | expand_float (op1, operands[1], 0); | | 3781 | expand_float (op1, operands[1], 0); |
3782 | op1 = convert_to_mode (HFmode, op1, 0); | | 3782 | op1 = convert_to_mode (HFmode, op1, 0); |
3783 | emit_move_insn (operands[0], op1); | | 3783 | emit_move_insn (operands[0], op1); |
3784 | DONE; | | 3784 | DONE; |
3785 | }" | | 3785 | }" |
3786 | ) | | 3786 | ) |
3787 | | | 3787 | |
3788 | (define_expand "floatdihf2" | | 3788 | (define_expand "floatdihf2" |
3789 | [(set (match_operand:HF 0 "general_operand" "") | | 3789 | [(set (match_operand:HF 0 "general_operand" "") |
3790 | (float:HF (match_operand:DI 1 "general_operand" "")))] | | 3790 | (float:HF (match_operand:DI 1 "general_operand" "")))] |
3791 | "TARGET_EITHER" | | 3791 | "TARGET_EITHER" |
3792 | " | | 3792 | " |
3793 | { | | 3793 | { |
3794 | rtx op1 = gen_reg_rtx (SFmode); | | 3794 | rtx op1 = gen_reg_rtx (SFmode); |
3795 | expand_float (op1, operands[1], 0); | | 3795 | expand_float (op1, operands[1], 0); |
3796 | op1 = convert_to_mode (HFmode, op1, 0); | | 3796 | op1 = convert_to_mode (HFmode, op1, 0); |
3797 | emit_move_insn (operands[0], op1); | | 3797 | emit_move_insn (operands[0], op1); |
3798 | DONE; | | 3798 | DONE; |
3799 | }" | | 3799 | }" |
3800 | ) | | 3800 | ) |
3801 | | | 3801 | |
3802 | (define_expand "floatsisf2" | | 3802 | (define_expand "floatsisf2" |
3803 | [(set (match_operand:SF 0 "s_register_operand" "") | | 3803 | [(set (match_operand:SF 0 "s_register_operand" "") |
3804 | (float:SF (match_operand:SI 1 "s_register_operand" "")))] | | 3804 | (float:SF (match_operand:SI 1 "s_register_operand" "")))] |
3805 | "TARGET_32BIT && TARGET_HARD_FLOAT" | | 3805 | "TARGET_32BIT && TARGET_HARD_FLOAT" |
3806 | " | | 3806 | " |
3807 | if (TARGET_MAVERICK) | | 3807 | if (TARGET_MAVERICK) |
3808 | { | | 3808 | { |
3809 | emit_insn (gen_cirrus_floatsisf2 (operands[0], operands[1])); | | 3809 | emit_insn (gen_cirrus_floatsisf2 (operands[0], operands[1])); |
3810 | DONE; | | 3810 | DONE; |
3811 | } | | 3811 | } |
3812 | ") | | 3812 | ") |
3813 | | | 3813 | |
3814 | (define_expand "floatsidf2" | | 3814 | (define_expand "floatsidf2" |
3815 | [(set (match_operand:DF 0 "s_register_operand" "") | | 3815 | [(set (match_operand:DF 0 "s_register_operand" "") |
3816 | (float:DF (match_operand:SI 1 "s_register_operand" "")))] | | 3816 | (float:DF (match_operand:SI 1 "s_register_operand" "")))] |
3817 | "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" | | 3817 | "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
3818 | " | | 3818 | " |
3819 | if (TARGET_MAVERICK) | | 3819 | if (TARGET_MAVERICK) |
3820 | { | | 3820 | { |
3821 | emit_insn (gen_cirrus_floatsidf2 (operands[0], operands[1])); | | 3821 | emit_insn (gen_cirrus_floatsidf2 (operands[0], operands[1])); |
3822 | DONE; | | 3822 | DONE; |
3823 | } | | 3823 | } |
3824 | ") | | 3824 | ") |
3825 | | | 3825 | |
3826 | (define_expand "fix_trunchfsi2" | | 3826 | (define_expand "fix_trunchfsi2" |
3827 | [(set (match_operand:SI 0 "general_operand" "") | | 3827 | [(set (match_operand:SI 0 "general_operand" "") |
3828 | (fix:SI (fix:HF (match_operand:HF 1 "general_operand" ""))))] | | 3828 | (fix:SI (fix:HF (match_operand:HF 1 "general_operand" ""))))] |
3829 | "TARGET_EITHER" | | 3829 | "TARGET_EITHER" |
3830 | " | | 3830 | " |
3831 | { | | 3831 | { |
3832 | rtx op1 = convert_to_mode (SFmode, operands[1], 0); | | 3832 | rtx op1 = convert_to_mode (SFmode, operands[1], 0); |
3833 | expand_fix (operands[0], op1, 0); | | 3833 | expand_fix (operands[0], op1, 0); |
3834 | DONE; | | 3834 | DONE; |
3835 | }" | | 3835 | }" |
3836 | ) | | 3836 | ) |
3837 | | | 3837 | |
3838 | (define_expand "fix_trunchfdi2" | | 3838 | (define_expand "fix_trunchfdi2" |
3839 | [(set (match_operand:DI 0 "general_operand" "") | | 3839 | [(set (match_operand:DI 0 "general_operand" "") |
3840 | (fix:DI (fix:HF (match_operand:HF 1 "general_operand" ""))))] | | 3840 | (fix:DI (fix:HF (match_operand:HF 1 "general_operand" ""))))] |
3841 | "TARGET_EITHER" | | 3841 | "TARGET_EITHER" |
3842 | " | | 3842 | " |
3843 | { | | 3843 | { |
3844 | rtx op1 = convert_to_mode (SFmode, operands[1], 0); | | 3844 | rtx op1 = convert_to_mode (SFmode, operands[1], 0); |
3845 | expand_fix (operands[0], op1, 0); | | 3845 | expand_fix (operands[0], op1, 0); |
3846 | DONE; | | 3846 | DONE; |
3847 | }" | | 3847 | }" |
3848 | ) | | 3848 | ) |
3849 | | | 3849 | |
3850 | (define_expand "fix_truncsfsi2" | | 3850 | (define_expand "fix_truncsfsi2" |
3851 | [(set (match_operand:SI 0 "s_register_operand" "") | | 3851 | [(set (match_operand:SI 0 "s_register_operand" "") |
3852 | (fix:SI (fix:SF (match_operand:SF 1 "s_register_operand" ""))))] | | 3852 | (fix:SI (fix:SF (match_operand:SF 1 "s_register_operand" ""))))] |
3853 | "TARGET_32BIT && TARGET_HARD_FLOAT" | | 3853 | "TARGET_32BIT && TARGET_HARD_FLOAT" |
3854 | " | | 3854 | " |
3855 | if (TARGET_MAVERICK) | | 3855 | if (TARGET_MAVERICK) |
3856 | { | | 3856 | { |
3857 | if (!cirrus_fp_register (operands[0], SImode)) | | 3857 | if (!cirrus_fp_register (operands[0], SImode)) |
3858 | operands[0] = force_reg (SImode, operands[0]); | | 3858 | operands[0] = force_reg (SImode, operands[0]); |
3859 | if (!cirrus_fp_register (operands[1], SFmode)) | | 3859 | if (!cirrus_fp_register (operands[1], SFmode)) |
3860 | operands[1] = force_reg (SFmode, operands[0]); | | 3860 | operands[1] = force_reg (SFmode, operands[0]); |
3861 | emit_insn (gen_cirrus_truncsfsi2 (operands[0], operands[1])); | | 3861 | emit_insn (gen_cirrus_truncsfsi2 (operands[0], operands[1])); |
3862 | DONE; | | 3862 | DONE; |
3863 | } | | 3863 | } |
3864 | ") | | 3864 | ") |
3865 | | | 3865 | |
3866 | (define_expand "fix_truncdfsi2" | | 3866 | (define_expand "fix_truncdfsi2" |
3867 | [(set (match_operand:SI 0 "s_register_operand" "") | | 3867 | [(set (match_operand:SI 0 "s_register_operand" "") |
3868 | (fix:SI (fix:DF (match_operand:DF 1 "s_register_operand" ""))))] | | 3868 | (fix:SI (fix:DF (match_operand:DF 1 "s_register_operand" ""))))] |
3869 | "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" | | 3869 | "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
3870 | " | | 3870 | " |
3871 | if (TARGET_MAVERICK) | | 3871 | if (TARGET_MAVERICK) |
3872 | { | | 3872 | { |
3873 | if (!cirrus_fp_register (operands[1], DFmode)) | | 3873 | if (!cirrus_fp_register (operands[1], DFmode)) |
3874 | operands[1] = force_reg (DFmode, operands[0]); | | 3874 | operands[1] = force_reg (DFmode, operands[0]); |
3875 | emit_insn (gen_cirrus_truncdfsi2 (operands[0], operands[1])); | | 3875 | emit_insn (gen_cirrus_truncdfsi2 (operands[0], operands[1])); |
3876 | DONE; | | 3876 | DONE; |
3877 | } | | 3877 | } |
3878 | ") | | 3878 | ") |
3879 | | | 3879 | |
3880 | ;; Truncation insns | | 3880 | ;; Truncation insns |
3881 | | | 3881 | |
3882 | (define_expand "truncdfsf2" | | 3882 | (define_expand "truncdfsf2" |
3883 | [(set (match_operand:SF 0 "s_register_operand" "") | | 3883 | [(set (match_operand:SF 0 "s_register_operand" "") |
3884 | (float_truncate:SF | | 3884 | (float_truncate:SF |
3885 | (match_operand:DF 1 "s_register_operand" "")))] | | 3885 | (match_operand:DF 1 "s_register_operand" "")))] |
3886 | "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" | | 3886 | "TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
3887 | "" | | 3887 | "" |
3888 | ) | | 3888 | ) |
3889 | | | 3889 | |
3890 | /* DFmode -> HFmode conversions have to go through SFmode. */ | | 3890 | /* DFmode -> HFmode conversions have to go through SFmode. */ |
3891 | (define_expand "truncdfhf2" | | 3891 | (define_expand "truncdfhf2" |
3892 | [(set (match_operand:HF 0 "general_operand" "") | | 3892 | [(set (match_operand:HF 0 "general_operand" "") |
3893 | (float_truncate:HF | | 3893 | (float_truncate:HF |
3894 | (match_operand:DF 1 "general_operand" "")))] | | 3894 | (match_operand:DF 1 "general_operand" "")))] |
3895 | "TARGET_EITHER" | | 3895 | "TARGET_EITHER" |
3896 | " | | 3896 | " |
3897 | { | | 3897 | { |
3898 | rtx op1; | | 3898 | rtx op1; |
3899 | op1 = convert_to_mode (SFmode, operands[1], 0); | | 3899 | op1 = convert_to_mode (SFmode, operands[1], 0); |
3900 | op1 = convert_to_mode (HFmode, op1, 0); | | 3900 | op1 = convert_to_mode (HFmode, op1, 0); |
3901 | emit_move_insn (operands[0], op1); | | 3901 | emit_move_insn (operands[0], op1); |
3902 | DONE; | | 3902 | DONE; |
3903 | }" | | 3903 | }" |
3904 | ) | | 3904 | ) |
3905 | | | 3905 | |
3906 | ;; Zero and sign extension instructions. | | 3906 | ;; Zero and sign extension instructions. |
3907 | | | 3907 | |
3908 | (define_expand "zero_extendsidi2" | | 3908 | (define_expand "zero_extendsidi2" |
3909 | [(set (match_operand:DI 0 "s_register_operand" "") | | 3909 | [(set (match_operand:DI 0 "s_register_operand" "") |
3910 | (zero_extend:DI (match_operand:SI 1 "s_register_operand" "")))] | | 3910 | (zero_extend:DI (match_operand:SI 1 "s_register_operand" "")))] |
3911 | "TARGET_32BIT" | | 3911 | "TARGET_32BIT" |
3912 | "" | | 3912 | "" |
3913 | ) | | 3913 | ) |
3914 | | | 3914 | |
3915 | (define_insn "*arm_zero_extendsidi2" | | 3915 | (define_insn "*arm_zero_extendsidi2" |
3916 | [(set (match_operand:DI 0 "s_register_operand" "=r") | | 3916 | [(set (match_operand:DI 0 "s_register_operand" "=r") |
3917 | (zero_extend:DI (match_operand:SI 1 "s_register_operand" "r")))] | | 3917 | (zero_extend:DI (match_operand:SI 1 "s_register_operand" "r")))] |
3918 | "TARGET_ARM" | | 3918 | "TARGET_ARM" |
3919 | "* | | 3919 | "* |
3920 | if (REGNO (operands[1]) | | 3920 | if (REGNO (operands[1]) |
3921 | != REGNO (operands[0]) + (WORDS_BIG_ENDIAN ? 1 : 0)) | | 3921 | != REGNO (operands[0]) + (WORDS_BIG_ENDIAN ? 1 : 0)) |
3922 | output_asm_insn (\"mov%?\\t%Q0, %1\", operands); | | 3922 | output_asm_insn (\"mov%?\\t%Q0, %1\", operands); |
3923 | return \"mov%?\\t%R0, #0\"; | | 3923 | return \"mov%?\\t%R0, #0\"; |
3924 | " | | 3924 | " |
3925 | [(set_attr "length" "8") | | 3925 | [(set_attr "length" "8") |
3926 | (set_attr "predicable" "yes")] | | 3926 | (set_attr "predicable" "yes")] |
3927 | ) | | 3927 | ) |
3928 | | | 3928 | |
3929 | (define_expand "zero_extendqidi2" | | 3929 | (define_expand "zero_extendqidi2" |
3930 | [(set (match_operand:DI 0 "s_register_operand" "") | | 3930 | [(set (match_operand:DI 0 "s_register_operand" "") |
3931 | (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))] | | 3931 | (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))] |
3932 | "TARGET_32BIT" | | 3932 | "TARGET_32BIT" |
3933 | "" | | 3933 | "" |
3934 | ) | | 3934 | ) |
3935 | | | 3935 | |
3936 | (define_insn "*arm_zero_extendqidi2" | | 3936 | (define_insn "*arm_zero_extendqidi2" |
3937 | [(set (match_operand:DI 0 "s_register_operand" "=r,r") | | 3937 | [(set (match_operand:DI 0 "s_register_operand" "=r,r") |
3938 | (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] | | 3938 | (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] |
3939 | "TARGET_ARM" | | 3939 | "TARGET_ARM" |
3940 | "@ | | 3940 | "@ |
3941 | and%?\\t%Q0, %1, #255\;mov%?\\t%R0, #0 | | 3941 | and%?\\t%Q0, %1, #255\;mov%?\\t%R0, #0 |
3942 | ldr%(b%)\\t%Q0, %1\;mov%?\\t%R0, #0" | | 3942 | ldr%(b%)\\t%Q0, %1\;mov%?\\t%R0, #0" |
3943 | [(set_attr "length" "8") | | 3943 | [(set_attr "length" "8") |
3944 | (set_attr "predicable" "yes") | | 3944 | (set_attr "predicable" "yes") |
3945 | (set_attr "type" "*,load_byte") | | 3945 | (set_attr "type" "*,load_byte") |
3946 | (set_attr "pool_range" "*,4092") | | 3946 | (set_attr "pool_range" "*,4092") |
3947 | (set_attr "neg_pool_range" "*,4084")] | | 3947 | (set_attr "neg_pool_range" "*,4084")] |
3948 | ) | | 3948 | ) |
3949 | | | 3949 | |
3950 | (define_expand "extendsidi2" | | 3950 | (define_expand "extendsidi2" |
3951 | [(set (match_operand:DI 0 "s_register_operand" "") | | 3951 | [(set (match_operand:DI 0 "s_register_operand" "") |
3952 | (sign_extend:DI (match_operand:SI 1 "s_register_operand" "")))] | | 3952 | (sign_extend:DI (match_operand:SI 1 "s_register_operand" "")))] |
3953 | "TARGET_32BIT" | | 3953 | "TARGET_32BIT" |
3954 | "" | | 3954 | "" |
3955 | ) | | 3955 | ) |
3956 | | | 3956 | |
3957 | (define_insn "*arm_extendsidi2" | | 3957 | (define_insn "*arm_extendsidi2" |
3958 | [(set (match_operand:DI 0 "s_register_operand" "=r") | | 3958 | [(set (match_operand:DI 0 "s_register_operand" "=r") |
3959 | (sign_extend:DI (match_operand:SI 1 "s_register_operand" "r")))] | | 3959 | (sign_extend:DI (match_operand:SI 1 "s_register_operand" "r")))] |
3960 | "TARGET_ARM" | | 3960 | "TARGET_ARM" |
3961 | "* | | 3961 | "* |
3962 | if (REGNO (operands[1]) | | 3962 | if (REGNO (operands[1]) |
3963 | != REGNO (operands[0]) + (WORDS_BIG_ENDIAN ? 1 : 0)) | | 3963 | != REGNO (operands[0]) + (WORDS_BIG_ENDIAN ? 1 : 0)) |
3964 | output_asm_insn (\"mov%?\\t%Q0, %1\", operands); | | 3964 | output_asm_insn (\"mov%?\\t%Q0, %1\", operands); |
3965 | return \"mov%?\\t%R0, %Q0, asr #31\"; | | 3965 | return \"mov%?\\t%R0, %Q0, asr #31\"; |
3966 | " | | 3966 | " |
3967 | [(set_attr "length" "8") | | 3967 | [(set_attr "length" "8") |
3968 | (set_attr "shift" "1") | | 3968 | (set_attr "shift" "1") |
3969 | (set_attr "predicable" "yes")] | | 3969 | (set_attr "predicable" "yes")] |
3970 | ) | | 3970 | ) |
3971 | | | 3971 | |
3972 | (define_expand "zero_extendhisi2" | | 3972 | (define_expand "zero_extendhisi2" |
3973 | [(set (match_dup 2) | | 3973 | [(set (match_dup 2) |
3974 | (ashift:SI (match_operand:HI 1 "nonimmediate_operand" "") | | 3974 | (ashift:SI (match_operand:HI 1 "nonimmediate_operand" "") |
3975 | (const_int 16))) | | 3975 | (const_int 16))) |
3976 | (set (match_operand:SI 0 "s_register_operand" "") | | 3976 | (set (match_operand:SI 0 "s_register_operand" "") |
3977 | (lshiftrt:SI (match_dup 2) (const_int 16)))] | | 3977 | (lshiftrt:SI (match_dup 2) (const_int 16)))] |
3978 | "TARGET_EITHER" | | 3978 | "TARGET_EITHER" |
3979 | " | | 3979 | " |
3980 | { | | 3980 | { |
3981 | if ((TARGET_THUMB1 || arm_arch4) && GET_CODE (operands[1]) == MEM) | | 3981 | if ((TARGET_THUMB1 || arm_arch4) && GET_CODE (operands[1]) == MEM) |
3982 | { | | 3982 | { |
3983 | emit_insn (gen_rtx_SET (VOIDmode, operands[0], | | 3983 | emit_insn (gen_rtx_SET (VOIDmode, operands[0], |
3984 | gen_rtx_ZERO_EXTEND (SImode, operands[1]))); | | 3984 | gen_rtx_ZERO_EXTEND (SImode, operands[1]))); |
3985 | DONE; | | 3985 | DONE; |
3986 | } | | 3986 | } |
3987 | | | 3987 | |
3988 | if (TARGET_ARM && GET_CODE (operands[1]) == MEM) | | 3988 | if (TARGET_ARM && GET_CODE (operands[1]) == MEM) |
3989 | { | | 3989 | { |
3990 | emit_insn (gen_movhi_bytes (operands[0], operands[1])); | | 3990 | emit_insn (gen_movhi_bytes (operands[0], operands[1])); |
3991 | DONE; | | 3991 | DONE; |
3992 | } | | 3992 | } |
3993 | | | 3993 | |
3994 | if (!s_register_operand (operands[1], HImode)) | | 3994 | if (!s_register_operand (operands[1], HImode)) |
3995 | operands[1] = copy_to_mode_reg (HImode, operands[1]); | | 3995 | operands[1] = copy_to_mode_reg (HImode, operands[1]); |
3996 | | | 3996 | |
3997 | if (arm_arch6) | | 3997 | if (arm_arch6) |
3998 | { | | 3998 | { |
3999 | emit_insn (gen_rtx_SET (VOIDmode, operands[0], | | 3999 | emit_insn (gen_rtx_SET (VOIDmode, operands[0], |
4000 | gen_rtx_ZERO_EXTEND (SImode, operands[1]))); | | 4000 | gen_rtx_ZERO_EXTEND (SImode, operands[1]))); |
4001 | DONE; | | 4001 | DONE; |
4002 | } | | 4002 | } |
4003 | | | 4003 | |
4004 | operands[1] = gen_lowpart (SImode, operands[1]); | | 4004 | operands[1] = gen_lowpart (SImode, operands[1]); |
4005 | operands[2] = gen_reg_rtx (SImode); | | 4005 | operands[2] = gen_reg_rtx (SImode); |
4006 | }" | | 4006 | }" |
4007 | ) | | 4007 | ) |
4008 | | | 4008 | |
4009 | (define_insn "*thumb1_zero_extendhisi2" | | 4009 | (define_insn "*thumb1_zero_extendhisi2" |
4010 | [(set (match_operand:SI 0 "register_operand" "=l") | | 4010 | [(set (match_operand:SI 0 "register_operand" "=l") |
4011 | (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))] | | 4011 | (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))] |
4012 | "TARGET_THUMB1 && !arm_arch6" | | 4012 | "TARGET_THUMB1 && !arm_arch6" |
4013 | "* | | 4013 | "* |
4014 | rtx mem = XEXP (operands[1], 0); | | 4014 | rtx mem = XEXP (operands[1], 0); |
4015 | | | 4015 | |
4016 | if (GET_CODE (mem) == CONST) | | 4016 | if (GET_CODE (mem) == CONST) |
4017 | mem = XEXP (mem, 0); | | 4017 | mem = XEXP (mem, 0); |
4018 | | | 4018 | |
4019 | if (GET_CODE (mem) == LABEL_REF) | | 4019 | if (GET_CODE (mem) == LABEL_REF) |
4020 | return \"ldr\\t%0, %1\"; | | 4020 | return \"ldr\\t%0, %1\"; |
4021 | | | 4021 | |
4022 | if (GET_CODE (mem) == PLUS) | | 4022 | if (GET_CODE (mem) == PLUS) |
4023 | { | | 4023 | { |
4024 | rtx a = XEXP (mem, 0); | | 4024 | rtx a = XEXP (mem, 0); |
4025 | rtx b = XEXP (mem, 1); | | 4025 | rtx b = XEXP (mem, 1); |
4026 | | | 4026 | |
4027 | /* This can happen due to bugs in reload. */ | | 4027 | /* This can happen due to bugs in reload. */ |
4028 | if (GET_CODE (a) == REG && REGNO (a) == SP_REGNUM) | | 4028 | if (GET_CODE (a) == REG && REGNO (a) == SP_REGNUM) |
4029 | { | | 4029 | { |
4030 | rtx ops[2]; | | 4030 | rtx ops[2]; |
4031 | ops[0] = operands[0]; | | 4031 | ops[0] = operands[0]; |
4032 | ops[1] = a; | | 4032 | ops[1] = a; |
4033 | | | 4033 | |
4034 | output_asm_insn (\"mov %0, %1\", ops); | | 4034 | output_asm_insn (\"mov %0, %1\", ops); |
4035 | | | 4035 | |
4036 | XEXP (mem, 0) = operands[0]; | | 4036 | XEXP (mem, 0) = operands[0]; |
4037 | } | | 4037 | } |
4038 | | | 4038 | |
4039 | else if ( GET_CODE (a) == LABEL_REF | | 4039 | else if ( GET_CODE (a) == LABEL_REF |
4040 | && GET_CODE (b) == CONST_INT) | | 4040 | && GET_CODE (b) == CONST_INT) |
4041 | return \"ldr\\t%0, %1\"; | | 4041 | return \"ldr\\t%0, %1\"; |
4042 | } | | 4042 | } |
4043 | | | 4043 | |
4044 | return \"ldrh\\t%0, %1\"; | | 4044 | return \"ldrh\\t%0, %1\"; |
4045 | " | | 4045 | " |
4046 | [(set_attr "length" "4") | | 4046 | [(set_attr "length" "4") |
4047 | (set_attr "type" "load_byte") | | 4047 | (set_attr "type" "load_byte") |
4048 | (set_attr "pool_range" "60")] | | 4048 | (set_attr "pool_range" "60")] |
4049 | ) | | 4049 | ) |
4050 | | | 4050 | |
4051 | (define_insn "*thumb1_zero_extendhisi2_v6" | | 4051 | (define_insn "*thumb1_zero_extendhisi2_v6" |
4052 | [(set (match_operand:SI 0 "register_operand" "=l,l") | | 4052 | [(set (match_operand:SI 0 "register_operand" "=l,l") |
4053 | (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "l,m")))] | | 4053 | (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "l,m")))] |
4054 | "TARGET_THUMB1 && arm_arch6" | | 4054 | "TARGET_THUMB1 && arm_arch6" |
4055 | "* | | 4055 | "* |
4056 | rtx mem; | | 4056 | rtx mem; |
4057 | | | 4057 | |
4058 | if (which_alternative == 0) | | 4058 | if (which_alternative == 0) |
4059 | return \"uxth\\t%0, %1\"; | | 4059 | return \"uxth\\t%0, %1\"; |
4060 | | | 4060 | |
4061 | mem = XEXP (operands[1], 0); | | 4061 | mem = XEXP (operands[1], 0); |
4062 | | | 4062 | |
4063 | if (GET_CODE (mem) == CONST) | | 4063 | if (GET_CODE (mem) == CONST) |
4064 | mem = XEXP (mem, 0); | | 4064 | mem = XEXP (mem, 0); |
4065 | | | 4065 | |
4066 | if (GET_CODE (mem) == LABEL_REF) | | 4066 | if (GET_CODE (mem) == LABEL_REF) |
4067 | return \"ldr\\t%0, %1\"; | | 4067 | return \"ldr\\t%0, %1\"; |
4068 | | | 4068 | |
4069 | if (GET_CODE (mem) == PLUS) | | 4069 | if (GET_CODE (mem) == PLUS) |
4070 | { | | 4070 | { |
4071 | rtx a = XEXP (mem, 0); | | 4071 | rtx a = XEXP (mem, 0); |
4072 | rtx b = XEXP (mem, 1); | | 4072 | rtx b = XEXP (mem, 1); |
4073 | | | 4073 | |
4074 | /* This can happen due to bugs in reload. */ | | 4074 | /* This can happen due to bugs in reload. */ |
4075 | if (GET_CODE (a) == REG && REGNO (a) == SP_REGNUM) | | 4075 | if (GET_CODE (a) == REG && REGNO (a) == SP_REGNUM) |
4076 | { | | 4076 | { |
4077 | rtx ops[2]; | | 4077 | rtx ops[2]; |
4078 | ops[0] = operands[0]; | | 4078 | ops[0] = operands[0]; |
4079 | ops[1] = a; | | 4079 | ops[1] = a; |
4080 | | | 4080 | |
4081 | output_asm_insn (\"mov %0, %1\", ops); | | 4081 | output_asm_insn (\"mov %0, %1\", ops); |
4082 | | | 4082 | |
4083 | XEXP (mem, 0) = operands[0]; | | 4083 | XEXP (mem, 0) = operands[0]; |
4084 | } | | 4084 | } |
4085 | | | 4085 | |
4086 | else if ( GET_CODE (a) == LABEL_REF | | 4086 | else if ( GET_CODE (a) == LABEL_REF |
4087 | && GET_CODE (b) == CONST_INT) | | 4087 | && GET_CODE (b) == CONST_INT) |
4088 | return \"ldr\\t%0, %1\"; | | 4088 | return \"ldr\\t%0, %1\"; |
4089 | } | | 4089 | } |
4090 | | | 4090 | |
4091 | return \"ldrh\\t%0, %1\"; | | 4091 | return \"ldrh\\t%0, %1\"; |
4092 | " | | 4092 | " |
4093 | [(set_attr "length" "2,4") | | 4093 | [(set_attr "length" "2,4") |
4094 | (set_attr "type" "alu_shift,load_byte") | | 4094 | (set_attr "type" "alu_shift,load_byte") |
4095 | (set_attr "pool_range" "*,60")] | | 4095 | (set_attr "pool_range" "*,60")] |
4096 | ) | | 4096 | ) |
4097 | | | 4097 | |
4098 | (define_insn "*arm_zero_extendhisi2" | | 4098 | (define_insn "*arm_zero_extendhisi2" |
4099 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 4099 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
4100 | (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))] | | 4100 | (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))] |
4101 | "TARGET_ARM && arm_arch4 && !arm_arch6" | | 4101 | "TARGET_ARM && arm_arch4 && !arm_arch6" |
4102 | "ldr%(h%)\\t%0, %1" | | 4102 | "ldr%(h%)\\t%0, %1" |
4103 | [(set_attr "type" "load_byte") | | 4103 | [(set_attr "type" "load_byte") |
4104 | (set_attr "predicable" "yes") | | 4104 | (set_attr "predicable" "yes") |
4105 | (set_attr "pool_range" "256") | | 4105 | (set_attr "pool_range" "256") |
4106 | (set_attr "neg_pool_range" "244")] | | 4106 | (set_attr "neg_pool_range" "244")] |
4107 | ) | | 4107 | ) |
4108 | | | 4108 | |
4109 | (define_insn "*arm_zero_extendhisi2_v6" | | 4109 | (define_insn "*arm_zero_extendhisi2_v6" |
4110 | [(set (match_operand:SI 0 "s_register_operand" "=r,r") | | 4110 | [(set (match_operand:SI 0 "s_register_operand" "=r,r") |
4111 | (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] | | 4111 | (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] |
4112 | "TARGET_ARM && arm_arch6" | | 4112 | "TARGET_ARM && arm_arch6" |
4113 | "@ | | 4113 | "@ |
4114 | uxth%?\\t%0, %1 | | 4114 | uxth%?\\t%0, %1 |
4115 | ldr%(h%)\\t%0, %1" | | 4115 | ldr%(h%)\\t%0, %1" |
4116 | [(set_attr "type" "alu_shift,load_byte") | | 4116 | [(set_attr "type" "alu_shift,load_byte") |
4117 | (set_attr "predicable" "yes") | | 4117 | (set_attr "predicable" "yes") |
4118 | (set_attr "pool_range" "*,256") | | 4118 | (set_attr "pool_range" "*,256") |
4119 | (set_attr "neg_pool_range" "*,244")] | | 4119 | (set_attr "neg_pool_range" "*,244")] |
4120 | ) | | 4120 | ) |
4121 | | | 4121 | |
4122 | (define_insn "*arm_zero_extendhisi2addsi" | | 4122 | (define_insn "*arm_zero_extendhisi2addsi" |
4123 | [(set (match_operand:SI 0 "s_register_operand" "=r") | | 4123 | [(set (match_operand:SI 0 "s_register_operand" "=r") |
4124 | (plus:SI (zero_extend:SI (match_operand:HI 1 "s_register_operand" "r")) | | 4124 | (plus:SI (zero_extend:SI (match_operand:HI 1 "s_register_operand" "r")) |
4125 | (match_operand:SI 2 "s_register_operand" "r")))] | | 4125 | (match_operand:SI 2 "s_register_operand" "r")))] |
4126 | "TARGET_INT_SIMD" | | 4126 | "TARGET_INT_SIMD" |
4127 | "uxtah%?\\t%0, %2, %1" | | 4127 | "uxtah%?\\t%0, %2, %1" |
4128 | [(set_attr "type" "alu_shift") | | 4128 | [(set_attr "type" "alu_shift") |
4129 | (set_attr "predicable" "yes")] | | 4129 | (set_attr "predicable" "yes")] |
4130 | ) | | 4130 | ) |
4131 | | | 4131 | |
4132 | (define_expand "zero_extendqisi2" | | 4132 | (define_expand "zero_extendqisi2" |
4133 | [(set (match_operand:SI 0 "s_register_operand" "") | | 4133 | [(set (match_operand:SI 0 "s_register_operand" "") |
4134 | (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))] | | 4134 | (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))] |
4135 | "TARGET_EITHER" | | 4135 | "TARGET_EITHER" |
4136 | " | | 4136 | " |