зеркало из https://github.com/microsoft/clang-1.git
fix some vector extractions to return properly zero extended values
(instead of sign extending) to match ICC. GCC is changing this in a series of their own PRs (e.g. 41323). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111637 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
074dcc8ef8
Коммит
d6b84b9455
|
@ -1194,7 +1194,7 @@ static __inline__ int __attribute__((__always_inline__, __nodebug__))
|
|||
_mm_extract_epi16(__m128i a, int imm)
|
||||
{
|
||||
__v8hi b = (__v8hi)a;
|
||||
return b[imm];
|
||||
return (unsigned short)b[imm];
|
||||
}
|
||||
|
||||
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
|
||||
|
|
|
@ -213,11 +213,13 @@ _mm_max_epu32 (__m128i __V1, __m128i __V2)
|
|||
__a;}))
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
/* Extract int from packed integer array at index. */
|
||||
/* Extract int from packed integer array at index. This returns the element
|
||||
* as a zero extended value, so it is unsigned.
|
||||
*/
|
||||
#define _mm_extract_epi8(X, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \
|
||||
__a[N];}))
|
||||
(unsigned char)__a[N];}))
|
||||
#define _mm_extract_epi32(X, N) (__extension__ ({ __v4si __a = (__v4si)(X); \
|
||||
__a[N];}))
|
||||
(unsigned)__a[N];}))
|
||||
#ifdef __x86_64__
|
||||
#define _mm_extract_epi64(X, N) (__extension__ ({ __v2di __a = (__v2di)(X); \
|
||||
__a[N];}))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -triple i386-apple-darwin9 -target-cpu pentium4 -g -emit-llvm %s -o -
|
||||
// RUN: %clang_cc1 -triple i386-apple-darwin9 -O1 -target-cpu pentium4 -target-feature +sse4.1 -g -emit-llvm %s -o - | FileCheck %s
|
||||
typedef short __v4hi __attribute__ ((__vector_size__ (8)));
|
||||
|
||||
void test1() {
|
||||
|
@ -40,3 +40,16 @@ int test4(int argc, char *argv[]) {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
#include <smmintrin.h>
|
||||
|
||||
unsigned long test_epi8(__m128i x) { return _mm_extract_epi8(x, 4); }
|
||||
// CHECK: @test_epi8
|
||||
// CHECK: extractelement <16 x i8> {{.*}}, i32 4
|
||||
// CHECK: zext i8 {{.*}} to i32
|
||||
|
||||
unsigned long test_epi16(__m128i x) { return _mm_extract_epi16(x, 3); }
|
||||
|
||||
// CHECK: @test_epi16
|
||||
// CHECK: extractelement <8 x i16> {{.*}}, i32 3
|
||||
// CHECK: zext i16 {{.*}} to i32
|
||||
|
|
Загрузка…
Ссылка в новой задаче