[MLIR][TOSA] Update CustomOp input and output names (#118408)
[llvm-project.git] / clang / test / CodeGen / X86 / ssse3-builtins.c
blob982c74c5fc3b405132cdc7a935adcfdfb62d8cc7
1 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
2 // RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
3 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
4 // RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
7 #include <immintrin.h>
9 // NOTE: This should match the tests in llvm/test/CodeGen/X86/ssse3-intrinsics-fast-isel.ll
11 __m128i test_mm_abs_epi8(__m128i a) {
12 // CHECK-LABEL: test_mm_abs_epi8
13 // CHECK: [[ABS:%.*]] = call <16 x i8> @llvm.abs.v16i8(<16 x i8> %{{.*}}, i1 false)
14 return _mm_abs_epi8(a);
17 __m128i test_mm_abs_epi16(__m128i a) {
18 // CHECK-LABEL: test_mm_abs_epi16
19 // CHECK: [[ABS:%.*]] = call <8 x i16> @llvm.abs.v8i16(<8 x i16> %{{.*}}, i1 false)
20 return _mm_abs_epi16(a);
23 __m128i test_mm_abs_epi32(__m128i a) {
24 // CHECK-LABEL: test_mm_abs_epi32
25 // CHECK: [[ABS:%.*]] = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %{{.*}}, i1 false)
26 return _mm_abs_epi32(a);
29 __m128i test_mm_alignr_epi8(__m128i a, __m128i b) {
30 // CHECK-LABEL: test_mm_alignr_epi8
31 // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i32> <i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17>
32 return _mm_alignr_epi8(a, b, 2);
35 __m128i test2_mm_alignr_epi8(__m128i a, __m128i b) {
36 // CHECK-LABEL: test2_mm_alignr_epi8
37 // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> zeroinitializer, <16 x i32> <i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16>
38 return _mm_alignr_epi8(a, b, 17);
41 __m128i test_mm_hadd_epi16(__m128i a, __m128i b) {
42 // CHECK-LABEL: test_mm_hadd_epi16
43 // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.w.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
44 return _mm_hadd_epi16(a, b);
47 __m128i test_mm_hadd_epi32(__m128i a, __m128i b) {
48 // CHECK-LABEL: test_mm_hadd_epi32
49 // CHECK: call <4 x i32> @llvm.x86.ssse3.phadd.d.128(<4 x i32> %{{.*}}, <4 x i32> %{{.*}})
50 return _mm_hadd_epi32(a, b);
53 __m128i test_mm_hadds_epi16(__m128i a, __m128i b) {
54 // CHECK-LABEL: test_mm_hadds_epi16
55 // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.sw.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
56 return _mm_hadds_epi16(a, b);
59 __m128i test_mm_hsub_epi16(__m128i a, __m128i b) {
60 // CHECK-LABEL: test_mm_hsub_epi16
61 // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.w.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
62 return _mm_hsub_epi16(a, b);
65 __m128i test_mm_hsub_epi32(__m128i a, __m128i b) {
66 // CHECK-LABEL: test_mm_hsub_epi32
67 // CHECK: call <4 x i32> @llvm.x86.ssse3.phsub.d.128(<4 x i32> %{{.*}}, <4 x i32> %{{.*}})
68 return _mm_hsub_epi32(a, b);
71 __m128i test_mm_hsubs_epi16(__m128i a, __m128i b) {
72 // CHECK-LABEL: test_mm_hsubs_epi16
73 // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.sw.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
74 return _mm_hsubs_epi16(a, b);
77 __m128i test_mm_maddubs_epi16(__m128i a, __m128i b) {
78 // CHECK-LABEL: test_mm_maddubs_epi16
79 // CHECK: call <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}})
80 return _mm_maddubs_epi16(a, b);
83 __m128i test_mm_mulhrs_epi16(__m128i a, __m128i b) {
84 // CHECK-LABEL: test_mm_mulhrs_epi16
85 // CHECK: call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
86 return _mm_mulhrs_epi16(a, b);
89 __m128i test_mm_shuffle_epi8(__m128i a, __m128i b) {
90 // CHECK-LABEL: test_mm_shuffle_epi8
91 // CHECK: call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}})
92 return _mm_shuffle_epi8(a, b);
95 __m128i test_mm_sign_epi8(__m128i a, __m128i b) {
96 // CHECK-LABEL: test_mm_sign_epi8
97 // CHECK: call <16 x i8> @llvm.x86.ssse3.psign.b.128(<16 x i8> %{{.*}}, <16 x i8> %{{.*}})
98 return _mm_sign_epi8(a, b);
101 __m128i test_mm_sign_epi16(__m128i a, __m128i b) {
102 // CHECK-LABEL: test_mm_sign_epi16
103 // CHECK: call <8 x i16> @llvm.x86.ssse3.psign.w.128(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
104 return _mm_sign_epi16(a, b);
107 __m128i test_mm_sign_epi32(__m128i a, __m128i b) {
108 // CHECK-LABEL: test_mm_sign_epi32
109 // CHECK: call <4 x i32> @llvm.x86.ssse3.psign.d.128(<4 x i32> %{{.*}}, <4 x i32> %{{.*}})
110 return _mm_sign_epi32(a, b);