Re: [PATCH v2] implement constant-folding in __builtin_bswap*()

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

 



On Thu, Nov 17, 2016 at 5:55 PM, Johannes Berg
<johannes@xxxxxxxxxxxxxxxx> wrote:
> Since gcc does this, it's apparently valid to write
>
>  switch (x) {
>  case __builtin_bswap16(12):
>    break;
>  }
>

Applied. Thanks for the patch. That will definite stop a lot of warning.

There is other possible __builtin_xxx() function gcc expected to get a
const result
when the input arguments are constant.  Ideally, we should be able to
mark __builtin_bswap16
as a special constant "pass through" function. So during the
evaluation and constant propagation,
sparse can pass through the native __builtin_xxx() call to get the
const result. In other words,
sparse shouldn't need to implement "__builtin_bswap16()" by itself. It
can just call to the gcc
one to get the result. Then we can treat all other similar
__builtin_xxx function the same way.

That is a separate patch though.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux