This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/45980] Use not in stead of add to generate new constant
- From: "carrot at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 18 Oct 2010 06:24:08 +0000
- Subject: [Bug target/45980] Use not in stead of add to generate new constant
- Auto-submitted: auto-generated
- References: <bug-45980-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45980
--- Comment #1 from Carrot <carrot at google dot com> 2010-10-18 06:24:04 UTC ---
The replacement of constant loading with add operations is occurred at pass
postreload in function reload_cse_move2add. It is straight forward to extend
that to other ALU operations, such as not, and, or, xor, shift ...
But there is a problem as shown in this example.
context->state[0] = 0x67452301; // r3
context->state[1] = 0xEFCDAB89;
context->state[2] = 0x98BADCFE;
context->state[3] = 0x10325476;
After the first statement, value 0x67452301 is in register r3, and after the
second statement, value 0xEFCDAB89 is in r3, and the original value 0x67452301
is lost, so we can't get the third value by simple "movns r3, r3". We need some
form of register renaming at the same time.