[Bug target/41705] missed if conversion optimization

2009-10-27 Thread carrot at google dot com


--- Comment #4 from carrot at google dot com  2009-10-27 09:15 ---
A patch http://gcc.gnu.org/viewcvs?view=revisionrevision=153584 has been
checked in.


-- 

carrot at google dot com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41705



[Bug target/41705] missed if conversion optimization

2009-10-15 Thread ramana at gcc dot gnu dot org


--- Comment #2 from ramana at gcc dot gnu dot org  2009-10-15 07:57 ---

(In reply to comment #0)
 Compile the attached source code with options -Os -march=armv5te -mthumb, gcc
 generates:
 
 push{lr}
 ldr r3, [r0]
 cmp r3, #0   // B
 bne .L3
 ldr r3, [r0, #4]
 b   .L2
 .L3:
 mov r3, #0   // A
 .L2:
 ldr r2, [r0, #8]
 @ sp needed for prologue
 ldr r0, [r2]
 add r0, r3, r0
 pop {pc}
 
 Instruction A can be moved before instruction B, which should be handled by
 ifcvt.c:find_if_case_2. Notice the following code in find_if_header:

Surely you want A moved before the load rather than just before the comparison
? If you move the move after the load you've destroyed the value you've loaded
and the comparison is redundant.


 
 Target ARM has conditional execution capability, but thumb actually can't do
 conditional execution. Do we have any method to let the compiler know this?

Note that this is relevant only for Thumb1 and not for Thumb2. Thumb2 has
conditional code generation and GCC does make an effort to generate conditional
code for it.

Can we work around this by undef'ing HAVE_conditional_execution in the backend
headers and defining this to TARGET_THUMB1 ? 

cheers
Ramana


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41705



[Bug target/41705] missed if conversion optimization

2009-10-15 Thread carrot at google dot com


--- Comment #3 from carrot at google dot com  2009-10-15 08:25 ---
 
  
  Target ARM has conditional execution capability, but thumb actually can't do
  conditional execution. Do we have any method to let the compiler know this?
 
 Note that this is relevant only for Thumb1 and not for Thumb2. Thumb2 has
 conditional code generation and GCC does make an effort to generate 
 conditional
 code for it.
 
 Can we work around this by undef'ing HAVE_conditional_execution in the backend
 headers and defining this to TARGET_THUMB1 ? 
 

I will try this method, thank you.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41705



[Bug target/41705] missed if conversion optimization

2009-10-15 Thread ramana at gcc dot gnu dot org


-- 

ramana at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2009-10-15 10:20:03
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41705



[Bug target/41705] missed if conversion optimization

2009-10-14 Thread carrot at google dot com


--- Comment #1 from carrot at google dot com  2009-10-14 09:29 ---
Created an attachment (id=18798)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18798action=view)
test case


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41705