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]

RTL AND Instruction


Hello (again),
I have a case where I need to emit an AND operation on a register and a
const_int value.  The machine architecture I am looking at, for the .md, is an
i386.  Anyways, after matching things up with the rtl.def and what is in the
.md,  I use the gen_rtx_AND macro and wrap that in a gen_rtx_SET.  I could
insert inline assembly with the ASM_OPERANDS macro, but I really want to do this
with pure RTL.  Essentially, I just want to emit:  "and %eax, $0x7"

Once I emit my rtx into the list of insns, GCC gives me an "unrecognized insn"
error.  I can trace the code through the first part of the condition, specified
in i386.md, "ix86_binary_operator_ok," and that passes fine from the
"anddi_1" define_insn.  What I have in my source is the following:

    rtx eax = gen_rtx_REG(DImode, 0);
    rtx and = gen_rtx_AND(DImode, eax, gen_rtx_CONST_INT(VOIDmode, 7));
    and = gen_rtx_SET(DImode, eax, and);
    emit_insn_before(and, insn);

Thanks for any insight into this.  On a side note, this is just for a
side-project, and I am trying to get a better grasp of RTL.  I have gone through
the internals manual for RTL and Machine Descriptions, but seems I am still
having a bit of trouble.

-Matt


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