tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] ASM Output?


From: Neil Bradley
Subject: Re: [Tinycc-devel] ASM Output?
Date: Tue, 16 Nov 2004 16:43:15 -0800 (PST)

> While normally I'd say that gcc does better at optimizing code, I hit
> this one curious test case the other night where tcc seems to beat it
> easily and I don't understand why:
>
> #include <stdio.h>
> #include <stdint.h>
>
> static inline uint8_t foo(uint8_t const x)
> {
>       static uint8_t table[16] = {
>               'a','b','c','d','x','y','z','q',
>               '1','p','5','w','r','t','0','n'
>       };
>       return table[x % 0xfU];

Probably because gcc is doing a divide here, and tcc is smart enough to do
a logical and? Also, try doing -O3 on gcc and see what comes up.

-->Neil

-------------------------------------------------------------------------------
Neil Bradley             "The true axis of evil in America is the brilliance of
Synthcom Systems, Inc.    our marketing combined with the stupidity of our
                          people.." -  Bill Maher




reply via email to

[Prev in Thread] Current Thread [Next in Thread]