This is the mail archive of the
mailing list for the GCC project.
RTL AND Instruction
- From: Matt Davis <mattdavis9 at gmail dot com>
- To: gcc at gnu dot org
- Date: Sun, 22 Jan 2012 16:21:12 +1100
- Subject: RTL AND Instruction
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);
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.