VEX side fixes to match r12190, which is a fix for #279698 (incorrect
Memcheck handling of saturating narrowing operations.)
git-svn-id: svn://svn.valgrind.org/vex/trunk@2223 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/host_generic_simd64.c b/priv/host_generic_simd64.c
index 61bdbd3..693d796 100644
--- a/priv/host_generic_simd64.c
+++ b/priv/host_generic_simd64.c
@@ -296,6 +296,16 @@
return (UChar)xx;
}
+static inline UShort narrow32to16 ( UInt xx )
+{
+ return (UShort)xx;
+}
+
+static inline UChar narrow16to8 ( UShort xx )
+{
+ return (UChar)xx;
+}
+
/* shifts: we don't care about out-of-range ones, since
that is dealt with at a higher level. */
@@ -817,6 +827,44 @@
);
}
+/* ------------ Truncating narrowing ------------ */
+
+ULong h_generic_calc_NarrowBin32to16x4 ( ULong aa, ULong bb )
+{
+ UInt d = sel32x2_1(aa);
+ UInt c = sel32x2_0(aa);
+ UInt b = sel32x2_1(bb);
+ UInt a = sel32x2_0(bb);
+ return mk16x4(
+ narrow32to16(d),
+ narrow32to16(c),
+ narrow32to16(b),
+ narrow32to16(a)
+ );
+}
+
+ULong h_generic_calc_NarrowBin16to8x8 ( ULong aa, ULong bb )
+{
+ UShort h = sel16x4_3(aa);
+ UShort g = sel16x4_2(aa);
+ UShort f = sel16x4_1(aa);
+ UShort e = sel16x4_0(aa);
+ UShort d = sel16x4_3(bb);
+ UShort c = sel16x4_2(bb);
+ UShort b = sel16x4_1(bb);
+ UShort a = sel16x4_0(bb);
+ return mk8x8(
+ narrow16to8(h),
+ narrow16to8(g),
+ narrow16to8(f),
+ narrow16to8(e),
+ narrow16to8(d),
+ narrow16to8(c),
+ narrow16to8(b),
+ narrow16to8(a)
+ );
+}
+
/* ------------ Interleaving ------------ */
ULong h_generic_calc_InterleaveHI8x8 ( ULong aa, ULong bb )