From d3d44a00e511f0402e8a2449c1c9c27f28ac9cf7 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Wed, 8 Dec 2021 14:21:49 +0100 Subject: [PATCH] nvptx: Add test-case gcc.target/nvptx/exttrunc-1.c Add new test-case converting short to char and back to short. Tested on nvptx. gcc/testsuite/ChangeLog: * gcc.target/nvptx/exttrunc-1.c: New test case. --- gcc/testsuite/gcc.target/nvptx/exttrunc-1.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.target/nvptx/exttrunc-1.c diff --git a/gcc/testsuite/gcc.target/nvptx/exttrunc-1.c b/gcc/testsuite/gcc.target/nvptx/exttrunc-1.c new file mode 100644 index 0000000..ed9ceee --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/exttrunc-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +short exttrunc_hi2_qi(short x) +{ + return (char)x; +} + +/* Match: + mov.u32 %r24, %ar0; + cvt.u32.u32 %r26, %r24; + cvt.s32.s8 %value, %r26; + Todo: Remove cvt.u32.u32. */ + +/* { dg-final { scan-assembler-times "mov\.u32\t%r\[0-9\]*, %ar0" 1 } } */ +/* { dg-final { scan-assembler-times "mov\." 1 } } */ + +/* { dg-final { scan-assembler-times "cvt\.u32\.u32" 1 } } */ +/* { dg-final { scan-assembler-times "cvt\.s32\.s8" 1 } } */ +/* { dg-final { scan-assembler-times "cvt\." 2 } } */ -- 2.7.4