[PATCH] [Headers] Add tests for _mm256_insert_epi64 and fix its definition

Filipe Cabecinhas filcab+llvm.phabricator at gmail.com
Mon Jan 26 09:26:53 PST 2015


Hi bruno,

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

http://reviews.llvm.org/D7179

Files:
  lib/Headers/avxintrin.h
  test/CodeGen/avx-builtins.c

Index: lib/Headers/avxintrin.h
===================================================================
--- lib/Headers/avxintrin.h
+++ lib/Headers/avxintrin.h
@@ -515,7 +515,7 @@
 
 #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;
Index: test/CodeGen/avx-builtins.c
===================================================================
--- test/CodeGen/avx-builtins.c
+++ test/CodeGen/avx-builtins.c
@@ -123,3 +123,27 @@
   // 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);
+}

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7179.18761.patch
Type: text/x-patch
Size: 1633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150126/dcfe9a7e/attachment.bin>


More information about the cfe-commits mailing list