x86: Use unsigned short to compute pextrw result
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 5 Jan 2021 18:57:20 +0000 (10:57 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 5 Jan 2021 19:03:38 +0000 (11:03 -0800)
Use unsigned short to compute the zero-extended pextrw result.

PR target/98495
* gcc.target/i386/sse2-mmx-pextrw.c (compute_correct_result): Use
unsigned short to compute pextrw result.

gcc/testsuite/gcc.target/i386/sse2-mmx-pextrw.c

index bb48740a7ca21df571b9ac0548539dd83ce5878c..edbac919fd81bfbd7310d35b3ca376a62ea3757f 100644 (file)
@@ -32,7 +32,7 @@ test_pextrw (__m64 *i, unsigned int imm, int *r)
 static void
 compute_correct_result (__m64 *src_p, unsigned int imm, int *res_p)
 {
-  short *src = (short *) src_p;
+  unsigned short *src = (unsigned short *) src_p;
   if (imm < 4)
     *res_p = src[imm];
 }