r246947 - [X86]][SSE3] Added SSE41 IR + assembly codegen builtin tests

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 6 09:38:18 PDT 2015


Author: rksimon
Date: Sun Sep  6 11:38:17 2015
New Revision: 246947

URL: http://llvm.org/viewvc/llvm-project?rev=246947&view=rev
Log:
[X86]][SSE3] Added SSE41 IR + assembly codegen builtin tests

Transferred SSE41 instructions from sse-builtins.c

Added:
    cfe/trunk/test/CodeGen/sse41-builtins.c
Modified:
    cfe/trunk/test/CodeGen/sse-builtins.c

Modified: cfe/trunk/test/CodeGen/sse-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse-builtins.c?rev=246947&r1=246946&r2=246947&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/sse-builtins.c (original)
+++ cfe/trunk/test/CodeGen/sse-builtins.c Sun Sep  6 11:38:17 2015
@@ -135,54 +135,6 @@ __m128i test_loadl_epi64(void* y) {
   return _mm_loadl_epi64(y);
 }
 
-__m128i test_mm_minpos_epu16(__m128i x) {
-  // CHECK: define {{.*}} @test_mm_minpos_epu16
-  // CHECK: @llvm.x86.sse41.phminposuw
-  return _mm_minpos_epu16(x);
-}
-
-__m128i test_mm_mpsadbw_epu8(__m128i x, __m128i y) {
-  // CHECK: define {{.*}} @test_mm_mpsadbw_epu8
-  // CHECK: @llvm.x86.sse41.mpsadbw
-  return _mm_mpsadbw_epu8(x, y, 1);
-}
-
-__m128 test_mm_dp_ps(__m128 x, __m128 y) {
-  // CHECK: define {{.*}} @test_mm_dp_ps
-  // CHECK: @llvm.x86.sse41.dpps
-  return _mm_dp_ps(x, y, 2);
-}
-
-__m128d test_mm_dp_pd(__m128d x, __m128d y) {
-  // CHECK: define {{.*}} @test_mm_dp_pd
-  // CHECK: @llvm.x86.sse41.dppd
-  return _mm_dp_pd(x, y, 2);
-}
-
-__m128 test_mm_round_ps(__m128 x) {
-  // CHECK: define {{.*}} @test_mm_round_ps
-  // CHECK: @llvm.x86.sse41.round.ps
-  return _mm_round_ps(x, 2);
-}
-
-__m128 test_mm_round_ss(__m128 x, __m128 y) {
-  // CHECK: define {{.*}} @test_mm_round_ss
-  // CHECK: @llvm.x86.sse41.round.ss
-  return _mm_round_ss(x, y, 2);
-}
-
-__m128d test_mm_round_pd(__m128d x) {
-  // CHECK: define {{.*}} @test_mm_round_pd
-  // CHECK: @llvm.x86.sse41.round.pd
-  return _mm_round_pd(x, 2);
-}
-
-__m128d test_mm_round_sd(__m128d x, __m128d y) {
-  // CHECK: define {{.*}} @test_mm_round_sd
-  // CHECK: @llvm.x86.sse41.round.sd
-  return _mm_round_sd(x, y, 2);
-}
-
 void test_storel_epi64(__m128i x, void* y) {
   // CHECK-LABEL: define void @test_storel_epi64
   // CHECK: store {{.*}} i64* {{.*}}, align 1{{$}}
@@ -214,48 +166,6 @@ void test_extract_epi16(__m128i __a) {
   _mm_extract_epi16(__a, 8);
 }
 
-int test_extract_ps(__m128i __a) {
-  // CHECK-LABEL: @test_extract_ps
-  // CHECK: extractelement <4 x float> %{{.*}}, i32 0
-  return _mm_extract_ps(__a, 4);
-}
-
-int test_extract_epi8(__m128i __a) {
-  // CHECK-LABEL: @test_extract_epi8
-  // CHECK: extractelement <16 x i8> %{{.*}}, i32 0
-  return _mm_extract_epi8(__a, 16);
-}
-
-int test_extract_epi32(__m128i __a) {
-  // CHECK-LABEL: @test_extract_epi32
-  // CHECK: extractelement <4 x i32> %{{.*}}, i32 0
-  return _mm_extract_epi32(__a, 4);
-}
-
-void test_insert_epi32(__m128i __a, int b) {
-  // CHECK-LABEL: @test_insert_epi32
-  // CHECK: insertelement <4 x i32> %{{.*}}, i32 %{{.*}}, i32 0
-   _mm_insert_epi32(__a, b, 4);
-}
-
-__m128d test_blend_pd(__m128d V1, __m128d V2) {
-  // CHECK-LABEL: @test_blend_pd
-  // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> <i32 2, i32 1>
-  return _mm_blend_pd(V1, V2, 1);
-}
-
-__m128 test_blend_ps(__m128 V1, __m128 V2) {
-  // CHECK-LABEL: @test_blend_ps
-  // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 4, i32 1, i32 6, i32 3>
-  return _mm_blend_ps(V1, V2, 5);
-}
-
-__m128i test_blend_epi16(__m128i V1, __m128i V2) {
-  // CHECK-LABEL: @test_blend_epi16
-  // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i32> <i32 0, i32 9, i32 2, i32 11, i32 4, i32 13, i32 6, i32 7>
-  return _mm_blend_epi16(V1, V2, 42);
-}
-
 __m128 test_mm_cmpeq_ss(__m128 __a, __m128 __b) {
   // CHECK-LABEL: @test_mm_cmpeq_ss
   // CHECK: @llvm.x86.sse.cmp.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 0)
@@ -578,78 +488,6 @@ __m128i test2_mm_alignr_epi8(__m128i a,
   return _mm_alignr_epi8(a, b, 17);
 }
 
-__m128i test_mm_cvtepi8_epi16(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepi8_epi16
-  // CHECK: call <8 x i16> @llvm.x86.sse41.pmovsxbw(<16 x i8> {{.*}})
-  return _mm_cvtepi8_epi16(a);
-}
-
-__m128i test_mm_cvtepi8_epi32(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepi8_epi32
-  // CHECK: call <4 x i32> @llvm.x86.sse41.pmovsxbd(<16 x i8> {{.*}})
-  return _mm_cvtepi8_epi32(a);
-}
-
-__m128i test_mm_cvtepi8_epi64(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepi8_epi64
-  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovsxbq(<16 x i8> {{.*}})
-  return _mm_cvtepi8_epi64(a);
-}
-
-__m128i test_mm_cvtepi16_epi32(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepi16_epi32
-  // CHECK: call <4 x i32> @llvm.x86.sse41.pmovsxwd(<8 x i16> {{.*}})
-  return _mm_cvtepi16_epi32(a);
-}
-
-__m128i test_mm_cvtepi16_epi64(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepi16_epi64
-  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovsxwq(<8 x i16> {{.*}})
-  return _mm_cvtepi16_epi64(a);
-}
-
-__m128i test_mm_cvtepi32_epi64(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepi32_epi64
-  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovsxdq(<4 x i32> {{.*}})
-  return _mm_cvtepi32_epi64(a);
-}
-
-__m128i test_mm_cvtepu8_epi16(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepu8_epi16
-  // CHECK: call <8 x i16> @llvm.x86.sse41.pmovzxbw(<16 x i8> {{.*}})
-  return _mm_cvtepu8_epi16(a);
-}
-
-__m128i test_mm_cvtepu8_epi32(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepu8_epi32
-  // CHECK: call <4 x i32> @llvm.x86.sse41.pmovzxbd(<16 x i8> {{.*}})
-  return _mm_cvtepu8_epi32(a);
-}
-
-__m128i test_mm_cvtepu8_epi64(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepu8_epi64
-  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxbq(<16 x i8> {{.*}})
-  return _mm_cvtepu8_epi64(a);
-}
-
-__m128i test_mm_cvtepu16_epi32(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepu16_epi32
-  // CHECK: call <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16> {{.*}})
-  return _mm_cvtepu16_epi32(a);
-}
-
-__m128i test_mm_cvtepu16_epi64(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepu16_epi64
-  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxwq(<8 x i16> {{.*}})
-  return _mm_cvtepu16_epi64(a);
-}
-
-__m128i test_mm_cvtepu32_epi64(__m128i a) {
-  // CHECK-LABEL: @test_mm_cvtepu32_epi64
-  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxdq(<4 x i32> {{.*}})
-  return _mm_cvtepu32_epi64(a);
-}
-
 __m128 test_mm_undefined_ps() {
   // CHECK-LABEL: @test_mm_undefined_ps
   // CHECK: ret <4 x float> undef

Added: cfe/trunk/test/CodeGen/sse41-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse41-builtins.c?rev=246947&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/sse41-builtins.c (added)
+++ cfe/trunk/test/CodeGen/sse41-builtins.c Sun Sep  6 11:38:17 2015
@@ -0,0 +1,433 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +sse4.1 -emit-llvm -o - -Werror | FileCheck %s
+// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +sse4.1 -S -o - -Werror | FileCheck %s --check-prefix=CHECK-ASM
+
+// Don't include mm_malloc.h, it's system specific.
+#define __MM_MALLOC_H
+
+#include <x86intrin.h>
+
+__m128i test_blend_epi16(__m128i V1, __m128i V2) {
+  // CHECK-LABEL: test_blend_epi16
+  // CHECK: shufflevector <8 x i16> %{{.*}}, <8 x i16> %{{.*}}, <8 x i32> <i32 0, i32 9, i32 2, i32 11, i32 4, i32 13, i32 6, i32 7>
+  // CHECK-ASM: pblendw $42, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_blend_epi16(V1, V2, 42);
+}
+
+__m128d test_blend_pd(__m128d V1, __m128d V2) {
+  // CHECK-LABEL: test_blend_pd
+  // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> <i32 0, i32 3>
+  // CHECK-ASM: blendpd $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_blend_pd(V1, V2, 2);
+}
+
+__m128 test_blend_ps(__m128 V1, __m128 V2) {
+  // CHECK-LABEL: test_blend_ps
+  // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 5, i32 6, i32 3>
+  // CHECK-ASM: blendps $6, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_blend_ps(V1, V2, 6);
+}
+
+__m128i test_blendv_epi8(__m128i V1, __m128i V2, __m128i V3) {
+  // CHECK-LABEL: test_blendv_epi8
+  // CHECK: call <16 x i8> @llvm.x86.sse41.pblendvb
+  // CHECK-ASM: pblendvb %xmm{{.*}}, %xmm{{.*}}
+  return _mm_blendv_epi8(V1, V2, V3);
+}
+
+__m128d test_blendv_pd(__m128d V1, __m128d V2, __m128d V3) {
+  // CHECK-LABEL: test_blendv_pd
+  // CHECK: call <2 x double> @llvm.x86.sse41.blendvpd
+  // CHECK-ASM: blendvpd %xmm{{.*}}, %xmm{{.*}}
+  return _mm_blendv_pd(V1, V2, V3);
+}
+
+__m128 test_blendv_ps(__m128 V1, __m128 V2, __m128 V3) {
+  // CHECK-LABEL: test_blendv_ps
+  // CHECK: call <4 x float> @llvm.x86.sse41.blendvps
+  // CHECK-ASM: blendvps %xmm{{.*}}, %xmm{{.*}}
+  return _mm_blendv_ps(V1, V2, V3);
+}
+
+__m128d test_mm_ceil_pd(__m128d x) {
+  // CHECK-LABEL: test_mm_ceil_pd
+  // CHECK: call <2 x double> @llvm.x86.sse41.round.pd
+  // CHECK-ASM: roundpd $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_ceil_pd(x);
+}
+
+__m128 test_mm_ceil_ps(__m128 x) {
+  // CHECK-LABEL: test_mm_ceil_ps
+  // CHECK: call <4 x float> @llvm.x86.sse41.round.ps
+  // CHECK-ASM: roundps $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_ceil_ps(x);
+}
+
+__m128d test_mm_ceil_sd(__m128d x, __m128d y) {
+  // CHECK-LABEL: test_mm_ceil_sd
+  // CHECK: call <2 x double> @llvm.x86.sse41.round.sd
+  // CHECK-ASM: roundsd $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_ceil_sd(x, y);
+}
+
+__m128 test_mm_ceil_ss(__m128 x, __m128 y) {
+  // CHECK-LABEL: test_mm_ceil_ss
+  // CHECK: call <4 x float> @llvm.x86.sse41.round.ss
+  // CHECK-ASM: roundss $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_ceil_ss(x, y);
+}
+
+__m128i test_mm_cmpeq_epi64(__m128i A, __m128i B) {
+  // CHECK-LABEL: test_mm_cmpeq_epi64
+  // CHECK: icmp eq <2 x i64>
+  // CHECK-ASM: pcmpeqq %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cmpeq_epi64(A, B);
+}
+
+__m128i test_mm_cvtepi8_epi16(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepi8_epi16
+  // CHECK: call <8 x i16> @llvm.x86.sse41.pmovsxbw(<16 x i8> {{.*}})
+  // CHECK-ASM: pmovsxbw %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepi8_epi16(a);
+}
+
+__m128i test_mm_cvtepi8_epi32(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepi8_epi32
+  // CHECK: call <4 x i32> @llvm.x86.sse41.pmovsxbd(<16 x i8> {{.*}})
+  // CHECK-ASM: pmovsxbd %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepi8_epi32(a);
+}
+
+__m128i test_mm_cvtepi8_epi64(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepi8_epi64
+  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovsxbq(<16 x i8> {{.*}})
+  // CHECK-ASM: pmovsxbq %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepi8_epi64(a);
+}
+
+__m128i test_mm_cvtepi16_epi32(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepi16_epi32
+  // CHECK: call <4 x i32> @llvm.x86.sse41.pmovsxwd(<8 x i16> {{.*}})
+  // CHECK-ASM: pmovsxwd %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepi16_epi32(a);
+}
+
+__m128i test_mm_cvtepi16_epi64(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepi16_epi64
+  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovsxwq(<8 x i16> {{.*}})
+  // CHECK-ASM: pmovsxwq %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepi16_epi64(a);
+}
+
+__m128i test_mm_cvtepi32_epi64(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepi32_epi64
+  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovsxdq(<4 x i32> {{.*}})
+  // CHECK-ASM: pmovsxdq %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepi32_epi64(a);
+}
+
+__m128i test_mm_cvtepu8_epi16(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepu8_epi16
+  // CHECK: call <8 x i16> @llvm.x86.sse41.pmovzxbw(<16 x i8> {{.*}})
+  // CHECK-ASM: pmovzxbw %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepu8_epi16(a);
+}
+
+__m128i test_mm_cvtepu8_epi32(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepu8_epi32
+  // CHECK: call <4 x i32> @llvm.x86.sse41.pmovzxbd(<16 x i8> {{.*}})
+  // CHECK-ASM: pmovzxbd %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepu8_epi32(a);
+}
+
+__m128i test_mm_cvtepu8_epi64(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepu8_epi64
+  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxbq(<16 x i8> {{.*}})
+  // CHECK-ASM: pmovzxbq %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepu8_epi64(a);
+}
+
+__m128i test_mm_cvtepu16_epi32(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepu16_epi32
+  // CHECK: call <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16> {{.*}})
+  // CHECK-ASM: pmovzxwd %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepu16_epi32(a);
+}
+
+__m128i test_mm_cvtepu16_epi64(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepu16_epi64
+  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxwq(<8 x i16> {{.*}})
+  // CHECK-ASM: pmovzxwq %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepu16_epi64(a);
+}
+
+__m128i test_mm_cvtepu32_epi64(__m128i a) {
+  // CHECK-LABEL: test_mm_cvtepu32_epi64
+  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxdq(<4 x i32> {{.*}})
+  // CHECK-ASM: pmovzxdq %xmm{{.*}}, %xmm{{.*}}
+  return _mm_cvtepu32_epi64(a);
+}
+
+__m128d test_mm_dp_pd(__m128d x, __m128d y) {
+  // CHECK-LABEL: test_mm_dp_pd
+  // CHECK: call <2 x double> @llvm.x86.sse41.dppd
+  // CHECK-ASM: dppd $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_dp_pd(x, y, 2);
+}
+
+__m128 test_mm_dp_ps(__m128 x, __m128 y) {
+  // CHECK-LABEL: test_mm_dp_ps
+  // CHECK: call <4 x float> @llvm.x86.sse41.dpps
+  // CHECK-ASM: dpps $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_dp_ps(x, y, 2);
+}
+
+int test_extract_epi8(__m128i x) {
+  // CHECK-LABEL: test_extract_epi8
+  // CHECK: extractelement <16 x i8> %{{.*}}, i32 0
+  // CHECK-ASM: pextrb
+  return _mm_extract_epi8(x, 16);
+}
+
+int test_extract_epi32(__m128i x) {
+  // CHECK-LABEL: test_extract_epi32
+  // CHECK: extractelement <4 x i32> %{{.*}}, i32 1
+  // CHECK-ASM: pextrd
+  return _mm_extract_epi32(x, 1);
+}
+
+long long test_extract_epi64(__m128i x) {
+  // CHECK-LABEL: test_extract_epi64
+  // CHECK: extractelement <2 x i64> %{{.*}}, i32 1
+  // CHECK-ASM: pextrq
+  return _mm_extract_epi64(x, 1);
+}
+
+//TODO
+//int test_extract_ps(__m128i x) {
+//  return _mm_extract_ps(_mm_add_ps(x,x), 1);
+//}
+
+__m128d test_mm_floor_pd(__m128d x) {
+  // CHECK-LABEL: test_mm_floor_pd
+  // CHECK: call <2 x double> @llvm.x86.sse41.round.pd
+  // CHECK-ASM: roundpd $1, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_floor_pd(x);
+}
+
+__m128 test_mm_floor_ps(__m128 x) {
+  // CHECK-LABEL: test_mm_floor_ps
+  // CHECK: call <4 x float> @llvm.x86.sse41.round.ps
+  // CHECK-ASM: roundps $1, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_floor_ps(x);
+}
+
+__m128d test_mm_floor_sd(__m128d x, __m128d y) {
+  // CHECK-LABEL: test_mm_floor_sd
+  // CHECK: call <2 x double> @llvm.x86.sse41.round.sd
+  // CHECK-ASM: roundsd $1, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_floor_sd(x, y);
+}
+
+__m128 test_mm_floor_ss(__m128 x, __m128 y) {
+  // CHECK-LABEL: test_mm_floor_ss
+  // CHECK: call <4 x float> @llvm.x86.sse41.round.ss
+  // CHECK-ASM: roundss $1, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_floor_ss(x, y);
+}
+
+__m128i test_insert_epi8(__m128i x, char b) {
+  // CHECK-LABEL: test_insert_epi8
+  // CHECK: insertelement <16 x i8> %{{.*}}, i8 %{{.*}}, i32 0
+  // CHECK-ASM: pinsrb
+  return _mm_insert_epi8(x, b, 16);
+}
+
+__m128i test_insert_epi32(__m128i x, int b) {
+  // CHECK-LABEL: test_insert_epi32
+  // CHECK: insertelement <4 x i32> %{{.*}}, i32 %{{.*}}, i32 0
+  // CHECK-ASM: pinsrd
+  return _mm_insert_epi32(x, b, 4);
+}
+
+__m128i test_insert_epi64(__m128i x, long long b) {
+  // CHECK-LABEL: test_insert_epi64
+  // CHECK: insertelement <2 x i64> %{{.*}}, i64 %{{.*}}, i32 0
+  // CHECK-ASM: pinsrq
+  return _mm_insert_epi64(x, b, 2);
+}
+
+__m128 test_insert_ps(__m128 x, __m128 y) {
+  // CHECK-LABEL: test_insert_ps
+  // CHECK: call <4 x float> @llvm.x86.sse41.insertps
+  // CHECK-ASM: insertps $5, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_insert_ps(x, y, 5);
+}
+
+__m128i test_mm_max_epi8(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_max_epi8
+  // CHECK: call <16 x i8> @llvm.x86.sse41.pmaxsb
+  // CHECK-ASM: pmaxsb %xmm{{.*}}, %xmm{{.*}}
+  return _mm_max_epi8(x, y);
+}
+
+__m128i test_mm_max_epu16(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_max_epu16
+  // CHECK: call <8 x i16> @llvm.x86.sse41.pmaxuw
+  // CHECK-ASM: pmaxuw %xmm{{.*}}, %xmm{{.*}}
+  return _mm_max_epu16(x, y);
+}
+
+__m128i test_mm_max_epi32(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_max_epi32
+  // CHECK: call <4 x i32> @llvm.x86.sse41.pmaxsd
+  // CHECK-ASM: pmaxsd %xmm{{.*}}, %xmm{{.*}}
+  return _mm_max_epi32(x, y);
+}
+
+__m128i test_mm_max_epu32(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_max_epu32
+  // CHECK: call <4 x i32> @llvm.x86.sse41.pmaxud
+  // CHECK-ASM: pmaxud %xmm{{.*}}, %xmm{{.*}}
+  return _mm_max_epu32(x, y);
+}
+
+__m128i test_mm_min_epi8(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_min_epi8
+  // CHECK: call <16 x i8> @llvm.x86.sse41.pminsb
+  // CHECK-ASM: pminsb %xmm{{.*}}, %xmm{{.*}}
+  return _mm_min_epi8(x, y);
+}
+
+__m128i test_mm_min_epu16(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_min_epu16
+  // CHECK: call <8 x i16> @llvm.x86.sse41.pminuw
+  // CHECK-ASM: pminuw %xmm{{.*}}, %xmm{{.*}}
+  return _mm_min_epu16(x, y);
+}
+
+__m128i test_mm_min_epi32(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_min_epi32
+  // CHECK: call <4 x i32> @llvm.x86.sse41.pminsd
+  // CHECK-ASM: pminsd %xmm{{.*}}, %xmm{{.*}}
+  return _mm_min_epi32(x, y);
+}
+
+__m128i test_mm_min_epu32(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_min_epu32
+  // CHECK: call <4 x i32> @llvm.x86.sse41.pminud
+  // CHECK-ASM: pminud %xmm{{.*}}, %xmm{{.*}}
+  return _mm_min_epu32(x, y);
+}
+
+__m128i test_mm_minpos_epu16(__m128i x) {
+  // CHECK-LABEL: test_mm_minpos_epu16
+  // CHECK: call <8 x i16> @llvm.x86.sse41.phminposuw
+  // CHECK-ASM: phminposuw %xmm{{.*}}, %xmm{{.*}}
+  return _mm_minpos_epu16(x);
+}
+
+__m128i test_mm_mpsadbw_epu8(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_mpsadbw_epu8
+  // CHECK: call <8 x i16> @llvm.x86.sse41.mpsadbw
+  // CHECK-ASM: mpsadbw $1, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_mpsadbw_epu8(x, y, 1);
+}
+
+__m128i test_mm_mul_epi32(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_mul_epi32
+  // CHECK: call <2 x i64> @llvm.x86.sse41.pmuldq
+  // CHECK-ASM: pmuldq %xmm{{.*}}, %xmm{{.*}}
+  return _mm_mul_epi32(x, y);
+}
+
+__m128i test_mm_mullo_epi32(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_mullo_epi32
+  // CHECK: mul <4 x i32>
+  // CHECK-ASM: pmulld %xmm{{.*}}, %xmm{{.*}}
+  return _mm_mullo_epi32(x, y);
+}
+
+__m128i test_mm_packus_epi32(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_packus_epi32
+  // CHECK: call <8 x i16> @llvm.x86.sse41.packusdw
+  // CHECK-ASM: packusdw %xmm{{.*}}, %xmm{{.*}}
+  return _mm_packus_epi32(x, y);
+}
+
+__m128d test_mm_round_pd(__m128d x) {
+  // CHECK-LABEL: test_mm_round_pd
+  // CHECK: call <2 x double> @llvm.x86.sse41.round.pd
+  // CHECK-ASM: roundpd $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_round_pd(x, 2);
+}
+
+__m128 test_mm_round_ps(__m128 x) {
+  // CHECK-LABEL: test_mm_round_ps
+  // CHECK: call <4 x float> @llvm.x86.sse41.round.ps
+  // CHECK-ASM: roundps $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_round_ps(x, 2);
+}
+
+__m128d test_mm_round_sd(__m128d x, __m128d y) {
+  // CHECK-LABEL: test_mm_round_sd
+  // CHECK: call <2 x double> @llvm.x86.sse41.round.sd
+  // CHECK-ASM: roundsd $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_round_sd(x, y, 2);
+}
+
+__m128 test_mm_round_ss(__m128 x, __m128 y) {
+  // CHECK-LABEL: test_mm_round_ss
+  // CHECK: call <4 x float> @llvm.x86.sse41.round.ss
+  // CHECK-ASM: roundss $2, %xmm{{.*}}, %xmm{{.*}}
+  return _mm_round_ss(x, y, 2);
+}
+
+__m128i test_mm_stream_load_si128(__m128i *a) {
+  // CHECK-LABEL: test_mm_stream_load_si128
+  // CHECK: call <2 x i64> @llvm.x86.sse41.movntdqa
+  // CHECK-ASM: movntdqa
+  return _mm_stream_load_si128(a);
+}
+
+int test_mm_test_all_ones(__m128i x) {
+  // CHECK-LABEL: test_mm_test_all_ones
+  // CHECK: call i32 @llvm.x86.sse41.ptestc
+  // CHECK-ASM: ptest %xmm{{.*}}, %xmm{{.*}}
+  return _mm_test_all_ones(x);
+}
+
+int test_mm_test_all_zeros(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_test_all_zeros
+  // CHECK: call i32 @llvm.x86.sse41.ptestz
+  // CHECK-ASM: ptest %xmm{{.*}}, %xmm{{.*}}
+  return _mm_test_all_zeros(x, y);
+}
+
+int test_mm_test_mix_ones_zeros(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_test_mix_ones_zeros
+  // CHECK: call i32 @llvm.x86.sse41.ptestnzc
+  // CHECK-ASM: ptest %xmm{{.*}}, %xmm{{.*}}
+  return _mm_test_mix_ones_zeros(x, y);
+}
+
+int test_mm_testc_si128(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_testc_si128
+  // CHECK: call i32 @llvm.x86.sse41.ptestc
+  // CHECK-ASM: ptest %xmm{{.*}}, %xmm{{.*}}
+  return _mm_testc_si128(x, y);
+}
+
+int test_mm_testnzc_si128(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_testnzc_si128
+  // CHECK: call i32 @llvm.x86.sse41.ptestnzc
+  // CHECK-ASM: ptest %xmm{{.*}}, %xmm{{.*}}
+  return _mm_testnzc_si128(x, y);
+}
+
+int test_mm_testz_si128(__m128i x, __m128i y) {
+  // CHECK-LABEL: test_mm_testz_si128
+  // CHECK: call i32 @llvm.x86.sse41.ptestz
+  // CHECK-ASM: ptest %xmm{{.*}}, %xmm{{.*}}
+  return _mm_testz_si128(x, y);
+}




More information about the cfe-commits mailing list