aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-03-02 09:27:40 +0100
committerJakub Jelinek <jakub@redhat.com>2023-03-19 06:28:53 +0100
commit726682897d877afacb8164130cbbc715f8b44784 (patch)
tree50ec073f06528c34cca935bea7069c93299f726e /gcc/testsuite/gcc.target
parent7b9e837e769474fa5e91958dd2a479837b1176cb (diff)
downloadgcc-726682897d877afacb8164130cbbc715f8b44784.zip
gcc-726682897d877afacb8164130cbbc715f8b44784.tar.gz
gcc-726682897d877afacb8164130cbbc715f8b44784.tar.bz2
fold-const: Ignore padding bits in native_interpret_expr REAL_CST reverse verification [PR108934]
In the following testcase we try to std::bit_cast a (pair of) integral value(s) which has some non-zero bits in the place of x86 long double (for 64-bit 16 byte type with 10 bytes actually loaded/stored by hw, for 32-bit 12 byte) and starting with my PR104522 change we reject that as native_interpret_expr fails on it. The PR104522 change extends what has been done before for MODE_COMPOSITE_P (but those don't have any padding bits) to all floating point types, because e.g. the exact x86 long double has various bit combinations we don't support, like pseudo-(denormals,infinities,NaNs) or unnormals. The HW handles some of those as exceptional cases and others similarly to the non-pseudo ones. But for the padding bits it actually doesn't load/store those bits at all, it loads/stores 10 bytes. So, I think we should exempt the padding bits from the reverse comparison (the native_encode_expr bits for the padding will be all zeros), which the following patch does. For bit_cast it is similar to e.g. ignoring padding bits if the destination is a structure which has padding bits in there. The change changed auto-init-4.c to how it has been behaving before the PR105259 change, where some more VCEs can be now done. 2023-03-02 Jakub Jelinek <jakub@redhat.com> PR c++/108934 * fold-const.cc (native_interpret_expr) <case REAL_CST>: Before memcmp comparison copy the bytes from ptr to a temporary buffer and clearing padding bits in there. * gcc.target/i386/auto-init-4.c: Revert PR105259 change. * g++.target/i386/pr108934.C: New test. (cherry picked from commit cc88366a80e35b3e53141f49d3071010ff3c2ef8)
Diffstat (limited to 'gcc/testsuite/gcc.target')
-rw-r--r--gcc/testsuite/gcc.target/i386/auto-init-4.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gcc/testsuite/gcc.target/i386/auto-init-4.c b/gcc/testsuite/gcc.target/i386/auto-init-4.c
index 5b4fd87..d9af8f3 100644
--- a/gcc/testsuite/gcc.target/i386/auto-init-4.c
+++ b/gcc/testsuite/gcc.target/i386/auto-init-4.c
@@ -15,6 +15,5 @@ long double foo()
}
-/* The long double init isn't expanded optimally, see PR105259. For ia32
- it uses zero-initialization. */
-/* { dg-final { scan-assembler-times "long\t-16843010" 3 } } */
+/* { dg-final { scan-assembler-times "long\t-16843010" 5  { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "long\t-16843010" 3  { target { ia32 } } } } */