This is the mail archive of the
mailing list for the GCC project.
abs insn with QI and HI mode
- From: Ying Yi <M dot Yi at ed dot ac dot uk>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 07 Jul 2007 17:15:46 +0100
- Subject: abs insn with QI and HI mode
I have a problem with absm2 insn, my target machine can suppport abs
operation with QImode, HImode and SImode. I give machine description
in md file as below.
(define_mode_macro SHQ [SI HI QI])
[(set (match_operand:SHQ 0 "register_operand" "=r")
(abs:SHQ (match_operand:SHQ 1 "nonmemory_operand" "rM")))]
"abs.<MODE> out=%0, in=%1"
[(set_attr "type" "mux")
(set_attr "length" "1")])
When I compiled the c code as shown below:
shirt int a, b;
note: a, b both globel variables
The generated codes do the following operations: 1) extend variable
a_HI (HImode) to temp variable SImode, and do abs operation with
SImode operators. I find the gimple intermedia represention as shown
D.1298 = a_HI;
D.1299 = (int) D.1298;
D.1300 = ABS_EXPR <D.1299>;
D.1301 = (short int) D.1300;
The unnecessary insns have been generated. It looks that ABS_EXPR only
do SImode in the frontend.
Could anyone know how to solve this problem?
Thanks very much in advances