This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

abs insn with QI and HI mode


Hi all,

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])

(define_insn "abs<mode>2"
  [(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;

a=abs(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 below:

  D.1298 = a_HI[0];
  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




Best regards


Maggie





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]