summaryrefslogtreecommitdiff
path: root/gcc/config/aarch64/aarch64-builtins.c
diff options
context:
space:
mode:
authorjgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-31 15:32:44 +0000
committerjgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-31 15:32:44 +0000
commitab123284f42508bf2595aa6620635145c3179033 (patch)
tree66eaa4191309d1b9929def578ac52c50e2b14c23 /gcc/config/aarch64/aarch64-builtins.c
parente71cd51850347d223c30e3356666754f38d267c8 (diff)
downloadgcc-ab123284f42508bf2595aa6620635145c3179033.tar.gz
[AArch64_be] Don't fold reduction intrinsics.
gcc/ * config/aarch64/aarch64-builtins.c (aarch64_gimple_fold_builtin): Don't fold reduction operations for BYTES_BIG_ENDIAN. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213379 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/aarch64/aarch64-builtins.c')
-rw-r--r--gcc/config/aarch64/aarch64-builtins.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index fee17ecf637..58db77e91c6 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -1383,6 +1383,20 @@ aarch64_gimple_fold_builtin (gimple_stmt_iterator *gsi)
tree call = gimple_call_fn (stmt);
tree fndecl;
gimple new_stmt = NULL;
+
+ /* The operations folded below are reduction operations. These are
+ defined to leave their result in the 0'th element (from the perspective
+ of GCC). The architectural instruction we are folding will leave the
+ result in the 0'th element (from the perspective of the architecture).
+ For big-endian systems, these perspectives are not aligned.
+
+ It is therefore wrong to perform this fold on big-endian. There
+ are some tricks we could play with shuffling, but the mid-end is
+ inconsistent in the way it treats reduction operations, so we will
+ end up in difficulty. Until we fix the ambiguity - just bail out. */
+ if (BYTES_BIG_ENDIAN)
+ return false;
+
if (call)
{
fndecl = gimple_call_fndecl (stmt);