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]

emit_cmp_insn in alpha


I am trying to compare the values of the contents two registers in the
epilogue of a function and then jump depending on the result of the
comparison. I modified the alpha_expand_epilogue() function in
config/alpha/alpha.c and added the following:

  /* base reg is $16 offset is 80 */
  mem = gen_rtx_MEM (DImode, plus_constant (base_reg, offset));
  MEM_ALIAS_SET (mem) = alpha_sr_alias_set;

  temp_reg1  = gen_rtx_REG(DImode, 1);
  temp_reg2  = gen_rtx_REG(DImode, 2);

  FRP (emit_move_insn(temp_reg1, mem) );
  FRP (emit_move_insn(temp_reg2, GEN_INT(0x100)));

  ne_label = gen_label_rtx();

  FRP (emit_cmp_and_jump_insns( temp_reg1,
                                temp_reg2,
                                NE,
                                NULL_RTX,
                                DImode,
                                1,
                                0,
                                ne_label ) );


  hoping to get an output like:

  ldq  $1, 80($16)
  lda  $2, 256
  cmpne $1,$2, $3
  bne  $3, $Lxyz

  but I got an error when I compiled gcc and tried to compile a test
program with it. It said cannot create new pseudos, which I take as the
emit_cmp_and_jump_insns is trying to allocate temporaries but that is not
allowed in the epilogue. So I though I can call emit_cmp_insn() and
emit_jmp_insn() separately and get rid of this problem. it didn't work.


  FRP(emit_cmp_insn (temp_reg1, temp_reg2, NE, NULL_RTX,DImode ,1,0) );

this instruction does not emit anyting in the .s file. There is no cmpne
instruction.

I need help with several things:

1. How am I supposed to emit a compare instuction in alpha?
2. Once I do that how do I specify which register the result is in so I
   can pass that (an also, how do I do this?) result register to the
   following conditional jump instruction?
3. Why doesn't output_asm_insn() ouput the instructions in the right
   place? I tried doing the above using this function but it placed the
   instuctions in the beginning too late in the code.

thanks..

Hilmi Ozdoganoglu
Purdue University


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