From 0f3a52b8c9ef8a3298a1c4b9771c72a516fb1075 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 22 Mar 2017 14:55:43 +0000 Subject: [PATCH] [X86][MMX] Add tests for _mm_set*_* intrinsics llvm-svn: 298511 --- clang/test/CodeGen/mmx-builtins.c | 87 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/clang/test/CodeGen/mmx-builtins.c b/clang/test/CodeGen/mmx-builtins.c index ddc6f66..cd725e2 100644 --- a/clang/test/CodeGen/mmx-builtins.c +++ b/clang/test/CodeGen/mmx-builtins.c @@ -383,6 +383,93 @@ __m64 test_mm_sad_pu8(__m64 a, __m64 b) { return _mm_sad_pu8(a, b); } +__m64 test_mm_set_pi8(char a, char b, char c, char d, char e, char f, char g, char h) { + // CHECK-LABEL: test_mm_set_pi8 + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + return _mm_set_pi8(a, b, c, d, e, f, g, h); +} + +__m64 test_mm_set_pi16(short a, short b, short c, short d) { + // CHECK-LABEL: test_mm_set_pi16 + // CHECK: insertelement <4 x i16> + // CHECK: insertelement <4 x i16> + // CHECK: insertelement <4 x i16> + // CHECK: insertelement <4 x i16> + return _mm_set_pi16(a, b, c, d); +} + +__m64 test_mm_set_pi32(int a, int b) { + // CHECK-LABEL: test_mm_set_pi32 + // CHECK: insertelement <2 x i32> + // CHECK: insertelement <2 x i32> + return _mm_set_pi32(a, b); +} + +__m64 test_mm_setr_pi8(char a, char b, char c, char d, char e, char f, char g, char h) { + // CHECK-LABEL: test_mm_setr_pi8 + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + return _mm_setr_pi8(a, b, c, d, e, f, g, h); +} + +__m64 test_mm_setr_pi16(short a, short b, short c, short d) { + // CHECK-LABEL: test_mm_setr_pi16 + // CHECK: insertelement <4 x i16> + // CHECK: insertelement <4 x i16> + // CHECK: insertelement <4 x i16> + // CHECK: insertelement <4 x i16> + return _mm_setr_pi16(a, b, c, d); +} + +__m64 test_mm_setr_pi32(int a, int b) { + // CHECK-LABEL: test_mm_setr_pi32 + // CHECK: insertelement <2 x i32> + // CHECK: insertelement <2 x i32> + return _mm_setr_pi32(a, b); +} + +__m64 test_mm_set1_pi8(char a) { + // CHECK-LABEL: test_mm_set1_pi8 + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + // CHECK: insertelement <8 x i8> + return _mm_set1_pi8(a); +} + +__m64 test_mm_set1_pi16(short a) { + // CHECK-LABEL: test_mm_set1_pi16 + // CHECK: insertelement <4 x i16> + // CHECK: insertelement <4 x i16> + // CHECK: insertelement <4 x i16> + // CHECK: insertelement <4 x i16> + return _mm_set1_pi16(a); +} + +__m64 test_mm_set1_pi32(int a) { + // CHECK-LABEL: test_mm_set1_pi32 + // CHECK: insertelement <2 x i32> + // CHECK: insertelement <2 x i32> + return _mm_set1_pi32(a); +} + __m64 test_mm_shuffle_pi8(__m64 a, __m64 b) { // CHECK-LABEL: test_mm_shuffle_pi8 // CHECK: call x86_mmx @llvm.x86.ssse3.pshuf.b -- 2.7.4