This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
subreg vs register_operand
- From: Pierre Mallard <pierremallard at yahoo dot fr>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 12 Sep 2002 10:09:56 +0200 (CEST)
- Subject: subreg vs register_operand
Hi ,
I've got a simple set of define_insn to match move
instruction :
(define_insn "movqi"
[(set (match_operand:QI 0 "nonimmediate_operand"
"=r,m,r,r")
(match_operand:QI 1 "general_operand"
"r,r,m,i"))]
"(register_operand (operands[0],QImode)
|| register_operand (operands[1], QImode))"
"* return output_movqi (insn, operands, NULL);"
[(set_attr "length" "1,5,5,1")
(set_attr "cc" "none,none,none,none")
(set_attr "type" "none,load,none,none")])
(define_insn "movhi"
[(set (match_operand:HI 0 "nonimmediate_operand"
"=r,r,m,r,r")
(match_operand:HI 1 "general_operand"
"r,m,r,I,i"))]
"(register_operand (operands[0],HImode)
|| register_operand (operands[1],HImode))"
"* return output_movhi (insn, operands, NULL);"
[(set_attr "length" "1,6,6,1,2")
(set_attr "cc" "none,none,none,none,none")
(set_attr "type" "none,load,none,none,none")])
(define_insn "movsi"
[(set (match_operand:SI 0 "nonimmediate_operand"
"=r,r,m,r,r")
(match_operand:SI 1 "general_operand"
"r,m,r,I,i"))]
"(register_operand (operands[0],SImode)
|| register_operand (operands[1],SImode))"
"* return output_movsisf (insn, operands, NULL);"
[(set_attr "length" "2,8,8,2,4")
(set_attr "cc" "none,none,none,none,none")
(set_attr "type" "none,load,none,none,none")])
In order to optimize the jump delay slot I make some
define_split to reduce SI and HI move :
(define_split
[(set (match_operand:HI 0 "register_operand" "=r")
(match_operand:HI 1 "general_operand" "i"))]
""
[(set (subreg:QI (match_dup 0) 0) (match_operand:QI
2 "general_operand" "i"))
(set (subreg:QI (match_dup 0) 1) (match_operand:QI
3 "general_operand" "i"))]
"{
HOST_WIDE_INT low = INTVAL(operands[1])&0xfff;
HOST_WIDE_INT high = (INTVAL(operands[1])&0xfff000)
>> 12;
operands[2] = GEN_INT(low);
operands[3] = GEN_INT(high);
}")
(define_split
[(set (match_operand:SI 0 "register_operand" "")
(match_operand:SI 1 "register_operand" ""))]
""
[(set (subreg:HI (match_dup 0) 0)
(subreg:HI(match_dup 1) 0))
(set (subreg:HI (match_dup 0) 2) (subreg:HI
(match_dup 1) 2))]
"")
(define_split
[(set (match_operand:SI 0 "register_operand" "=r")
(match_operand:SI 1 "general_operand" "i"))]
""
[(set (subreg:HI (match_dup 0) 0) (match_operand:HI
2 "general_operand" "i"))
(set (subreg:HI (match_dup 0) 2) (match_operand:HI
3 "general_operand" "i"))]
"{
HOST_WIDE_INT low =
CONST_DOUBLE_LOW(operands[1])&0xffffff;
HOST_WIDE_INT high =
((CONST_DOUBLE_LOW(operands[1])&0xff000000) >>
24)|((CONST_DOUBLE_HIGH(operands[1])&0xffff) << 8);
operands[2] = GEN_INT(low);
operands[3] = GEN_INT(high);
}")
When the compiler split a MOVSI(reg,immediate), into
an HI and then into a QI it just throw an error :
Unrecognizable insn:
(insn 357 190 358 (set (subreg:QI (subreg:HI (reg:SI
16 r16) 0) 0)
(const_int 0 [0x0])) -1 (nil)
(nil))
I'm wondering why this insn is not catch by
define_insn "movqi" as a simple (set (reg:QI would do?
Someone can help me?
Thanks, regards
Pierre
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com