Re: [PATCH 1/6] add testcases for {LSR,SHL}(AND(x, M), S) with shared AND(x, M)

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

 




On 19/08/18 10:29, Luc Van Oostenryck wrote:
> The pattern LSR(AND(x, M), S) is already generically simplified into
> ((x >> S) & (M >> S)) but only if the sub-expression AND(x, M) is not
> shared with some other expressions because the simplification modify it.
> 
> But for some special cases the expression can be simplified even if
> the sub-expression is shared because the simplification doesn't need
> to modify this AND(x, M) part.
> 
> Add the testcases for LSR and te incoming SHL.

s/te/the/

> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
> ---
>  validation/optim/lsr-and0.c | 14 ++++++++++++++
>  validation/optim/lsr-and1.c | 18 ++++++++++++++++++
>  validation/optim/shl-and0.c | 14 ++++++++++++++
>  validation/optim/shl-and1.c | 18 ++++++++++++++++++
>  4 files changed, 64 insertions(+)
>  create mode 100644 validation/optim/lsr-and0.c
>  create mode 100644 validation/optim/lsr-and1.c
>  create mode 100644 validation/optim/shl-and0.c
>  create mode 100644 validation/optim/shl-and1.c
> 
> diff --git a/validation/optim/lsr-and0.c b/validation/optim/lsr-and0.c
> new file mode 100644
> index 000000000..292c0332f
> --- /dev/null
> +++ b/validation/optim/lsr-and0.c
> @@ -0,0 +1,14 @@
> +unsigned lsr_and0(unsigned x)
> +{
> +	unsigned t = (x & 0x00000fff);
> +	return (t >> 12) & t;
> +}
> +
> +/*
> + * check-name: lsr-and0
> + * check-command: test-linearize -Wno-decl $file
> + * check-known-to-fail
> + *
> + * check-output-ignore
> + * check-output-contains: ret\\..*\\$0$
> + */
> diff --git a/validation/optim/lsr-and1.c b/validation/optim/lsr-and1.c
> new file mode 100644
> index 000000000..906d9946f
> --- /dev/null
> +++ b/validation/optim/lsr-and1.c
> @@ -0,0 +1,18 @@
> +// If (t >> S) is simplified into (x >> S)
> +// then then whole expression will be 0.
> +// The test i sonly interesting if the sub-expression

s/i sonly/is only/

ATB,
Ramsay Jones

> +// (x & M) is referenced more than once.
> +unsigned foo(unsigned x)
> +{
> +	unsigned t = (x & 0xfffff000);
> +	return ((t >> 12) ^ (x >> 12)) & t;
> +}
> +
> +/*
> + * check-name: lsr-and1
> + * check-command: test-linearize -Wno-decl $file
> + * check-known-to-fail
> + *
> + * check-output-ignore
> + * check-output-contains: ret\\..*\\$0$
> + */
> diff --git a/validation/optim/shl-and0.c b/validation/optim/shl-and0.c
> new file mode 100644
> index 000000000..63b20501c
> --- /dev/null
> +++ b/validation/optim/shl-and0.c
> @@ -0,0 +1,14 @@
> +unsigned foo(unsigned x)
> +{
> +	unsigned t = (x & 0xfff00000);
> +	return (t << 12) & t;
> +}
> +
> +/*
> + * check-name: shl-and0
> + * check-command: test-linearize -Wno-decl $file
> + * check-known-to-fail
> + *
> + * check-output-ignore
> + * check-output-contains: ret\\..*\\$0$
> + */
> diff --git a/validation/optim/shl-and1.c b/validation/optim/shl-and1.c
> new file mode 100644
> index 000000000..b7876e4e0
> --- /dev/null
> +++ b/validation/optim/shl-and1.c
> @@ -0,0 +1,18 @@
> +// If (t << S) is simplified into (x << S)
> +// then then whole expression will be 0.
> +// The test is only interesting if the sub-expression
> +// (x & M) is referenced more than once.
> +unsigned foo(unsigned x)
> +{
> +	unsigned t = (x & 0x000fffff);
> +	return ((t << 12) ^ (x << 12)) & t;
> +}
> +
> +/*
> + * check-name: shl-and1
> + * check-command: test-linearize -Wno-decl $file
> + * check-known-to-fail
> + *
> + * check-output-ignore
> + * check-output-contains: ret\\..*\\$0$
> + */
> 



[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