Question regarding preventing optimizing out of register in expansion
Peryt, Sebastian
sebastian.peryt@intel.com
Thu Jun 21 11:42:00 GMT 2018
Hi,
I'd appreciate if someone could advise me in builtin expansion I'm currently writing.
High level description for what I want to do:
I have 2 operands in my builtin.
First I set register (reg1) with value from operand1 (op1);
Second I call my instruction (reg1 is called implicitly and updated);
At the end I'm setting operand2 (op2) with value from reg1.
Simplified implementation in i386.c I have:
reg1 = gen_reg_rtx (mode);
emit_insn (gen_rtx_SET (reg1, op1);
emit_clobber (reg1);
emit_insn (gen_myinstruction ());
emit_insn (gen_rtx_SET (op2,reg1));
Everything works fine for -O0, but when I move to higher level optimizations
setting value into reg1 (lines before emit_clobber) are optimized out.
I already tried moving emit_clobber just after assignment but it doesn't help.
Could you please suggest how I can prevent it from happening?
Thanks,
Sebastian
More information about the Gcc
mailing list