public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <bug-22199-4@http.gcc.gnu.org/bugzilla/>]
* [Bug tree-optimization/22199] New: Unnecessary casts for comparison
@ 2005-06-27 15:04 tkoenig at gcc dot gnu dot org
  2005-09-24 16:22 ` [Bug tree-optimization/22199] fold does not optimize (int)ABS_EXPR<(long long)(int_var)> pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 4+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-06-27 15:04 UTC (permalink / raw)
  To: gcc-bugs

$ cat labs.c
extern long int labs (long int __x) __attribute__ ((__const__));

int main()
{
    int a,b;
    foo(&a, &b);
    if (labs(a) > b)
        return 1;
    else
        return 0;
}

is translated with

$ gcc -O3 -fdump-tree-optimized -S labs.c

into

<bb 0>:
  foo (&a, &b);
  return (int) (ABS_EXPR <(long int) a> > (long int) b);

The casts aren't necessary in this case.

-- 
           Summary: Unnecessary casts for comparison
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2021-06-03  3:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-22199-10391@http.gcc.gnu.org/bugzilla/>
2005-12-24 20:15 ` [Bug tree-optimization/22199] fold does not optimize (int)ABS_EXPR<(long long)(int_var)> pinskia at gcc dot gnu dot org
     [not found] <bug-22199-4@http.gcc.gnu.org/bugzilla/>
2021-06-03  3:35 ` pinskia at gcc dot gnu.org
2021-06-03  3:37 ` pinskia at gcc dot gnu.org
2005-06-27 15:04 [Bug tree-optimization/22199] New: Unnecessary casts for comparison tkoenig at gcc dot gnu dot org
2005-09-24 16:22 ` [Bug tree-optimization/22199] fold does not optimize (int)ABS_EXPR<(long long)(int_var)> pinskia at gcc dot gnu dot org

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).