This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/40153] Long long comparison optimized away incorrectly in Thumb code.



------- Comment #2 from ramana at gcc dot gnu dot org  2009-05-15 08:26 -------
(In reply to comment #1)
> This is caused by a typo in arm.md.
> 
> (define_insn "cstoresi_nltu_thumb1"
>   [(set (match_operand:SI 0 "s_register_operand" "=l,l")
>         (neg:SI (gtu:SI (match_operand:SI 1 "s_register_operand" "l,*h")
>                         (match_operand:SI 2 "thumb1_cmp_operand" "lI*h,*r"))))]
>   "TARGET_THUMB1"
>   "cmp\\t%1, %2\;sbc\\t%0, %0, %0"
>   [(set_attr "length" "4")]
> )
> 
> The instruction cstoresi_nltu_thumb1 is used to compute the expression -(x < y)
> where x and y are unsigned SI-type values.  The operand of the NEG RTX should
> be a LTU RTX instead of a GTU RTX.  The incorrected RTX code caused a later CSE
> pass to substitute this pattern:
> 
> (set x
>     (neg (gtu a b)))   <=== cstoresi_nltu_thumb1
> (set y (neg x))        
> 
> with
> 
> (set y (gtu a b))
> 
> I tried fixing the RTX code and the test case passed.
> 

This looks correct. Please submit a patch to gcc-patches@.


-- 

ramana at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-05-15 08:26:09
               date|                            |


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]