Add git_jit_type_is_floating_point() function
For gcc_jit_type_is_float() add unit tests and function description
Rename gcc_jit_type_is_float to gcc_jit_type_is_floating
improve description
Remove unecessary spaces
diff --git a/gcc/jit/docs/topics/types.rst b/gcc/jit/docs/topics/types.rst
index a752034..6885f5a 100644
--- a/gcc/jit/docs/topics/types.rst
+++ b/gcc/jit/docs/topics/types.rst
@@ -438,6 +438,11 @@
Return non-zero if the type is an integral.
+.. function:: int\
+ gcc_jit_type_is_floating_point (gcc_jit_type *type)
+
+ Return non-zero if the type is floating point.
+
.. function:: gcc_jit_type *\
gcc_jit_type_is_pointer (gcc_jit_type *type)
diff --git a/gcc/jit/libgccjit.cc b/gcc/jit/libgccjit.cc
index 527cb32..6d8f74c 100644
--- a/gcc/jit/libgccjit.cc
+++ b/gcc/jit/libgccjit.cc
@@ -639,6 +639,23 @@
/* Public entrypoint. See description in libgccjit.h.
After error-checking, the real work is done by the
+ gcc::jit::recording::type::is_float method, in
+ jit-recording.cc. */
+
+int
+gcc_jit_type_is_floating_point (gcc_jit_type *type)
+{
+ RETURN_VAL_IF_FAIL (type, FALSE, NULL, NULL, "NULL type");
+
+ if (type->is_vector())
+ return false;
+
+ return type->is_float ();
+}
+
+/* Public entrypoint. See description in libgccjit.h.
+
+ After error-checking, the real work is done by the
gcc::jit::recording::type::is_vector method, in
jit-recording.cc. */
diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h
index e216a97..280304c 100644
--- a/gcc/jit/libgccjit.h
+++ b/gcc/jit/libgccjit.h
@@ -2117,6 +2117,10 @@
extern int
gcc_jit_type_is_integral (gcc_jit_type *type);
+/* Return non-zero if the type is floating point */
+extern int
+gcc_jit_type_is_floating_point(gcc_jit_type * type);
+
/* Return the type pointed by the pointer type or NULL if it's not a
* pointer. */
extern gcc_jit_type *
diff --git a/gcc/jit/libgccjit.map b/gcc/jit/libgccjit.map
index 988c229..f6a19f5 100644
--- a/gcc/jit/libgccjit.map
+++ b/gcc/jit/libgccjit.map
@@ -359,21 +359,7 @@
gcc_jit_rvalue_set_location;
} LIBGCCJIT_ABI_38;
-LIBGCCJIT_ABI_41 {
+LIBGCCJIT_ABI_40 {
global:
gcc_jit_type_is_floating_point;
-} LIBGCCJIT_ABI_40;
-
-LIBGCCJIT_ABI_42 {
- global:
- gcc_jit_lvalue_remove;
-} LIBGCCJIT_ABI_41;
-
-LIBGCCJIT_ABI_43 {
- global:
- gcc_jit_rvalue_set_type;
-} LIBGCCJIT_ABI_42;
-
-LIBGCCJIT_ABI_44 {
- gcc_jit_lvalue_add_attribute;
-} LIBGCCJIT_ABI_43;
+} LIBGCCJIT_ABI_39;
diff --git a/gcc/testsuite/jit.dg/test-reflection.c b/gcc/testsuite/jit.dg/test-reflection.c
index afa76ff..85c8039 100644
--- a/gcc/testsuite/jit.dg/test-reflection.c
+++ b/gcc/testsuite/jit.dg/test-reflection.c
@@ -24,11 +24,52 @@
gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_DOUBLE);
CHECK_VALUE (gcc_jit_function_get_return_type(builtin_sin), double_type);
CHECK (!gcc_jit_type_is_integral(double_type));
+ CHECK (gcc_jit_type_is_floating_point(double_type));
+
+ gcc_jit_type *float_type =
+ gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_FLOAT);
+ CHECK (!gcc_jit_type_is_bool(float_type));
+ CHECK (!gcc_jit_type_is_integral(float_type));
+ CHECK (gcc_jit_type_is_floating_point(float_type));
+
+ gcc_jit_target_info *target_info = gcc_jit_context_get_target_info(ctxt);
+ if (target_info != NULL && gcc_jit_target_info_supports_target_dependent_type(target_info, GCC_JIT_TYPE_FLOAT16))
+ {
+ gcc_jit_type *float16_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_FLOAT16);
+ CHECK (!gcc_jit_type_is_bool(float16_type));
+ CHECK (!gcc_jit_type_is_integral(float16_type));
+ CHECK (gcc_jit_type_is_floating_point(float16_type));
+ }
+
+ if (target_info != NULL && gcc_jit_target_info_supports_target_dependent_type(target_info, GCC_JIT_TYPE_FLOAT32))
+ {
+ gcc_jit_type *float32_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_FLOAT32);
+ CHECK (!gcc_jit_type_is_bool(float32_type));
+ CHECK (!gcc_jit_type_is_integral(float32_type));
+ CHECK (gcc_jit_type_is_floating_point(float32_type));
+ }
+
+ if (target_info != NULL && gcc_jit_target_info_supports_target_dependent_type(target_info, GCC_JIT_TYPE_FLOAT64))
+ {
+ gcc_jit_type *float64_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_FLOAT64);
+ CHECK (!gcc_jit_type_is_bool(float64_type));
+ CHECK (!gcc_jit_type_is_integral(float64_type));
+ CHECK (gcc_jit_type_is_floating_point(float64_type));
+ }
+
+ if (target_info != NULL && gcc_jit_target_info_supports_target_dependent_type(target_info, GCC_JIT_TYPE_FLOAT128))
+ {
+ gcc_jit_type *float128_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_FLOAT128);
+ CHECK (!gcc_jit_type_is_bool(float128_type));
+ CHECK (!gcc_jit_type_is_integral(float128_type));
+ CHECK (gcc_jit_type_is_floating_point(float128_type));
+ }
gcc_jit_type *bool_type =
gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_BOOL);
CHECK (gcc_jit_type_is_bool(bool_type));
CHECK (!gcc_jit_type_is_integral(bool_type));
+ CHECK (!gcc_jit_type_is_floating_point(bool_type));
gcc_jit_type *aligned_bool_type =
gcc_jit_type_get_aligned(gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_BOOL), 8);
@@ -42,15 +83,19 @@
gcc_jit_type *int64 =
gcc_jit_context_get_int_type(ctxt, 8, 1);
CHECK (gcc_jit_type_is_integral(int64));
+ CHECK (!gcc_jit_type_is_floating_point(int64));
gcc_jit_type *uint64 =
gcc_jit_context_get_int_type(ctxt, 8, 0);
CHECK (gcc_jit_type_is_integral(uint64));
+ CHECK (!gcc_jit_type_is_floating_point(uint64));
gcc_jit_type *int8 =
gcc_jit_context_get_int_type(ctxt, 1, 1);
CHECK (gcc_jit_type_is_integral(int8));
+ CHECK (!gcc_jit_type_is_floating_point(int8));
gcc_jit_type *uint8 =
gcc_jit_context_get_int_type(ctxt, 1, 0);
CHECK (gcc_jit_type_is_integral(uint8));
+ CHECK (!gcc_jit_type_is_floating_point(uint8));
CHECK (!gcc_jit_type_dyncast_vector(double_type));
gcc_jit_type *vec_type = gcc_jit_type_get_vector (double_type, 4);