On Sun, Sep 06, 2020 at 05:38:54PM +0100, Ramsay Jones wrote: > > > On 06/09/2020 13:40, Luc Van Oostenryck wrote: > > Add a few testcases showing the effectiveness of these > > simplifications and to catch possible future regressions. > > > > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> > > --- > > validation/optim/and-lsr-or-shl0.c | 12 ++++++++++++ > > validation/optim/and-lsr-or-shl1.c | 12 ++++++++++++ > > validation/optim/and-shl-or-lsr0.c | 13 +++++++++++++ > > validation/optim/lsr-or-lsr0.c | 20 ++++++++++++++++++++ > > validation/optim/trunc-or-shl0.c | 19 +++++++++++++++++++ > > 5 files changed, 76 insertions(+) > > create mode 100644 validation/optim/and-lsr-or-shl0.c > > create mode 100644 validation/optim/and-lsr-or-shl1.c > > create mode 100644 validation/optim/and-shl-or-lsr0.c > > create mode 100644 validation/optim/lsr-or-lsr0.c > > create mode 100644 validation/optim/trunc-or-shl0.c > > Given that these are new tests, I was (er..) expecting some > '*.expected' files! However, I guess (since they are all failing > tests anyway) those will come in future patches which will > actually implement the optimization. Yes, I've pending series for these (and a lot of others) which more or less depends on these tests. For *.expected files, I really want to avoid this because it would be more things that should be kept up to date. I prefer to add some comments and use the patterns tests, all n the same file. > > diff --git a/validation/optim/trunc-or-shl0.c b/validation/optim/trunc-or-shl0.c > > new file mode 100644 > > index 000000000000..4d85a6bd4ec4 > > --- /dev/null > > +++ b/validation/optim/trunc-or-shl0.c > > @@ -0,0 +1,19 @@ > > +char trunc_or_shl0a(unsigned a, unsigned b) > > +{ > > + return (a << 8) | b; > > +} > > + > > +char trunc_or_shl0b(unsigned a, unsigned b) > > +{ > > + return a | (b << 8); > > +} > > + > > +/* > > + * check-name: trunc-or-shl0 > > + * check-command: test-linearize -Wno-decl $file > > + * check-known-to-fail > > + * > > + * check-output-ignore > > + * check-output-excludes: or\\. > > + * check-output-excludes: shl\\. > > Hmm, I can't see an optimization for these two! :( > Care to explain just what you expect? (maybe with an > '*.expected' file?) I saw your other email about it but I just would like to add these sort of tests should really be read at the IR level, the output of 'test-linearize $file.c'. Sometimes, the C file is just a convoluted way to create some specific sequence of IR instructions. Also, often the name of the file and the comments directly refer to these instructions (like here 'trunc' for the instruction OP_TRUNC). For the simplification phase, it would be nice and easier to be able to do the tests directly in the IR format. It shouldn't take much time but ... one day ... maybe :) -- Luc