graphene: fix public api when using gcc vectors
This commit is contained in:
parent
d25c0b0986
commit
c793089741
|
@ -0,0 +1,125 @@
|
||||||
|
From 2756f97c802d6c461cab2a865a98a09504410083 Mon Sep 17 00:00:00 2001
|
||||||
|
From: q66 <daniel@octaforge.org>
|
||||||
|
Date: Sun, 5 Sep 2021 15:21:39 +0200
|
||||||
|
Subject: [PATCH] Fix various broken macros when using GCC extension vectors
|
||||||
|
|
||||||
|
Commit 8e5c25109898fa4894df810a546b26c387eaae93 introduced
|
||||||
|
some pragmas, however those unintentionally change the types
|
||||||
|
of the macros, as the diagnostic pop pragma becomes the last
|
||||||
|
statement and the type of the expression becomes void.
|
||||||
|
|
||||||
|
Work around this by using a temporary and evaluating to that
|
||||||
|
before popping.
|
||||||
|
---
|
||||||
|
include/graphene-simd4f.h | 21 ++++++++++++++-------
|
||||||
|
1 file changed, 14 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/graphene-simd4f.h b/include/graphene-simd4f.h
|
||||||
|
index f95fe04..ea29ba3 100644
|
||||||
|
--- a/include/graphene-simd4f.h
|
||||||
|
+++ b/include/graphene-simd4f.h
|
||||||
|
@@ -858,13 +858,14 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16)));
|
||||||
|
(__extension__ ({ \
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \
|
||||||
|
- (graphene_simd4f_t) { \
|
||||||
|
+ const graphene_simd4f_t __val = (graphene_simd4f_t) { \
|
||||||
|
(v)[0] != 0.f ? 1.f / (v)[0] : 0.f, \
|
||||||
|
(v)[1] != 0.f ? 1.f / (v)[1] : 0.f, \
|
||||||
|
(v)[2] != 0.f ? 1.f / (v)[2] : 0.f, \
|
||||||
|
(v)[3] != 0.f ? 1.f / (v)[3] : 0.f, \
|
||||||
|
}; \
|
||||||
|
_Pragma ("GCC diagnostic pop") \
|
||||||
|
+ __val; \
|
||||||
|
}))
|
||||||
|
|
||||||
|
# define graphene_simd4f_sqrt(v) \
|
||||||
|
@@ -881,13 +882,14 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16)));
|
||||||
|
(__extension__ ({ \
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \
|
||||||
|
- (graphene_simd4f_t) { \
|
||||||
|
+ const graphene_simd4f_t __val = (graphene_simd4f_t) { \
|
||||||
|
(v)[0] != 0.f ? 1.f / sqrtf ((v)[0]) : 0.f, \
|
||||||
|
(v)[1] != 0.f ? 1.f / sqrtf ((v)[1]) : 0.f, \
|
||||||
|
(v)[2] != 0.f ? 1.f / sqrtf ((v)[2]) : 0.f, \
|
||||||
|
(v)[3] != 0.f ? 1.f / sqrtf ((v)[3]) : 0.f, \
|
||||||
|
}; \
|
||||||
|
_Pragma ("GCC diagnostic pop") \
|
||||||
|
+ __val; \
|
||||||
|
}))
|
||||||
|
|
||||||
|
# define graphene_simd4f_add(a,b) (__extension__ ({ (graphene_simd4f_t) ((a) + (b)); }))
|
||||||
|
@@ -1003,11 +1005,12 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16)));
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \
|
||||||
|
const graphene_simd4i_t __res = (a) == (b); \
|
||||||
|
- (bool) (__res[0] != 0 && \
|
||||||
|
+ const bool __val = (bool) (__res[0] != 0 && \
|
||||||
|
__res[1] != 0 && \
|
||||||
|
__res[2] != 0 && \
|
||||||
|
__res[3] != 0); \
|
||||||
|
_Pragma ("GCC diagnostic pop") \
|
||||||
|
+ __val; \
|
||||||
|
}))
|
||||||
|
|
||||||
|
# define graphene_simd4f_cmp_neq(a,b) (!graphene_simd4f_cmp_eq (a,b))
|
||||||
|
@@ -1017,11 +1020,12 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16)));
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \
|
||||||
|
const graphene_simd4i_t __res = (a) < (b); \
|
||||||
|
- (bool) (__res[0] != 0 && \
|
||||||
|
+ const bool __val = (bool) (__res[0] != 0 && \
|
||||||
|
__res[1] != 0 && \
|
||||||
|
__res[2] != 0 && \
|
||||||
|
__res[3] != 0); \
|
||||||
|
_Pragma ("GCC diagnostic pop") \
|
||||||
|
+ __val; \
|
||||||
|
}))
|
||||||
|
|
||||||
|
# define graphene_simd4f_cmp_le(a,b) \
|
||||||
|
@@ -1029,11 +1033,12 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16)));
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \
|
||||||
|
const graphene_simd4i_t __res = (a) <= (b); \
|
||||||
|
- (bool) (__res[0] != 0 && \
|
||||||
|
+ const bool __val = (bool) (__res[0] != 0 && \
|
||||||
|
__res[1] != 0 && \
|
||||||
|
__res[2] != 0 && \
|
||||||
|
__res[3] != 0); \
|
||||||
|
_Pragma ("GCC diagnostic pop") \
|
||||||
|
+ __val; \
|
||||||
|
}))
|
||||||
|
|
||||||
|
# define graphene_simd4f_cmp_ge(a,b) \
|
||||||
|
@@ -1041,11 +1046,12 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16)));
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \
|
||||||
|
const graphene_simd4i_t __res = (a) >= (b); \
|
||||||
|
- (bool) (__res[0] != 0 && \
|
||||||
|
+ const bool __val = (bool) (__res[0] != 0 && \
|
||||||
|
__res[1] != 0 && \
|
||||||
|
__res[2] != 0 && \
|
||||||
|
__res[3] != 0); \
|
||||||
|
_Pragma ("GCC diagnostic pop") \
|
||||||
|
+ __val; \
|
||||||
|
}))
|
||||||
|
|
||||||
|
# define graphene_simd4f_cmp_gt(a,b) \
|
||||||
|
@@ -1053,11 +1059,12 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16)));
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \
|
||||||
|
const graphene_simd4i_t __res = (a) > (b); \
|
||||||
|
- (bool) (__res[0] != 0 && \
|
||||||
|
+ const bool __val = (bool) (__res[0] != 0 && \
|
||||||
|
__res[1] != 0 && \
|
||||||
|
__res[2] != 0 && \
|
||||||
|
__res[3] != 0); \
|
||||||
|
_Pragma ("GCC diagnostic pop") \
|
||||||
|
+ __val; \
|
||||||
|
}))
|
||||||
|
|
||||||
|
# define graphene_simd4f_neg(s) \
|
||||||
|
--
|
||||||
|
2.32.0
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'graphene'
|
# Template file for 'graphene'
|
||||||
pkgname=graphene
|
pkgname=graphene
|
||||||
version=1.10.6
|
version=1.10.6
|
||||||
revision=2
|
revision=3
|
||||||
build_style=meson
|
build_style=meson
|
||||||
build_helper="gir"
|
build_helper="gir"
|
||||||
configure_args="-Dbenchmarks=false -Dinstalled_tests=false
|
configure_args="-Dbenchmarks=false -Dinstalled_tests=false
|
||||||
|
|
Loading…
Reference in New Issue