Blame SOURCES/0001-orcc-program-c-fix-64-bit-parameter-loading-loadpq-o.patch

65e934
From 29486d8c98655a6e14ec2af9f71489cbdda41a53 Mon Sep 17 00:00:00 2001
65e934
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
65e934
Date: Sat, 8 Nov 2014 13:23:12 +0000
65e934
Subject: [PATCH] orcc: program-c: fix 64-bit parameter loading (loadpq) on
65e934
 big-endian systems
65e934
65e934
When passing 64-bit parameters through OrcExecutor, we
65e934
have to split them up into two 32-bit parameters for
65e934
backwards compatibility reasons. When generating C code,
65e934
make sure that we split up 64-bit parameters in the same
65e934
way as loadpq will read them back later. The lower 32 bits
65e934
should end up in params[ORC_VAR_D1+i] and the higher bits
65e934
should end up in params[ORC_VAR_T1+i]. The way it was done
65e934
so far, the higher/lower bits ended up swapped on big endian
65e934
systems, and then got deserialised in swapped order by loadpq.
65e934
This resulted in bogus parameters being used.
65e934
65e934
In particular, this broke the gstreamer volume element and
65e934
its unit tests on big endian systems when handling samples
65e934
in F64 format (i.e. doubles).
65e934
65e934
https://bugzilla.gnome.org/show_bug.cgi?id=739354
65e934
---
65e934
 tools/orcc.c | 8 ++++----
65e934
 1 file changed, 4 insertions(+), 4 deletions(-)
65e934
65e934
diff --git a/tools/orcc.c b/tools/orcc.c
65e934
index d25b548..fdab530 100644
65e934
--- a/tools/orcc.c
65e934
+++ b/tools/orcc.c
65e934
@@ -843,9 +843,9 @@ output_code_execute (OrcProgram *p, FILE *output, int is_inline)
65e934
           fprintf(output, "  {\n");
65e934
           fprintf(output, "    orc_union64 tmp;\n");
65e934
           fprintf(output, "    tmp.i = %s;\n", varnames[ORC_VAR_P1 + i]);
65e934
-          fprintf(output, "    ex->params[%s] = tmp.x2[0];\n",
65e934
+          fprintf(output, "    ex->params[%s] = ((orc_uint64) tmp.i) & 0xffffffff;\n",
65e934
               enumnames[ORC_VAR_P1 + i]);
65e934
-          fprintf(output, "    ex->params[%s] = tmp.x2[1];\n",
65e934
+          fprintf(output, "    ex->params[%s] = ((orc_uint64) tmp.i) >> 32;\n",
65e934
               enumnames[ORC_VAR_T1 + i]);
65e934
           fprintf(output, "  }\n");
65e934
           break;
65e934
@@ -854,9 +854,9 @@ output_code_execute (OrcProgram *p, FILE *output, int is_inline)
65e934
           fprintf(output, "  {\n");
65e934
           fprintf(output, "    orc_union64 tmp;\n");
65e934
           fprintf(output, "    tmp.f = %s;\n", varnames[ORC_VAR_P1 + i]);
65e934
-          fprintf(output, "    ex->params[%s] = tmp.x2[0];\n",
65e934
+          fprintf(output, "    ex->params[%s] = ((orc_uint64) tmp.i) & 0xffffffff;\n",
65e934
               enumnames[ORC_VAR_P1 + i]);
65e934
-          fprintf(output, "    ex->params[%s] = tmp.x2[1];\n",
65e934
+          fprintf(output, "    ex->params[%s] = ((orc_uint64) tmp.i) >> 32;\n",
65e934
               enumnames[ORC_VAR_T1 + i]);
65e934
           fprintf(output, "  }\n");
65e934
           break;
65e934
-- 
65e934
2.4.3
65e934