aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/nvptx/nvptx.c11
-rw-r--r--gcc/testsuite/gcc.target/nvptx/v2si-cvt.c34
2 files changed, 22 insertions, 23 deletions
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index d2f321f..d8a8fb2 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -6463,6 +6463,14 @@ nvptx_can_change_mode_class (machine_mode, machine_mode, reg_class_t)
return false;
}
+/* Implement TARGET_TRULY_NOOP_TRUNCATION. */
+
+static bool
+nvptx_truly_noop_truncation (poly_uint64, poly_uint64)
+{
+ return false;
+}
+
static GTY(()) tree nvptx_previous_fndecl;
static void
@@ -6612,6 +6620,9 @@ nvptx_set_current_function (tree fndecl)
#undef TARGET_CAN_CHANGE_MODE_CLASS
#define TARGET_CAN_CHANGE_MODE_CLASS nvptx_can_change_mode_class
+#undef TARGET_TRULY_NOOP_TRUNCATION
+#define TARGET_TRULY_NOOP_TRUNCATION nvptx_truly_noop_truncation
+
#undef TARGET_HAVE_SPECULATION_SAFE_VALUE
#define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
diff --git a/gcc/testsuite/gcc.target/nvptx/v2si-cvt.c b/gcc/testsuite/gcc.target/nvptx/v2si-cvt.c
index 73f86bc..35b9fc3 100644
--- a/gcc/testsuite/gcc.target/nvptx/v2si-cvt.c
+++ b/gcc/testsuite/gcc.target/nvptx/v2si-cvt.c
@@ -3,37 +3,25 @@
typedef int __v2si __attribute__((__vector_size__(8)));
-int __attribute__((unused))
+__v2si __attribute__((unused))
vector_cvt (__v2si arg)
{
- __v2si val4 = arg;
- char *p = (char*)&val4;
+ unsigned short *p = (unsigned short*)&arg;
- if (p[0] != 1)
- return 1;
- if (p[1] != 2)
- return 1;
- if (p[2] != 3)
- return 1;
+ volatile unsigned short s = p[0];
- return 0;
+ return arg;
}
-int
-vector_cvt_2 (__v2si val, __v2si val2)
+__v2si __attribute__((unused))
+vector_cvt_2 (__v2si arg)
{
- char *p = (char*)&val;
- char *p2 = (char*)&val2;
+ unsigned char *p = (unsigned char*)&arg;
- if (p[0] != p2[0])
- return 1;
- if (p[4] != p2[4])
- return 1;
+ volatile unsigned char s = p[0];
- return 0;
+ return arg;
}
-/* We want to test for 'mov.t' here, but given PR80845 we test for cvt.t.t
- instead.
- { dg-final { scan-assembler "(?n)cvt\\.u32\\.u32.*\\.x" } } */
-/* { dg-final { scan-assembler "(?n)cvt\\.u16\\.u32.*\\.x" } } */
+/* Todo: We'd like to generate insns with .x operands to access the v2si
+ operands, but that's currently not done, see PR96403. */