On Sat, Dec 31, 2011 at 12:51 AM, Alexander Monakov <[email protected]> wrote:
>
>
> On Sat, 31 Dec 2011, Matt Davis wrote:
>
>> Hi,
>> I am having an RTL problem trying to make a function call from a
>> COND_EXEC rtx. The reload pass has been called, and very simply I
>> want to compare on an 64bit x86 %rdx with a specific integer value,
>> and if that value is true, my function call executes. I can call the
>> function fine outside of the conditional, but when I set it in the
>> conditional expression, I get the following error:
>>
>> test.c:6:1: error: unrecognizable insn:
>
> Indeed, x86 does not have a "conditional call" instruction. You would have to
> generate the call in a separate basic block and add a conditional branch
> instruction around it. You can reference the following code, which attempts
> to convert any COND_EXECs to explicit control flow:
>
> http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02383.html
>
> (but you will probably need to additionally generate comparison instructions).
>
> Hope that helps,
Thanks Alexander. This does help. What I have been doing is writing
the same code in c. Compiling that, and then dumping the RTL. I then
try to create the same RTL by hand. The second thing I need to do, as
the first is already in place in my code, is to compare a register
with a constant. So, just to test things, I just perform a simple
"COMPARE" and set the mode to CCZ, and is what my analogue C variant
produces in the RTL dump. Unfortunately, I'm still getting a similar
error "unrecognizable insn" I feel lame asking so many questions,
but this is something I want to get stronger with, so aside from my
current gcc research, I am tossing this into the mix in my free time.
I've looked at the rtl.def and nothing seems incorrect.
My RTX:
rtx cmp2 = gen_rtx_COMPARE(
CCZmode,
gen_rtx_REG(DImode, 1),
gen_rtx_CONST_INT(VOIDmode, 42));
Once this is in place I would wrap a SET rtx and actually set the CCZ
register. I'm primarily just concerned with getting the comparison
piece in place first.
-Matt