On Thu, Sep 17, 2020 at 11:11 PM Hongtao Liu <crazy...@gmail.com> wrote: > > On Thu, Sep 17, 2020 at 12:10 PM Jeff Law <l...@redhat.com> wrote: > > > > > > On 9/15/20 9:20 PM, Hongtao Liu via Gcc-patches wrote: > > > Hi: > > > Rtx cost of sse_to_integer would be used by pass_stv as a > > > measurement for the scalar-to-vector transformation. As > > > https://gcc.gnu.org/pipermail/gcc-patches/2019-August/528839.html > > > indicates, movement between sse regs and gprs should be much expensive > > > than movement inside gprs(which is 2 as default). This patch would > > > also fix "pr96861". > > > > > > Bootstrap is ok, regression test is ok for both "i386.exp=* > > > --target_board='unix{-m32,}'" and "i386.exp=* > > > --target_board='unix{-m32\ -march=cascadelake,-m64\ > > > -march=cascadelake}"". > > > No big impact on SPEC2017. > > > Ok for trunk? > > > > > > gcc/ChangeLog > > > > > > PR target/96861 > > > * config/i386/x86-tune-costs.h (skylake_cost): increase rtx > > > cost of sse_to_integer from 2 to 6. > > > > > > gcc/testsuite > > > > > > * gcc.target/i386/pr95021-3.c: Add -mtune=generic. > > > > I'll defer to HJ's judgement here. If he's OK with it, then it's fine > > by me. > > > > I've talked to H.J and he agrees on this patch. > So i'm going to check in this patch.
I am checking this patch to add a testcase. -- H.J.
From 474d34ec403e5b8808e16b9a6460a896322fa3d0 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" <hjl.to...@gmail.com> Date: Sat, 19 Sep 2020 09:57:16 -0700 Subject: [PATCH] x86: Add a testcase for PR target/96861 Add a testcase to verify that -march=skylake-avx512 -mtune=skylake-avx512 generates desired code sequence. PR target/96861 * gcc.target/i386/pr96861.c: New test. --- gcc/testsuite/gcc.target/i386/pr96861.c | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr96861.c diff --git a/gcc/testsuite/gcc.target/i386/pr96861.c b/gcc/testsuite/gcc.target/i386/pr96861.c new file mode 100644 index 00000000000..7b7aeccb83c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr96861.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mstv -march=skylake-avx512 -mtune=skylake-avx512" } */ + +#define max(a,b) (((a) > (b))? (a) : (b)) +#define min(a,b) (((a) < (b))? (a) : (b)) + +int smax1(int x) +{ + return max(x,1); +} + +int smin1(int x) +{ + return min(x,1); +} + +int smaxm1(int x) +{ + return max(x,-1); +} + +int sminm1(int x) +{ + return min(x,-1); +} + +unsigned int umax1(unsigned int x) +{ + return max(x,1); +} + +unsigned int umin1(unsigned int x) +{ + return min(x,1); +} + +/* { dg-final { scan-assembler-times "test" 6 } } */ +/* { dg-final { scan-assembler-not "cmp" } } */ -- 2.26.2