public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Question regarding preventing optimizing out of register in expansion
@ 2018-06-21 11:42 Peryt, Sebastian
  2018-06-21 13:12 ` Nathan Sidwell
  0 siblings, 1 reply; 7+ messages in thread
From: Peryt, Sebastian @ 2018-06-21 11:42 UTC (permalink / raw)
  To: gcc; +Cc: Peryt, Sebastian

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-06-26 20:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-21 11:42 Question regarding preventing optimizing out of register in expansion Peryt, Sebastian
2018-06-21 13:12 ` Nathan Sidwell
2018-06-21 14:06   ` Peryt, Sebastian
2018-06-26  9:26   ` Peryt, Sebastian
2018-06-26 19:20     ` Peter Bergner
2018-06-26 19:46       ` Peryt, Sebastian
2018-06-27 10:26         ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).