Commit c8d6f9e7 by Richard Sandiford Committed by Richard Sandiford

mips.md: Add combiner patterns for DImode extensions of HImode and QImode truncations.

gcc/
	* config/mips/mips.md: Add combiner patterns for DImode extensions
	of HImode and QImode truncations.  Reformat HImode <- QImode pattern
	for consistency.

From-SVN: r129695
parent 9a4a025a
2007-10-28 Richard Sandiford <rsandifo@nildram.co.uk> 2007-10-28 Richard Sandiford <rsandifo@nildram.co.uk>
* config/mips/mips.md: Add combiner patterns for DImode extensions
of HImode and QImode truncations. Reformat HImode <- QImode pattern
for consistency.
2007-10-28 Richard Sandiford <rsandifo@nildram.co.uk>
PR target/33895 PR target/33895
* config/mips/mips.c (mips_output_dwarf_dtprel): Add ATTRIBUTE_UNUSED. * config/mips/mips.c (mips_output_dwarf_dtprel): Add ATTRIBUTE_UNUSED.
...@@ -2366,68 +2366,73 @@ ...@@ -2366,68 +2366,73 @@
(set_attr "mode" "SI")]) (set_attr "mode" "SI")])
;; Combiner patterns for truncate/sign_extend combinations. They use ;; Combiner patterns for truncate/sign_extend combinations. The SI versions
;; the shift/truncate patterns above. ;; use the shift/truncate patterns above.
(define_insn_and_split "" (define_insn_and_split "*extenddi_truncate<mode>"
[(set (match_operand:SI 0 "register_operand" "=d") [(set (match_operand:DI 0 "register_operand" "=d")
(sign_extend:SI (sign_extend:DI
(truncate:HI (match_operand:DI 1 "register_operand" "d"))))] (truncate:SHORT (match_operand:DI 1 "register_operand" "d"))))]
"TARGET_64BIT && !TARGET_MIPS16" "TARGET_64BIT && !TARGET_MIPS16"
"#" "#"
"&& reload_completed" "&& reload_completed"
[(set (match_dup 2) [(set (match_dup 2)
(ashift:DI (match_dup 1) (ashift:DI (match_dup 1)
(const_int 48))) (match_dup 3)))
(set (match_dup 0) (set (match_dup 0)
(truncate:SI (ashiftrt:DI (match_dup 2) (ashiftrt:DI (match_dup 2)
(const_int 48))))] (match_dup 3)))]
{ operands[2] = gen_lowpart (DImode, operands[0]); }) {
operands[2] = gen_lowpart (DImode, operands[0]);
operands[3] = GEN_INT (BITS_PER_WORD - GET_MODE_BITSIZE (<MODE>mode));
})
(define_insn_and_split "" (define_insn_and_split "*extendsi_truncate<mode>"
[(set (match_operand:SI 0 "register_operand" "=d") [(set (match_operand:SI 0 "register_operand" "=d")
(sign_extend:SI (sign_extend:SI
(truncate:QI (match_operand:DI 1 "register_operand" "d"))))] (truncate:SHORT (match_operand:DI 1 "register_operand" "d"))))]
"TARGET_64BIT && !TARGET_MIPS16" "TARGET_64BIT && !TARGET_MIPS16"
"#" "#"
"&& reload_completed" "&& reload_completed"
[(set (match_dup 2) [(set (match_dup 2)
(ashift:DI (match_dup 1) (ashift:DI (match_dup 1)
(const_int 56))) (match_dup 3)))
(set (match_dup 0) (set (match_dup 0)
(truncate:SI (ashiftrt:DI (match_dup 2) (truncate:SI (ashiftrt:DI (match_dup 2)
(const_int 56))))] (match_dup 3))))]
{ operands[2] = gen_lowpart (DImode, operands[0]); }) {
operands[2] = gen_lowpart (DImode, operands[0]);
operands[3] = GEN_INT (BITS_PER_WORD - GET_MODE_BITSIZE (<MODE>mode));
})
;; Combiner patterns to optimize truncate/zero_extend combinations. ;; Combiner patterns to optimize truncate/zero_extend combinations.
(define_insn "" (define_insn "*zero_extend<mode>_trunchi"
[(set (match_operand:SI 0 "register_operand" "=d") [(set (match_operand:GPR 0 "register_operand" "=d")
(zero_extend:SI (truncate:HI (zero_extend:GPR
(match_operand:DI 1 "register_operand" "d"))))] (truncate:HI (match_operand:DI 1 "register_operand" "d"))))]
"TARGET_64BIT && !TARGET_MIPS16" "TARGET_64BIT && !TARGET_MIPS16"
"andi\t%0,%1,0xffff" "andi\t%0,%1,0xffff"
[(set_attr "type" "logical") [(set_attr "type" "logical")
(set_attr "mode" "SI")]) (set_attr "mode" "<MODE>")])
(define_insn "" (define_insn "*zero_extend<mode>_truncqi"
[(set (match_operand:SI 0 "register_operand" "=d") [(set (match_operand:GPR 0 "register_operand" "=d")
(zero_extend:SI (truncate:QI (zero_extend:GPR
(match_operand:DI 1 "register_operand" "d"))))] (truncate:QI (match_operand:DI 1 "register_operand" "d"))))]
"TARGET_64BIT && !TARGET_MIPS16" "TARGET_64BIT && !TARGET_MIPS16"
"andi\t%0,%1,0xff" "andi\t%0,%1,0xff"
[(set_attr "type" "logical") [(set_attr "type" "logical")
(set_attr "mode" "SI")]) (set_attr "mode" "<MODE>")])
(define_insn "" (define_insn ""
[(set (match_operand:HI 0 "register_operand" "=d") [(set (match_operand:HI 0 "register_operand" "=d")
(zero_extend:HI (truncate:QI (zero_extend:HI
(match_operand:DI 1 "register_operand" "d"))))] (truncate:QI (match_operand:DI 1 "register_operand" "d"))))]
"TARGET_64BIT && !TARGET_MIPS16" "TARGET_64BIT && !TARGET_MIPS16"
"andi\t%0,%1,0xff" "andi\t%0,%1,0xff"
[(set_attr "type" "logical") [(set_attr "type" "logical")
(set_attr "mode" "HI")]) (set_attr "mode" "HI")])
;; ;;
;; .................... ;; ....................
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment