GEN_INT (offset2))));
}
-/* Use the TYPE_SIZE to distinguish the type with vector_size attribute and
- intrinsic vector type. Because we can't get the decl for the params. */
-
-static bool
-riscv_scalable_vector_type_p (const_tree type)
-{
- tree size = TYPE_SIZE (type);
- if (size && TREE_CODE (size) == INTEGER_CST)
- return false;
-
- /* For the data type like vint32m1_t, the size code is POLY_INT_CST. */
- return true;
-}
+/* Return true if a vector type is included in the type TYPE. */
static bool
riscv_arg_has_vector (const_tree type)
{
- bool is_vector = false;
+ if (riscv_v_ext_mode_p (TYPE_MODE (type)))
+ return true;
+
+ if (!COMPLETE_TYPE_P (type))
+ return false;
switch (TREE_CODE (type))
{
case RECORD_TYPE:
- if (!COMPLETE_TYPE_P (type))
- break;
-
+ /* If it is a record, it is further determined whether its fileds have
+ vector type. */
for (tree f = TYPE_FIELDS (type); f; f = DECL_CHAIN (f))
if (TREE_CODE (f) == FIELD_DECL)
{
if (!TYPE_P (field_type))
break;
- /* Ignore it if it's fixed length vector. */
- if (VECTOR_TYPE_P (field_type))
- is_vector = riscv_scalable_vector_type_p (field_type);
- else
- is_vector = riscv_arg_has_vector (field_type);
+ if (riscv_arg_has_vector (field_type))
+ return true;
}
-
- break;
-
- case VECTOR_TYPE:
- is_vector = riscv_scalable_vector_type_p (type);
- break;
-
- default:
- is_vector = false;
break;
+ case ARRAY_TYPE:
+ return riscv_arg_has_vector (TREE_TYPE (type));
}
- return is_vector;
+ return false;
}
/* Pass the type to check whether it's a vector type or contains vector type.
{
static int warned = 0;
- if (type && riscv_arg_has_vector (type) && !warned)
+ if (type && riscv_v_ext_mode_p (TYPE_MODE (type)) && !warned)
{
- warning (OPT_Wpsabi, "ABI for the scalable vector type is currently in "
- "experimental stage and may changes in the upcoming version of "
- "GCC.");
+ warning (OPT_Wpsabi,
+ "ABI for the vector type is currently in experimental stage and "
+ "may changes in the upcoming version of GCC.");
warned = 1;
}
}
/* { dg-do compile } */
-/* { dg-options "-march=rv32gcv -mabi=ilp32 -mpreferred-stack-boundary=3 -fno-schedule-insns -fno-schedule-insns2 -O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -mpreferred-stack-boundary=3 -fno-schedule-insns -fno-schedule-insns2 -O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include "riscv_vector.h"
/* { dg-do compile } */
-/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include <stdint-gcc.h>
/* { dg-do compile } */
-/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include <stdint-gcc.h>
/* { dg-do compile } */
-/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include <stdint-gcc.h>
/* { dg-do compile } */
-/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include <stdint-gcc.h>
/* { dg-do compile } */
-/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include <stdint-gcc.h>
/* { dg-do compile } */
-/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include <stdint-gcc.h>
/* { dg-do compile } */
-/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include <stdint-gcc.h>
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include "merge-1.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include "merge-2.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include "merge-3.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include "merge-4.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include "merge-5.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include "merge-6.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-O3 --param riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include "merge-7.c"
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv64gcv -mabi=lp64d" } */
+/* { dg-additional-options "-march=rv64gcv -mabi=lp64d -Wno-psabi" } */
#include "perm.h"
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv64gcv -mabi=lp64d" } */
+/* { dg-additional-options "-march=rv64gcv -mabi=lp64d -Wno-psabi" } */
#include "perm.h"
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv64gcv -mabi=lp64d" } */
+/* { dg-additional-options "-march=rv64gcv -mabi=lp64d -Wno-psabi" } */
#include "perm.h"
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv64gcv -mabi=lp64d" } */
+/* { dg-additional-options "-march=rv64gcv -mabi=lp64d -Wno-psabi" } */
#include "perm.h"
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv64gcv -mabi=lp64d" } */
+/* { dg-additional-options "-march=rv64gcv -mabi=lp64d -Wno-psabi" } */
#include "perm.h"
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv64gcv -mabi=lp64d" } */
+/* { dg-additional-options "-march=rv64gcv -mabi=lp64d -Wno-psabi" } */
#include "perm.h"
/* { dg-do compile } */
-/* { dg-additional-options "-march=rv64gcv -mabi=lp64d" } */
+/* { dg-additional-options "-march=rv64gcv -mabi=lp64d -Wno-psabi" } */
#include "perm.h"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3" } */
+/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3 -Wno-psabi" } */
#include "perm-1.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3" } */
+/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3 -Wno-psabi" } */
#include "perm-2.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3" } */
+/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3 -Wno-psabi" } */
#include "perm-3.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3" } */
+/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3 -Wno-psabi" } */
#include "perm-4.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3" } */
+/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3 -Wno-psabi" } */
#include "perm-5.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3" } */
+/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O3 -Wno-psabi" } */
#include "perm-6.c"
/* { dg-do run { target { riscv_vector } } } */
-/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O0" } */
+/* { dg-options "--param riscv-autovec-preference=fixed-vlmax -O0 -Wno-psabi" } */
#include "perm-7.c"
/* { dg-do compile } */
-/* { dg-options "-march=rv64gcv --param=riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include "riscv_vector.h"
/* { dg-do compile } */
-/* { dg-options "-march=rv64gczve32x --param=riscv-autovec-preference=fixed-vlmax" } */
+/* { dg-options "-march=rv64gczve32x -mabi=lp64d --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */
#include <stdint.h>
#include "riscv_vector.h"
#include "riscv_vector.h"
void
-fun (vint32m1_t a) { } /* { dg-warning "the scalable vector type" } */
+fun (vint32m1_t a) { } /* { dg-warning "the vector type" } */
void
bar ()
#include "riscv_vector.h"
vint32m1_t
-fun (vint32m1_t* a) { return *a; } /* { dg-warning "the scalable vector type" } */
+fun (vint32m1_t* a) { return *a; } /* { dg-warning "the vector type" } */
void
bar ()
#include "riscv_vector.h"
vint32m1_t*
-fun (vint32m1_t* a) { return a; } /* { dg-bogus "the scalable vector type" } */
+fun (vint32m1_t* a) { return a; } /* { dg-bogus "the vector type" } */
void
bar ()
typedef int v4si __attribute__ ((vector_size (16)));
v4si
-fun (v4si a) { return a; } /* { dg-bogus "the scalable vector type" } */
+fun (v4si a) { return a; } /* { dg-bogus "the vector type" } */
void
bar ()
/* { dg-options "-march=rv64gcv -mabi=lp64d" } */
typedef int v4si __attribute__ ((vector_size (16)));
-struct A { int a; v4si b; };
+struct A { int a; int b; };
+
+void foo (int b);
void
-fun (struct A a) {} /* { dg-bogus "the scalable vector type" } */
+fun (struct A a) {
+
+ foo (a.b);
+} /* { dg-bogus "the vector type" } */
void
bar ()
vl = __riscv_vsetvlmax_e16mf2();
for (size_t i = 0; i < n; i += 1)
{
- vint32m1_t a = __riscv_vle32_v_i32m1(in1, vl); /* { dg-bogus "the scalable vector type" } */
+ vint32m1_t a = __riscv_vle32_v_i32m1(in1, vl); /* { dg-bogus "the vector type" } */
vint32m1_t b = __riscv_vle32_v_i32m1_tu(a, in2, vl);
vint32m1_t c = __riscv_vle32_v_i32m1_tu(b, in3, vl);
__riscv_vse32_v_i32m1(out, c, vl);
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -march=rv64gcv -mabi=lp64d" } */
+
+#include "riscv_vector.h"
+
+void
+fun (vint32m1x3_t a) { } /* { dg-warning "the vector type" } */
+
+void
+bar ()
+{
+ vint32m1x3_t a;
+ fun (a);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d" } */
+
+#include "riscv_vector.h"
+
+vint32m1x3_t*
+fun (vint32m1x3_t* a) { return a; } /* { dg-bogus "the vector type" } */
+
+void
+bar ()
+{
+ vint32m1x3_t a;
+ fun (&a);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d --param=riscv-autovec-preference=fixed-vlmax" } */
+
+#include "riscv_vector.h"
+
+typedef int v4si __attribute__ ((vector_size (16)));
+
+v4si
+fun (v4si a) { return a; } /* { dg-warning "the vector type" } */
+
+void
+bar ()
+{
+ v4si a;
+ fun (a);
+}