aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.dg
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2023-02-27 16:02:21 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2023-03-03 01:24:28 +0100
commit51af8a6401eea726d3498e6b2aba456b6af246d6 (patch)
tree896bb861a63434eca3f5aec7c30de518ab106b89 /gcc/testsuite/gdc.dg
parent14db9ed505d9eb84695f900017a95bc3f6c27ffe (diff)
downloadgcc-51af8a6401eea726d3498e6b2aba456b6af246d6.zip
gcc-51af8a6401eea726d3498e6b2aba456b6af246d6.tar.gz
gcc-51af8a6401eea726d3498e6b2aba456b6af246d6.tar.bz2
d: vector float comparison doesn't result in 0 or -1 [PR108945]
When comparing two vectors, the type of vector was used as the result of the condition result. This meant that for floating point comparisons, each value would either be `0.0' or `-1.0' reinterpreted as an integer, not the expected integral bitmask values `0' and `-1'. Instead, use the comparison type determined by truth_type_for as the result of the comparison. If a reinterpret is later required by the final conversion for generating CmpExp, it is still only going to reinterpret one integer kind as another. PR d/108945 gcc/d/ChangeLog: * d-codegen.cc (build_boolop): Evaluate vector comparison as the truth_type_for vector type. gcc/testsuite/ChangeLog: * gdc.dg/pr108945.d: New test.
Diffstat (limited to 'gcc/testsuite/gdc.dg')
-rw-r--r--gcc/testsuite/gdc.dg/pr108945.d12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.dg/pr108945.d b/gcc/testsuite/gdc.dg/pr108945.d
new file mode 100644
index 0000000..03b9de8
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr108945.d
@@ -0,0 +1,12 @@
+// { dg-options "-fdump-tree-gimple" }
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
+
+alias f4 = __vector(float[4]);
+
+auto pr108945(f4 a, f4 b)
+{
+ return a < b;
+}
+
+// { dg-final { scan-tree-dump-not "VEC_COND_EXPR" "gimple" } }