r229811 - [Headers] Add tests for _mm256_insert_epi64 and fix its definition

Filipe Cabecinhas me at filcab.net
Wed Feb 18 19:02:33 PST 2015


Author: filcab
Date: Wed Feb 18 21:02:33 2015
New Revision: 229811

URL: http://llvm.org/viewvc/llvm-project?rev=229811&view=rev
Log:
[Headers] Add tests for _mm256_insert_epi64 and fix its definition

Summary:
The definition for _mm256_insert_epi64 was taking an int, which would get
truncated before being inserted in the vector.

Original patch by Joshua Magee!

Reviewers: bruno, craig.topper

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7179

Modified:
    cfe/trunk/lib/Headers/avxintrin.h
    cfe/trunk/test/CodeGen/avx-builtins.c

Modified: cfe/trunk/lib/Headers/avxintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avxintrin.h?rev=229811&r1=229810&r2=229811&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avxintrin.h (original)
+++ cfe/trunk/lib/Headers/avxintrin.h Wed Feb 18 21:02:33 2015
@@ -514,7 +514,7 @@ _mm256_insert_epi8(__m256i __a, int __b,
 
 #ifdef __x86_64__
 static __inline __m256i __attribute__((__always_inline__, __nodebug__))
-_mm256_insert_epi64(__m256i __a, int __b, int const __imm)
+_mm256_insert_epi64(__m256i __a, long __b, int const __imm)
 {
   __v4di __c = (__v4di)__a;
   __c[__imm & 3] = __b;

Modified: cfe/trunk/test/CodeGen/avx-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx-builtins.c?rev=229811&r1=229810&r2=229811&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx-builtins.c Wed Feb 18 21:02:33 2015
@@ -123,3 +123,27 @@ __m256 test_256_blend_ps(__m256 __a, __m
   // CHECK: shufflevector <8 x float> %{{.*}}, <8 x float> %{{.*}}, <8 x i32> <i32 8, i32 1, i32 10, i32 3, i32 12, i32 13, i32 6, i32 7>
   return _mm256_blend_ps(__a, __b, 0x35);
 }
+
+__m256i test_256_insert_epi8(__m256i __a) {
+  // CHECK-LABEL: @test_256_insert_epi8
+  // CHECK: insertelement <32 x i8> {{.*}}, i8 {{.*}}, i32 {{.*}}
+  return _mm256_insert_epi8(__a, 42, 3);
+}
+
+__m256i test_256_insert_epi16(__m256i __a) {
+  // CHECK-LABEL: @test_256_insert_epi16
+  // CHECK: insertelement <16 x i16> {{.*}}, i16 {{.*}}, i32 {{.*}}
+  return _mm256_insert_epi16(__a, 42, 3);
+}
+
+__m256i test_256_insert_epi32(__m256i __a) {
+  // CHECK-LABEL: @test_256_insert_epi32
+  // CHECK: insertelement <8 x i32> {{.*}}, i32 {{.*}}, i32 {{.*}}
+  return _mm256_insert_epi32(__a, 42, 3);
+}
+
+__m256i test_256_insert_epi64(__m256i __a) {
+  // CHECK-LABEL: @test_256_insert_epi64
+  // CHECK: insertelement <4 x i64> {{.*}}, i64 {{.*}}, i32 {{.*}}
+  return _mm256_insert_epi64(__a, 42, 3);
+}





More information about the cfe-commits mailing list