brintos

brintos / llvm-project-archived public Read only

0
0
Text · 39.7 KiB · 37d6306 Raw
908 lines · c
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 --implicit-check-not=x86mmx2// 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 --implicit-check-not=x86mmx3// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --implicit-check-not=x86mmx4// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --implicit-check-not=x86mmx5// 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 --implicit-check-not=x86mmx6// 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 --implicit-check-not=x86mmx7// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --implicit-check-not=x86mmx8// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --implicit-check-not=x86mmx9 10// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s --implicit-check-not=x86mmx11// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s --implicit-check-not=x86mmx12// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -fno-signed-char -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s --implicit-check-not=x86mmx13// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -fno-signed-char -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s --implicit-check-not=x86mmx14// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s --implicit-check-not=x86mmx15// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s --implicit-check-not=x86mmx16// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -fno-signed-char -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s --implicit-check-not=x86mmx17// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -fno-signed-char -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s --implicit-check-not=x86mmx18 19 20#include <immintrin.h>21#include "builtin_test_helpers.h"22 23__m64 test_mm_abs_pi8(__m64 a) {24  // CHECK-LABEL: test_mm_abs_pi825  // CHECK: call <8 x i8> @llvm.abs.v8i8(26  return _mm_abs_pi8(a);27}28TEST_CONSTEXPR(match_v8qi(_mm_abs_pi8((__m64)(__v8qs){-3, +2, -1, 0, +1, -2, +3, -4}), 3, 2, 1, 0, 1, 2, 3, 4));29 30__m64 test_mm_abs_pi16(__m64 a) {31  // CHECK-LABEL: test_mm_abs_pi1632  // CHECK: call <4 x i16> @llvm.abs.v4i16(33  return _mm_abs_pi16(a);34}35TEST_CONSTEXPR(match_v4hi(_mm_abs_pi16((__m64)(__v4hi){+1, -2, +3, -4}), 1, 2, 3, 4));36 37__m64 test_mm_abs_pi32(__m64 a) {38  // CHECK-LABEL: test_mm_abs_pi3239  // CHECK: call <2 x i32> @llvm.abs.v2i32(40  return _mm_abs_pi32(a);41}42TEST_CONSTEXPR(match_v2si(_mm_abs_pi32((__m64)(__v2si){+5, -3}), 5, 3));43 44__m64 test_mm_add_pi8(__m64 a, __m64 b) {45  // CHECK-LABEL: test_mm_add_pi846  // CHECK: add <8 x i8> {{%.*}}, {{%.*}}47  return _mm_add_pi8(a, b);48}49TEST_CONSTEXPR(match_v8qi(_mm_add_pi8((__m64)(__v8qs){-3, +2, -1, 0, +1, -2, +3, -4}, (__m64)(__v8qs){-18, +16, -14, +12, -10, +8, +6, -4}), -21, +18, -15, +12, -9, +6, +9, -8));50 51__m64 test_mm_add_pi16(__m64 a, __m64 b) {52  // CHECK-LABEL: test_mm_add_pi1653  // CHECK: add <4 x i16> {{%.*}}, {{%.*}}54  return _mm_add_pi16(a, b);55}56TEST_CONSTEXPR(match_v4hi(_mm_add_pi16((__m64)(__v4hi){+1, -2, +3, -4}, (__m64)(__v4hi){-10, +8, +6, -4}), -9, +6, +9, -8));57 58__m64 test_mm_add_pi32(__m64 a, __m64 b) {59  // CHECK-LABEL: test_mm_add_pi3260  // CHECK: add <2 x i32> {{%.*}}, {{%.*}}61  return _mm_add_pi32(a, b);62}63TEST_CONSTEXPR(match_v2si(_mm_add_pi32((__m64)(__v2si){+5, -3}, (__m64)(__v2si){-9, +8}), -4, +5));64 65__m64 test_mm_add_si64(__m64 a, __m64 b) {66  // CHECK-LABEL: test_mm_add_si6467  // CHECK: add i64 {{%.*}}, {{%.*}}68  return _mm_add_si64(a, b);69}70TEST_CONSTEXPR(match_v1di(_mm_add_si64((__m64)(__v1di){+42}, (__m64)(__v1di){-100}), -58));71 72__m64 test_mm_adds_pi8(__m64 a, __m64 b) {73  // CHECK-LABEL: test_mm_adds_pi874  // CHECK: call <8 x i8> @llvm.sadd.sat.v8i8(75  return _mm_adds_pi8(a, b);76}77TEST_CONSTEXPR(match_v8qi(_mm_adds_pi8((__m64)(__v8qs){+100, +50, -100, +20, +80, -50, +120, -20}, (__m64)(__v8qs){+50, +80, -50, +110, +60, -30, +20, -10}), +127, +127, -128, +127, +127, -80, +127, -30));78 79__m64 test_mm_adds_pi16(__m64 a, __m64 b) {80  // CHECK-LABEL: test_mm_adds_pi1681  // CHECK: call <4 x i16> @llvm.sadd.sat.v4i16(82  return _mm_adds_pi16(a, b);83}84TEST_CONSTEXPR(match_v4hi(_mm_adds_pi16((__m64)(__v4hi){+32000, -32000, +32000, -32000}, (__m64)(__v4hi){+800, -800, -800, +800}), +32767, -32768, +31200, -31200));85 86__m64 test_mm_adds_pu8(__m64 a, __m64 b) {87  // CHECK-LABEL: test_mm_adds_pu888  // CHECK: call <8 x i8> @llvm.uadd.sat.v8i8(89  return _mm_adds_pu8(a, b);90}91TEST_CONSTEXPR(match_v8qu(_mm_adds_pu8((__m64)(__v8qu){0, +1, +2, +3, +180, +150, +120, +200}, (__m64)(__v8qu){0, +1, +2, +3, +160, +30, +200, +10}), 0, +2, +4, +6, +255, +180, +255, +210));92 93__m64 test_mm_adds_pu16(__m64 a, __m64 b) {94  // CHECK-LABEL: test_mm_adds_pu1695  // CHECK: call <4 x i16> @llvm.uadd.sat.v4i16(96  return _mm_adds_pu16(a, b);97}98TEST_CONSTEXPR(match_v4hu(_mm_adds_pu16((__m64)(__v4hu){+0, +1, +32000, +33000}, (__m64)(__v4hu){0, +1, +800, +33000}), 0, +2, +32800, +65535));99 100__m64 test_mm_alignr_pi8(__m64 a, __m64 b) {101  // CHECK-LABEL: test_mm_alignr_pi8102  // CHECK: shufflevector <16 x i8> {{%.*}}, <16 x i8> zeroinitializer, <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>103  return _mm_alignr_pi8(a, b, 2);104}105TEST_CONSTEXPR(match_v8qi(_mm_alignr_pi8(((__m64)(__v8qs){1, 2, 3, 4, 5, 6, 7, 8}), ((__m64)(__v8qs){9, 10, 11, 12, 13, 14, 15, 16}), 2), 11, 12, 13, 14, 15, 16, 1, 2));106TEST_CONSTEXPR(match_v8qi(_mm_alignr_pi8(((__m64)(__v8qs){1, 2, 3, 4, 5, 6, 7, 8}), ((__m64)(__v8qs){9, 10, 11, 12, 13, 14, 15, 16}), 16), 0, 0, 0, 0, 0, 0, 0, 0));107 108__m64 test_mm_and_si64(__m64 a, __m64 b) {109  // CHECK-LABEL: test_mm_and_si64110  // CHECK: and <1 x i64> {{%.*}}, {{%.*}}111  return _mm_and_si64(a, b);112}113TEST_CONSTEXPR(match_v4hi(_mm_and_si64((__m64)(__v4hi){0, -1, 0, -1}, (__m64)(__v4hi){0, 0, -1, -1}), 0, 0, 0, -1));114 115__m64 test_mm_andnot_si64(__m64 a, __m64 b) {116  // CHECK-LABEL: test_mm_andnot_si64117  // CHECK: [[TMP:%.*]] = xor <1 x i64> {{%.*}}, splat (i64 -1)118  // CHECK: and <1 x i64> [[TMP]], {{%.*}}119  return _mm_andnot_si64(a, b);120}121TEST_CONSTEXPR(match_v4hi(_mm_andnot_si64((__m64)(__v4hi){0, -1, 0, -1}, (__m64)(__v4hi){0, 0, -1, -1}), 0, 0, -1, 0));122 123__m64 test_mm_avg_pu8(__m64 a, __m64 b) {124  // CHECK-LABEL: test_mm_avg_pu8125  // CHECK: call <16 x i8> @llvm.x86.sse2.pavg.b(126  return _mm_avg_pu8(a, b);127}128TEST_CONSTEXPR(match_v8qu(_mm_avg_pu8((__m64)(__v8qu){0, 1, 2, 3, 18, 15, 12, 20}, (__m64)(__v8qu){0, 1, 2, 3, 16, 3, 20, 10}), 0, 1, 2, 3, 17, 9, 16, 15));129 130__m64 test_mm_avg_pu16(__m64 a, __m64 b) {131  // CHECK-LABEL: test_mm_avg_pu16132  // CHECK: call <8 x i16> @llvm.x86.sse2.pavg.w(133  return _mm_avg_pu16(a, b);134}135TEST_CONSTEXPR(match_v4hu(_mm_avg_pu16((__m64)(__v4hu){18, 15, 12, 20}, (__m64)(__v4hu){16, 3, 20, 10}), 17, 9, 16, 15));136 137__m64 test_mm_cmpeq_pi8(__m64 a, __m64 b) {138  // CHECK-LABEL: test_mm_cmpeq_pi8139  // CHECK:      [[CMP:%.*]] = icmp eq <8 x i8> {{%.*}}, {{%.*}}140  // CHECK-NEXT: {{%.*}} = sext <8 x i1> [[CMP]] to <8 x i8>141  return _mm_cmpeq_pi8(a, b);142}143TEST_CONSTEXPR(match_v8qi(_mm_cmpeq_pi8((__m64)(__v8qs){-3, +2, -1, 0, +1, -2, +3, -4}, (__m64)(__v8qs){-3, -2, +1, 0, -1, -2, -3, -4}), -1, 0, 0, -1, 0, -1, 0, -1));144 145__m64 test_mm_cmpeq_pi16(__m64 a, __m64 b) {146  // CHECK-LABEL: test_mm_cmpeq_pi16147  // CHECK:      [[CMP:%.*]] = icmp eq <4 x i16> {{%.*}}, {{%.*}}148  // CHECK-NEXT: {{%.*}} = sext <4 x i1> [[CMP]] to <4 x i16>149  return _mm_cmpeq_pi16(a, b);150}151TEST_CONSTEXPR(match_v4hi(_mm_cmpeq_pi16((__m64)(__v4hi){+1, -2, +3, -4}, (__m64)(__v4hi){-1, -1, +3, +4}), 0, 0, -1, 0));152 153__m64 test_mm_cmpeq_pi32(__m64 a, __m64 b) {154  // CHECK-LABEL: test_mm_cmpeq_pi32155  // CHECK:      [[CMP:%.*]] = icmp eq <2 x i32> {{%.*}}, {{%.*}}156  // CHECK-NEXT: {{%.*}} = sext <2 x i1> [[CMP]] to <2 x i32>157  return _mm_cmpeq_pi32(a, b);158}159TEST_CONSTEXPR(match_v2si(_mm_cmpeq_pi32((__m64)(__v2si){+5, -3}, (__m64)(__v2si){-5, -3}), 0, -1));160 161__m64 test_mm_cmpgt_pi8(__m64 a, __m64 b) {162  // CHECK-LABEL: test_mm_cmpgt_pi8163  // CHECK:      [[CMP:%.*]] = icmp sgt <8 x i8> {{%.*}}, {{%.*}}164  // CHECK-NEXT: {{%.*}} = sext <8 x i1> [[CMP]] to <8 x i8>165  return _mm_cmpgt_pi8(a, b);166}167TEST_CONSTEXPR(match_v8qi(_mm_cmpgt_pi8((__m64)(__v8qs){-3, +2, -1, 0, +1, -2, +3, -4}, (__m64)(__v8qs){-3, -2, +1, 0, -1, -2, -3, -4}), 0, -1, 0, 0, -1, 0, -1, 0));168 169__m64 test_mm_cmpgt_pi16(__m64 a, __m64 b) {170  // CHECK-LABEL: test_mm_cmpgt_pi16171  // CHECK:      [[CMP:%.*]] = icmp sgt <4 x i16> {{%.*}}, {{%.*}}172  // CHECK-NEXT: {{%.*}} = sext <4 x i1> [[CMP]] to <4 x i16>173  return _mm_cmpgt_pi16(a, b);174}175TEST_CONSTEXPR(match_v4hi(_mm_cmpgt_pi16((__m64)(__v4hi){+1, -2, +3, -4}, (__m64)(__v4hi){-1, -1, +3, +4}), -1, 0, 0, 0));176 177__m64 test_mm_cmpgt_pi32(__m64 a, __m64 b) {178  // CHECK-LABEL: test_mm_cmpgt_pi32179  // CHECK:      [[CMP:%.*]] = icmp sgt <2 x i32> {{%.*}}, {{%.*}}180  // CHECK-NEXT: {{%.*}} = sext <2 x i1> [[CMP]] to <2 x i32>181  return _mm_cmpgt_pi32(a, b);182}183TEST_CONSTEXPR(match_v2si(_mm_cmpgt_pi32((__m64)(__v2si){+5, -3}, (__m64)(__v2si){-5, -3}), -1, 0));184 185__m128 test_mm_cvt_pi2ps(__m128 a, __m64 b) {186  // CHECK-LABEL: test_mm_cvt_pi2ps187  // CHECK: sitofp <4 x i32> {{%.*}} to <4 x float>188  return _mm_cvt_pi2ps(a, b);189}190TEST_CONSTEXPR(match_m128(_mm_cvt_pi2ps((__m128){-5.0f, +7.0f, -9.0f, +11.0f}, (__m64)(__v2si){-2,+4}), -2.0f, +4.0f, -9.0f, +11.0f));191 192__m64 test_mm_cvt_ps2pi(__m128 a) {193  // CHECK-LABEL: test_mm_cvt_ps2pi194  // CHECK: call <4 x i32> @llvm.x86.sse2.cvtps2dq(195  return _mm_cvt_ps2pi(a);196}197 198__m64 test_mm_cvtpd_pi32(__m128d a) {199  // CHECK-LABEL: test_mm_cvtpd_pi32200  // CHECK: call <4 x i32> @llvm.x86.sse2.cvtpd2dq(201  return _mm_cvtpd_pi32(a);202}203 204__m128 test_mm_cvtpi8_ps(__m64 a) {205  // CHECK-LABEL: test_mm_cvtpi8_ps206  // CHECK: sitofp <4 x i8> {{%.*}} to <4 x float>207  return _mm_cvtpi8_ps(a);208}209TEST_CONSTEXPR(match_m128(_mm_cvtpi8_ps((__m64)(__v8qi){1, 2, 3, 4, 5, 6, 7, 8}), +1.0f, +2.0f, +3.0f, +4.0f));210 211__m128 test_mm_cvtpi16_ps(__m64 a) {212  // CHECK-LABEL: test_mm_cvtpi16_ps213  // CHECK: sitofp <4 x i16> {{%.*}} to <4 x float>214  return _mm_cvtpi16_ps(a);215}216TEST_CONSTEXPR(match_m128(_mm_cvtpi16_ps((__m64)(__v4hi){-3, +9, -8, +256}), -3.0f, +9.0f, -8.0f, +256.0f));217 218__m128d test_mm_cvtpi32_pd(__m64 a) {219  // CHECK-LABEL: test_mm_cvtpi32_pd220  // CHECK: sitofp <2 x i32> {{%.*}} to <2 x double>221  return _mm_cvtpi32_pd(a);222}223TEST_CONSTEXPR(match_m128d(_mm_cvtpi32_pd((__m64)(__v2si){-10,+17}), -10.0, +17.0));224 225__m128 test_mm_cvtpi32_ps(__m128 a, __m64 b) {226  // CHECK-LABEL: test_mm_cvtpi32_ps227  // CHECK: sitofp <4 x i32> {{%.*}} to <4 x float>228  return _mm_cvtpi32_ps(a, b);229}230TEST_CONSTEXPR(match_m128(_mm_cvtpi32_ps((__m128){+1.0f, -2.0f, +3.0f, +5.0f}, (__m64)(__v2si){+100,-200}), +100.0f, -200.0f, +3.0f, +5.0f));231 232__m128 test_mm_cvtpi32x2_ps(__m64 a, __m64 b) {233  // CHECK-LABEL: test_mm_cvtpi32x2_ps234  // CHECK: sitofp <4 x i32> {{%.*}} to <4 x float>235  return _mm_cvtpi32x2_ps(a, b);236}237TEST_CONSTEXPR(match_m128(_mm_cvtpi32x2_ps((__m64)(__v2si){-8,+7}, (__m64)(__v2si){+100,-200}), -8.0f, +7.0f, +100.0f, -200.0f));238 239__m64 test_mm_cvtps_pi16(__m128 a) {240  // CHECK-LABEL: test_mm_cvtps_pi16241  // CHECK: [[TMP0:%.*]] = call <4 x i32> @llvm.x86.sse2.cvtps2dq(<4 x float> {{%.*}})242  // CHECK: call <8 x i16> @llvm.x86.sse2.packssdw.128(<4 x i32> [[TMP0]],243  return _mm_cvtps_pi16(a);244}245 246__m64 test_mm_cvtps_pi32(__m128 a) {247  // CHECK-LABEL: test_mm_cvtps_pi32248  // CHECK: call <4 x i32> @llvm.x86.sse2.cvtps2dq(249  return _mm_cvtps_pi32(a);250}251 252__m128 test_mm_cvtpu8_ps(__m64 a) {253  // CHECK-LABEL: test_mm_cvtpu8_ps254  // CHECK: uitofp <4 x i8> {{%.*}} to <4 x float>255  return _mm_cvtpu8_ps(a);256}257TEST_CONSTEXPR(match_m128(_mm_cvtpu8_ps((__m64)(__v8qi){8, 7, 6, 5, 4, 3, 2, 1}), 8.0f, 7.0f, 6.0f, 5.0f));258 259__m128 test_mm_cvtpu16_ps(__m64 a) {260  // CHECK-LABEL: test_mm_cvtpu16_ps261  // CHECK: uitofp <4 x i16> {{%.*}} to <4 x float>262  return _mm_cvtpu16_ps(a);263}264TEST_CONSTEXPR(match_m128(_mm_cvtpu16_ps((__m64)(__v4hi){-3, +9, -8, +256}), 65533.0f, 9.0f, 65528.0f, 256.0f));265 266__m64 test_mm_cvtsi32_si64(int a) {267  // CHECK-LABEL: test_mm_cvtsi32_si64268  // CHECK: insertelement <2 x i32>269  return _mm_cvtsi32_si64(a);270}271TEST_CONSTEXPR(match_v2si(_mm_cvtsi32_si64(-127), -127, 0));272 273int test_mm_cvtsi64_si32(__m64 a) {274  // CHECK-LABEL: test_mm_cvtsi64_si32275  // CHECK: extractelement <2 x i32>276  return _mm_cvtsi64_si32(a);277}278TEST_CONSTEXPR(_mm_cvtsi64_si32((__m64)(__v4hi){-2, 0, -1, -1}) == 65534);279 280__m64 test_mm_cvttpd_pi32(__m128d a) {281  // CHECK-LABEL: test_mm_cvttpd_pi32282  // CHECK: call <4 x i32> @llvm.x86.sse2.cvttpd2dq(283  return _mm_cvttpd_pi32(a);284}285 286__m64 test_mm_cvttps_pi32(__m128 a) {287  // CHECK-LABEL: test_mm_cvttps_pi32288  // CHECK: call <4 x i32> @llvm.x86.sse2.cvttps2dq(289  return _mm_cvttps_pi32(a);290}291 292int test_mm_extract_pi16(__m64 a) {293  // CHECK-LABEL: test_mm_extract_pi16294  // CHECK: extractelement <4 x i16> {{%.*}}, i64 2295  return _mm_extract_pi16(a, 2);296}297TEST_CONSTEXPR(_mm_extract_pi16(((__m64)(__v4hi){10, 20, 30, 40}), 7) == 40);298 299__m64 test_m_from_int(int a) {300  // CHECK-LABEL: test_m_from_int301  // CHECK: insertelement <2 x i32>302  return _m_from_int(a);303}304TEST_CONSTEXPR(match_v2si(_m_from_int(255), 255, 0));305 306__m64 test_m_from_int64(long long a) {307  // CHECK-LABEL: test_m_from_int64308  return _m_from_int64(a);309}310TEST_CONSTEXPR(match_v1di(_m_from_int64(-65536), -65536LL));311 312__m64 test_mm_hadd_pi16(__m64 a, __m64 b) {313  // CHECK-LABEL: test_mm_hadd_pi16314  // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.w.128(315  return _mm_hadd_pi16(a, b);316}317TEST_CONSTEXPR(match_v4hi(_mm_hadd_pi16((__m64)(__v4hi){1,2,3,4},(__m64)(__v4hi){5,6,7,8}),3,7,11,15));318 319__m64 test_mm_hadd_pi32(__m64 a, __m64 b) {320  // CHECK-LABEL: test_mm_hadd_pi32321  // CHECK: call <4 x i32> @llvm.x86.ssse3.phadd.d.128(322  return _mm_hadd_pi32(a, b);323}324TEST_CONSTEXPR(match_v2si(_mm_hadd_pi32((__m64)(__v2si){1,2},(__m64)(__v2si){3,4}),3,7));325 326__m64 test_mm_hadds_pi16(__m64 a, __m64 b) {327  // CHECK-LABEL: test_mm_hadds_pi16328  // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.sw.128(329  return _mm_hadds_pi16(a, b);330}331TEST_CONSTEXPR(match_v4hi(_mm_hadds_pi16((__m64)(__v4hi){32767, 32767, 1,3},(__m64)(__v4hi){-1,3, 40, 60}),32767, 4, 2,100));332 333__m64 test_mm_hsub_pi16(__m64 a, __m64 b) {334  // CHECK-LABEL: test_mm_hsub_pi16335  // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.w.128(336  return _mm_hsub_pi16(a, b);337}338TEST_CONSTEXPR(match_v4hi(_mm_hsub_pi16((__m64)(__v4hi){1,2,4,3},(__m64)(__v4hi){10,5,0,-10}),-1,1,5,10));339 340__m64 test_mm_hsub_pi32(__m64 a, __m64 b) {341  // CHECK-LABEL: test_mm_hsub_pi32342  // CHECK: call <4 x i32> @llvm.x86.ssse3.phsub.d.128(343  return _mm_hsub_pi32(a, b);344}345TEST_CONSTEXPR(match_v2si(_mm_hsub_pi32((__m64)(__v2si){1,2},(__m64)(__v2si){4,3}),-1,1));346 347__m64 test_mm_hsubs_pi16(__m64 a, __m64 b) {348  // CHECK-LABEL: test_mm_hsubs_pi16349  // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.sw.128(350  return _mm_hsubs_pi16(a, b);351}352TEST_CONSTEXPR(match_v4hi(_mm_hsubs_pi16((__m64)(__v4hi){32767, 32767, 5, -32767},(__m64)(__v4hi){4,5,10,5}),0,32767,-1,5));353 354__m64 test_mm_insert_pi16(__m64 a, int d) {355  // CHECK-LABEL: test_mm_insert_pi16356  // CHECK: insertelement <4 x i16>357  return _mm_insert_pi16(a, d, 2);358}359TEST_CONSTEXPR(match_v4hi(_mm_insert_pi16(((__m64)(__v4hi){0, 1, 2, 3}), 77, 10), 0, 1, 77, 3));360 361__m64 test_mm_madd_pi16(__m64 a, __m64 b) {362  // CHECK-LABEL: test_mm_madd_pi16363  // CHECK: call <4 x i32> @llvm.x86.sse2.pmadd.wd(364  return _mm_madd_pi16(a, b);365}366TEST_CONSTEXPR(match_v2si(_mm_madd_pi16((__m64)(__v4hi){+1, -2, +3, -4}, (__m64)(__v4hi){-10, +8, +6, -4}), -26, 34));367 368__m64 test_mm_maddubs_pi16(__m64 a, __m64 b) {369  // CHECK-LABEL: test_mm_maddubs_pi16370  // CHECK: call <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128(371  return _mm_maddubs_pi16(a, b);372}373TEST_CONSTEXPR(match_v4hi(_mm_maddubs_pi16((__m64)(__v8qi){16, 17, 18, 19, 20, 21, 22, 23}, (__m64)(__v8qi){1, 2, 3, 4, 5, 0, 7, 8}), 50, 130, 100, 338));374 375void test_mm_maskmove_si64(__m64 d, __m64 n, char *p) {376  // CHECK-LABEL: test_mm_maskmove_si64377  // CHECK: call void @llvm.x86.sse2.maskmov.dqu(378  _mm_maskmove_si64(d, n, p);379}380 381__m64 test_mm_max_pi16(__m64 a, __m64 b) {382  // CHECK-LABEL: test_mm_max_pi16383  // CHECK: call <4 x i16> @llvm.smax.v4i16(384  return _mm_max_pi16(a, b);385}386TEST_CONSTEXPR(match_v4hi(_mm_max_pi16((__m64)(__v4hi){+1, -2, +3, -4}, (__m64)(__v4hi){-1, 2, -3, 4}), 1, 2, 3, 4));387 388__m64 test_mm_max_pu8(__m64 a, __m64 b) {389  // CHECK-LABEL: test_mm_max_pu8390  // CHECK: call <8 x i8> @llvm.umax.v8i8(391  return _mm_max_pu8(a, b);392}393TEST_CONSTEXPR(match_v8qi(_mm_max_pu8((__m64)(__v8qs){ 16, 17, 18, -19, -20, 21, -22, -23}, (__m64)(__v8qs){ 1, -2, -3, 4, 5, 0, 7, -8}),  16, -2, -3, -19, -20, 21, -22, -8));394 395__m64 test_mm_min_pi16(__m64 a, __m64 b) {396  // CHECK-LABEL: test_mm_min_pi16397  // CHECK: call <4 x i16> @llvm.smin.v4i16(398  return _mm_min_pi16(a, b);399}400TEST_CONSTEXPR(match_v4hi(_mm_min_pi16((__m64)(__v4hi){+1, -2, +3, -4}, (__m64)(__v4hi){-1, 2, -3, 4}), -1, -2, -3, -4));401 402__m64 test_mm_min_pu8(__m64 a, __m64 b) {403  // CHECK-LABEL: test_mm_min_pu8404  // CHECK: call <8 x i8> @llvm.umin.v8i8(405  return _mm_min_pu8(a, b);406}407TEST_CONSTEXPR(match_v8qi(_mm_min_pu8((__m64)(__v8qs){ 16, 17, 18, -19, -20, 21, -22, -23}, (__m64)(__v8qs){ 1, -2, -3, 4, 5, 0, 7, -8}),  1, 17, 18, 4, 5, 0, 7, -23));408 409int test_mm_movemask_pi8(__m64 a) {410  // CHECK-LABEL: test_mm_movemask_pi8411  // CHECK: call {{.*}}i32 @llvm.x86.sse2.pmovmskb.128(412  return _mm_movemask_pi8(a);413}414TEST_CONSTEXPR(_mm_movemask_pi8((__m64)((__v8qu){0x7F,0x80,0x01,0xFF,0x00,0xAA,0x55,0xC3})) == 0xAA);415TEST_CONSTEXPR(_mm_movemask_pi8((__m64)((__v2si){(int)0x80FF00AA,(int)0x7F0183E1})) == 0x3D);416TEST_CONSTEXPR(_mm_movemask_pi8((__m64)((__v1di){(long long)0xE110837A00924DB0ULL})) == 0xA5);417 418 419__m64 test_mm_mul_su32(__m64 a, __m64 b) {420  // CHECK-LABEL: test_mm_mul_su32421  // CHECK: and <2 x i64> {{%.*}}, splat (i64 4294967295)422  // CHECK: and <2 x i64> {{%.*}}, splat (i64 4294967295)423  // CHECK: mul <2 x i64> %{{.*}}, %{{.*}}424  return _mm_mul_su32(a, b);425}426TEST_CONSTEXPR(match_m64(_mm_mul_su32((__m64)(__v2si){+1, -2}, (__m64)(__v2si){-10, +8}), 4294967286));427 428__m64 test_mm_mulhi_pi16(__m64 a, __m64 b) {429  // CHECK-LABEL: test_mm_mulhi_pi16430  // CHECK: call <8 x i16> @llvm.x86.sse2.pmulh.w(431  return _mm_mulhi_pi16(a, b);432}433TEST_CONSTEXPR(match_v4hi(_mm_mulhi_pi16((__m64)(__v4hi){+1, -2, +3, -4}, (__m64)(__v4hi){-10, +8, +6, -4}), -1, -1, 0, 0));434 435__m64 test_mm_mulhi_pu16(__m64 a, __m64 b) {436  // CHECK-LABEL: test_mm_mulhi_pu16437  // CHECK: call <8 x i16> @llvm.x86.sse2.pmulhu.w(438  return _mm_mulhi_pu16(a, b);439}440TEST_CONSTEXPR(match_v4hi(_mm_mulhi_pu16((__m64)(__v4hi){+1, -2, +3, -4}, (__m64)(__v4hi){-10, +8, +6, -4}), 0, 7, 0, -8));441 442__m64 test_mm_mulhrs_pi16(__m64 a, __m64 b) {443  // CHECK-LABEL: test_mm_mulhrs_pi16444  // CHECK: call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(445  return _mm_mulhrs_pi16(a, b);446}447TEST_CONSTEXPR(match_v4hi(_mm_mulhrs_pi16((__m64)(__v4hi){+100, +200, -300, -400}, (__m64)(__v4hi){+30000, -20000, +10000, -5000}), +92, -122, -92, +61));448 449__m64 test_mm_mullo_pi16(__m64 a, __m64 b) {450  // CHECK-LABEL: test_mm_mullo_pi16451  // CHECK: mul <4 x i16> {{%.*}}, {{%.*}}452  return _mm_mullo_pi16(a, b);453}454TEST_CONSTEXPR(match_v4hi(_mm_mullo_pi16((__m64)(__v4hi){+1, -2, +3, -4}, (__m64)(__v4hi){-10, +8, +6, -4}), -10, -16, +18, +16));455 456__m64 test_mm_or_si64(__m64 a, __m64 b) {457  // CHECK-LABEL: test_mm_or_si64458  // CHECK: or <1 x i64> {{%.*}}, {{%.*}}459  return _mm_or_si64(a, b);460}461TEST_CONSTEXPR(match_v4hi(_mm_or_si64((__m64)(__v4hi){0, -1, 0, -1}, (__m64)(__v4hi){0, 0, -1, -1}), 0, -1, -1, -1));462 463__m64 test_mm_packs_pi16(__m64 a, __m64 b) {464  // CHECK-LABEL: test_mm_packs_pi16465  // CHECK: call <16 x i8> @llvm.x86.sse2.packsswb.128(466  return _mm_packs_pi16(a, b);467}468TEST_CONSTEXPR(match_v8qi(_mm_packs_pi16((__m64)(__v4hi){130, -200, 127, -128}, (__m64)(__v4hi){0, 1, -1, 255}), 127, -128, 127, -128, 0, 1, -1, 127));469 470__m64 test_mm_packs_pi32(__m64 a, __m64 b) {471  // CHECK-LABEL: test_mm_packs_pi32472  // CHECK: call <8 x i16> @llvm.x86.sse2.packssdw.128(473  return _mm_packs_pi32(a, b);474}475TEST_CONSTEXPR(match_v4hi(_mm_packs_pi32((__m64)(__v2si){40000, -50000}, (__m64)(__v2si){0, 70000}), 32767, -32768, 0, 32767));476 477__m64 test_mm_packs_pu16(__m64 a, __m64 b) {478  // CHECK-LABEL: test_mm_packs_pu16479  // CHECK: call <16 x i8> @llvm.x86.sse2.packuswb.128(480  return _mm_packs_pu16(a, b);481}482TEST_CONSTEXPR(match_v8qi(_mm_packs_pu16((__m64)(__v4hi){-1, 0, 128, 300}, (__m64)(__v4hi){255, -200, 42, -42}), 0, 0, -128, -1, -1, 0, 42, 0));483 484__m64 test_mm_sad_pu8(__m64 a, __m64 b) {485  // CHECK-LABEL: test_mm_sad_pu8486  // CHECK: call <2 x i64> @llvm.x86.sse2.psad.bw(<16 x i8>487  return _mm_sad_pu8(a, b);488}489 490__m64 test_mm_set_pi8(char a, char b, char c, char d, char e, char f, char g, char h) {491  // CHECK-LABEL: test_mm_set_pi8492  // CHECK: insertelement <8 x i8>493  // CHECK: insertelement <8 x i8>494  // CHECK: insertelement <8 x i8>495  // CHECK: insertelement <8 x i8>496  // CHECK: insertelement <8 x i8>497  // CHECK: insertelement <8 x i8>498  // CHECK: insertelement <8 x i8>499  // CHECK: insertelement <8 x i8>500  return _mm_set_pi8(a, b, c, d, e, f, g, h);501}502TEST_CONSTEXPR(match_v8qi(_mm_set_pi8(0, -1, 2, -3, 4, -5, 6, -7), -7, 6, -5, 4, -3, 2, -1, 0));503 504__m64 test_mm_set_pi16(short a, short b, short c, short d) {505  // CHECK-LABEL: test_mm_set_pi16506  // CHECK: insertelement <4 x i16>507  // CHECK: insertelement <4 x i16>508  // CHECK: insertelement <4 x i16>509  // CHECK: insertelement <4 x i16>510  return _mm_set_pi16(a, b, c, d);511}512TEST_CONSTEXPR(match_v4hi(_mm_set_pi16(101, 102, -103, -104), -104, -103, 102, 101));513 514__m64 test_mm_set_pi32(int a, int b) {515  // CHECK-LABEL: test_mm_set_pi32516  // CHECK: insertelement <2 x i32>517  // CHECK: insertelement <2 x i32>518  return _mm_set_pi32(a, b);519}520TEST_CONSTEXPR(match_v2si(_mm_set_pi32(5000, -1500), -1500, 5000));521 522__m64 test_mm_setr_pi8(char a, char b, char c, char d, char e, char f, char g, char h) {523  // CHECK-LABEL: test_mm_setr_pi8524  // CHECK: insertelement <8 x i8>525  // CHECK: insertelement <8 x i8>526  // CHECK: insertelement <8 x i8>527  // CHECK: insertelement <8 x i8>528  // CHECK: insertelement <8 x i8>529  // CHECK: insertelement <8 x i8>530  // CHECK: insertelement <8 x i8>531  // CHECK: insertelement <8 x i8>532  return _mm_setr_pi8(a, b, c, d, e, f, g, h);533}534TEST_CONSTEXPR(match_v8qi(_mm_setr_pi8(0, -1, 2, -3, 4, -5, 6, -7), 0, -1, 2, -3, 4, -5, 6, -7));535 536__m64 test_mm_setr_pi16(short a, short b, short c, short d) {537  // CHECK-LABEL: test_mm_setr_pi16538  // CHECK: insertelement <4 x i16>539  // CHECK: insertelement <4 x i16>540  // CHECK: insertelement <4 x i16>541  // CHECK: insertelement <4 x i16>542  return _mm_setr_pi16(a, b, c, d);543}544TEST_CONSTEXPR(match_v4hi(_mm_setr_pi16(101, 102, -103, -104), 101, 102, -103, -104));545 546__m64 test_mm_setr_pi32(int a, int b) {547  // CHECK-LABEL: test_mm_setr_pi32548  // CHECK: insertelement <2 x i32>549  // CHECK: insertelement <2 x i32>550  return _mm_setr_pi32(a, b);551}552TEST_CONSTEXPR(match_v2si(_mm_setr_pi32(5000, -1500), 5000, -1500));553 554__m64 test_mm_setzero_si64() {555  // CHECK-LABEL: test_mm_setzero_si64556  // CHECK: zeroinitializer557  return _mm_setzero_si64();558}559TEST_CONSTEXPR(match_m64(_mm_setzero_si64(), 0ULL));560 561__m64 test_mm_set1_pi8(char a) {562  // CHECK-LABEL: test_mm_set1_pi8563  // CHECK: insertelement <8 x i8>564  // CHECK: insertelement <8 x i8>565  // CHECK: insertelement <8 x i8>566  // CHECK: insertelement <8 x i8>567  // CHECK: insertelement <8 x i8>568  // CHECK: insertelement <8 x i8>569  // CHECK: insertelement <8 x i8>570  // CHECK: insertelement <8 x i8>571  return _mm_set1_pi8(a);572}573TEST_CONSTEXPR(match_v8qi(_mm_set1_pi8(99), 99, 99, 99, 99, 99, 99, 99, 99));574 575__m64 test_mm_set1_pi16(short a) {576  // CHECK-LABEL: test_mm_set1_pi16577  // CHECK: insertelement <4 x i16>578  // CHECK: insertelement <4 x i16>579  // CHECK: insertelement <4 x i16>580  // CHECK: insertelement <4 x i16>581  return _mm_set1_pi16(a);582}583TEST_CONSTEXPR(match_v4hi(_mm_set1_pi16(-128), -128, -128, -128, -128));584 585__m64 test_mm_set1_pi32(int a) {586  // CHECK-LABEL: test_mm_set1_pi32587  // CHECK: insertelement <2 x i32>588  // CHECK: insertelement <2 x i32>589  return _mm_set1_pi32(a);590}591TEST_CONSTEXPR(match_v2si(_mm_set1_pi32(55), 55, 55));592 593__m64 test_mm_shuffle_pi8(__m64 a, __m64 b) {594  // CHECK-LABEL: test_mm_shuffle_pi8595  // CHECK: call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(596  return _mm_shuffle_pi8(a, b);597}598 599TEST_CONSTEXPR(match_v8qi(_mm_shuffle_pi8((__m64)(__v8qi){0,1,2,3,4,5,6,7}, (__m64)(__v8qi){10,20,30,40,50,60,70,80}), 2,4,6,0,2,4,6,0));600 601__m64 test_mm_shuffle_pi16(__m64 a) {602  // CHECK-LABEL: test_mm_shuffle_pi16603  // CHECK: shufflevector <4 x i16> {{%.*}}, <4 x i16> {{%.*}}, <4 x i32> <i32 3, i32 0, i32 0, i32 0>604  return _mm_shuffle_pi16(a, 3);605}606TEST_CONSTEXPR(match_v4hi(_mm_shuffle_pi16(((__m64)(__v4hi){0,1,2,3}), 3), 3,0,0,0));607 608__m64 test_mm_sign_pi8(__m64 a, __m64 b) {609  // CHECK-LABEL: test_mm_sign_pi8610  // CHECK: call <16 x i8> @llvm.x86.ssse3.psign.b.128(611  return _mm_sign_pi8(a, b);612}613TEST_CONSTEXPR(match_v8qi(_mm_sign_pi8((__m64)(__v8qi){0,0,0,0, 0,0,0,0}, (__m64)(__v8qi){0,0,0,0, 0,0,0,0}), 0,0,0,0, 0,0,0,0));614TEST_CONSTEXPR(match_v8qi(_mm_sign_pi8((__m64)(__v8qi){6,7,6,7, 6,7,6,7}, (__m64)(__v8qi){1,1,1,1, 0,0,0,0}), 6,7,6,7, 0,0,0,0));615 616__m64 test_mm_sign_pi16(__m64 a, __m64 b) {617  // CHECK-LABEL: test_mm_sign_pi16618  // CHECK: call <8 x i16> @llvm.x86.ssse3.psign.w.128(619  return _mm_sign_pi16(a, b);620}621TEST_CONSTEXPR(match_v4hi(_mm_sign_pi16((__m64)(__v4hi){-1,0,1,0}, (__m64)(__v4hi){1,0,-1,0}), -1,0,-1,0));622 623__m64 test_mm_sign_pi32(__m64 a, __m64 b) {624  // CHECK-LABEL: test_mm_sign_pi32625  // CHECK: call <4 x i32> @llvm.x86.ssse3.psign.d.128(626  return _mm_sign_pi32(a, b);627}628TEST_CONSTEXPR(match_v2si(_mm_sign_pi32((__m64)(__v2si){0x7FFF, -1}, (__m64)(__v2si){-1, 0x7FFF}), -0x7FFF, -1));629 630__m64 test_mm_sll_pi16(__m64 a, __m64 b) {631  // CHECK-LABEL: test_mm_sll_pi16632  // CHECK: call <8 x i16> @llvm.x86.sse2.psll.w(633  return _mm_sll_pi16(a, b);634}635TEST_CONSTEXPR(match_v4hi(_mm_sll_pi16((__m64)(__v4hi){1, 2, 3, 4}, (__m64)(__v4hi){1, 0, 0, 0}), 2, 4, 6, 8));636TEST_CONSTEXPR(match_v4hi(_mm_sll_pi16((__m64)(__v4hi){1, 2, 3, 4}, (__m64)(__v4hi){16, 0, 0, 0}), 0, 0, 0, 0));637 638__m64 test_mm_sll_pi32(__m64 a, __m64 b) {639  // CHECK-LABEL: test_mm_sll_pi32640  // CHECK: call <4 x i32> @llvm.x86.sse2.psll.d(641  return _mm_sll_pi32(a, b);642}643TEST_CONSTEXPR(match_v2si(_mm_sll_pi32((__m64)(__v2si){1, 2}, (__m64)(__v2si){1, 0}), 2, 4));644TEST_CONSTEXPR(match_v2si(_mm_sll_pi32((__m64)(__v2si){1, 2}, (__m64)(__v2si){32, 0}), 0, 0));645 646__m64 test_mm_sll_si64(__m64 a, __m64 b) {647  // CHECK-LABEL: test_mm_sll_si64648  // CHECK: call <2 x i64> @llvm.x86.sse2.psll.q(649  return _mm_sll_si64(a, b);650}651TEST_CONSTEXPR(match_v1di(_mm_sll_si64((__m64)(__v1di){1}, (__m64)(__v1di){1}), 2));652TEST_CONSTEXPR(match_v1di(_mm_sll_si64((__m64)(__v1di){1}, (__m64)(__v1di){64}), 0));653 654__m64 test_mm_slli_pi16(__m64 a) {655  // CHECK-LABEL: test_mm_slli_pi16656  // CHECK: call <8 x i16> @llvm.x86.sse2.pslli.w(657  return _mm_slli_pi16(a, 3);658}659TEST_CONSTEXPR(match_v4hi(_mm_slli_pi16((__m64)(__v4hi){0, 1, 2, 3}, 0), 0, 1, 2, 3));660TEST_CONSTEXPR(match_v4hi(_mm_slli_pi16((__m64)(__v4hi){0, 1, 2, 3}, 1), 0, 0x2, 0x4, 0x6));661TEST_CONSTEXPR(match_v4hi(_mm_slli_pi16((__m64)(__v4hi){0, 1, 2, 3}, 15), 0, 0x8000, 0x0, 0x8000));662TEST_CONSTEXPR(match_v4hi(_mm_slli_pi16((__m64)(__v4hi){0, 1, 2, 3}, 16), 0, 0, 0, 0));663TEST_CONSTEXPR(match_v4hi(_mm_slli_pi16((__m64)(__v4hi){0, 1, 2, 3}, 17), 0, 0, 0, 0));664 665__m64 test_mm_slli_pi32(__m64 a) {666  // CHECK-LABEL: test_mm_slli_pi32667  // CHECK: call <4 x i32> @llvm.x86.sse2.pslli.d(668  return _mm_slli_pi32(a, 3);669}670TEST_CONSTEXPR(match_v2si(_mm_slli_pi32((__m64)(__v2si){0, 1}, 0), 0, 1));671TEST_CONSTEXPR(match_v2si(_mm_slli_pi32((__m64)(__v2si){0, 1}, 1), 0, 0x2));672TEST_CONSTEXPR(match_v2si(_mm_slli_pi32((__m64)(__v2si){1, 2}, 2), 0x4, 0x8));673TEST_CONSTEXPR(match_v2su(_mm_slli_pi32((__m64)(__v2su){1, 1}, 31), 0x80000000, 0x80000000));674TEST_CONSTEXPR(match_v2si(_mm_slli_pi32((__m64)(__v2si){1, 1}, 32), 0, 0));675TEST_CONSTEXPR(match_v2si(_mm_slli_pi32((__m64)(__v2si){1, 1}, 33), 0, 0));676 677__m64 test_mm_slli_si64(__m64 a) {678  // CHECK-LABEL: test_mm_slli_si64679  // CHECK: call <2 x i64> @llvm.x86.sse2.pslli.q(680  return _mm_slli_si64(a, 3);681}682TEST_CONSTEXPR(match_v1di(_mm_slli_si64((__m64)(__v1di){0}, 0), 0));683TEST_CONSTEXPR(match_v1di(_mm_slli_si64((__m64)(__v1di){1}, 1), 0x2));684TEST_CONSTEXPR(match_v1di(_mm_slli_si64((__m64)(__v1di){2}, 2), 0x8));685TEST_CONSTEXPR(match_v1du(_mm_slli_si64((__m64)(__v1du){1}, 63), 0x8000000000000000ULL));686TEST_CONSTEXPR(match_v1di(_mm_slli_si64((__m64)(__v1di){1}, 64), 0));687TEST_CONSTEXPR(match_v1di(_mm_slli_si64((__m64)(__v1di){1}, 65), 0));688 689__m64 test_mm_sra_pi16(__m64 a, __m64 b) {690  // CHECK-LABEL: test_mm_sra_pi16691  // CHECK: call <8 x i16> @llvm.x86.sse2.psra.w(692  return _mm_sra_pi16(a, b);693}694TEST_CONSTEXPR(match_v4hi(_mm_sra_pi16((__m64)(__v4hi){-16, 16, -8, 8}, (__m64)(__v4hi){1, 0, 0, 0}), -8, 8, -4, 4));695TEST_CONSTEXPR(match_v4hi(_mm_sra_pi16((__m64)(__v4hi){-16, 16, -8, 8}, (__m64)(__v4hi){16, 0, 0, 0}), -1, 0, -1, 0));696 697__m64 test_mm_sra_pi32(__m64 a, __m64 b) {698  // CHECK-LABEL: test_mm_sra_pi32699  // CHECK: call <4 x i32> @llvm.x86.sse2.psra.d(700  return _mm_sra_pi32(a, b);701}702TEST_CONSTEXPR(match_v2si(_mm_sra_pi32((__m64)(__v2si){-16, 16}, (__m64)(__v2si){1, 0}), -8, 8));703TEST_CONSTEXPR(match_v2si(_mm_sra_pi32((__m64)(__v2si){-16, 16}, (__m64)(__v2si){32, 0}), -1, 0));704 705__m64 test_mm_srai_pi16(__m64 a) {706  // CHECK-LABEL: test_mm_srai_pi16707  // CHECK: call <8 x i16> @llvm.x86.sse2.psrai.w(708  return _mm_srai_pi16(a, 3);709}710TEST_CONSTEXPR(match_v4hi(_mm_srai_pi16((__m64)(__v4hi){-1, 1, 2, 3}, 1), -1, 0, 1, 1));711TEST_CONSTEXPR(match_v4hi(_mm_srai_pi16((__m64)(__v4hi){-32768, -1, 1, 2}, 15), -1, -1, 0, 0));712TEST_CONSTEXPR(match_v4hi(_mm_srai_pi16((__m64)(__v4hi){-32768, -1, 2, 3}, 16), -1, -1, 0, 0));713TEST_CONSTEXPR(match_v4hi(_mm_srai_pi16((__m64)(__v4hi){-1, 1, 2, 3}, 16), -1, 0, 0, 0));714TEST_CONSTEXPR(match_v4hi(_mm_srai_pi16((__m64)(__v4hi){-1, 1, 2, 3}, 17), -1, 0, 0, 0));715TEST_CONSTEXPR(match_v4hi(_mm_srai_pi16((__m64)(__v4hi){-1, 1, -42, -32768}, 100), -1, 0, -1, -1));716TEST_CONSTEXPR(match_v4hi(_mm_srai_pi16((__m64)(__v4hi){-1, 1, 2, 3}, 200), -1, 0, 0, 0));717TEST_CONSTEXPR(match_v4hi(_mm_srai_pi16((__m64)(__v4hi){-32768, 32767, -2, 0}, 1), -16384, 16383, -1, 0));718TEST_CONSTEXPR(match_v4hi(_mm_srai_pi16((__m64)(__v4hi){-32768, 32767, -2, 0}, 15), -1, 0, -1, 0));719TEST_CONSTEXPR(match_v4hi(_mm_srai_pi16((__m64)(__v4hi){-32768, 32767, -2, 0}, 30), -1, 0, -1, 0));720 721__m64 test_mm_srai_pi32(__m64 a) {722  // CHECK-LABEL: test_mm_srai_pi32723  // CHECK: call <4 x i32> @llvm.x86.sse2.psrai.d(724  return _mm_srai_pi32(a, 3);725}726TEST_CONSTEXPR(match_v2si(_mm_srai_pi32((__m64)(__v2si){-32768, 32767}, 30), -1, 0));727TEST_CONSTEXPR(match_v2si(_mm_srai_pi32((__m64)(__v2si){-2, 20}, 1), -1, 0xa));728TEST_CONSTEXPR(match_v2si(_mm_srai_pi32((__m64)(__v2si){-1, 20}, 1), -1, 0xa));729 730__m64 test_mm_srl_pi16(__m64 a, __m64 b) {731  // CHECK-LABEL: test_mm_srl_pi16732  // CHECK: call <8 x i16> @llvm.x86.sse2.psrl.w(733  return _mm_srl_pi16(a, b);734}735TEST_CONSTEXPR(match_v4hu(_mm_srl_pi16((__m64)(__v4hu){0x8000, 16, 8, 4}, (__m64)(__v4hi){1, 0, 0, 0}), 0x4000, 8, 4, 2));736TEST_CONSTEXPR(match_v4hi(_mm_srl_pi16((__m64)(__v4hi){-1, 16, 8, 4}, (__m64)(__v4hi){16, 0, 0, 0}), 0, 0, 0, 0));737 738__m64 test_mm_srl_pi32(__m64 a, __m64 b) {739  // CHECK-LABEL: test_mm_srl_pi32740  // CHECK: call <4 x i32> @llvm.x86.sse2.psrl.d(741  return _mm_srl_pi32(a, b);742}743TEST_CONSTEXPR(match_v2su(_mm_srl_pi32((__m64)(__v2su){0x80000000, 16}, (__m64)(__v2si){1, 0}), 0x40000000, 8));744TEST_CONSTEXPR(match_v2si(_mm_srl_pi32((__m64)(__v2si){-1, 16}, (__m64)(__v2si){32, 0}), 0, 0));745 746__m64 test_mm_srl_si64(__m64 a, __m64 b) {747  // CHECK-LABEL: test_mm_srl_si64748  // CHECK: call <2 x i64> @llvm.x86.sse2.psrl.q(749  return _mm_srl_si64(a, b);750}751TEST_CONSTEXPR(match_v1du(_mm_srl_si64((__m64)(__v1du){0x8000000000000000ULL}, (__m64)(__v1di){1}), 0x4000000000000000ULL));752TEST_CONSTEXPR(match_v1di(_mm_srl_si64((__m64)(__v1di){-1}, (__m64)(__v1di){64}), 0));753 754__m64 test_mm_srli_pi16(__m64 a) {755  // CHECK-LABEL: test_mm_srli_pi16756  // CHECK: call <8 x i16> @llvm.x86.sse2.psrli.w(757  return _mm_srli_pi16(a, 3);758}759TEST_CONSTEXPR(match_v4hi(_mm_srli_pi16((__m64)(__v4hi){0, 1, 2, 3}, 1), 0, 0x0, 0x1, 0x1));760TEST_CONSTEXPR(match_v4hi(_mm_srli_pi16((__m64)(__v4hi){0, 1, 2, 3}, 1), 0, 0x0, 0x1, 0x1));761TEST_CONSTEXPR(match_v4hi(_mm_srli_pi16((__m64)(__v4hi){-1, 0, 0, 0}, 1), 0x7fff, 0, 0, 0));762TEST_CONSTEXPR(match_v4hi(_mm_srli_pi16((__m64)(__v4hi){0, 1, 2, 3}, 16), 0, 0, 0, 0));763TEST_CONSTEXPR(match_v4hi(_mm_srli_pi16((__m64)(__v4hi){0, 1, 2, 3}, 17), 0, 0, 0, 0));764 765__m64 test_mm_srli_pi32(__m64 a) {766  // CHECK-LABEL: test_mm_srli_pi32767  // CHECK: call <4 x i32> @llvm.x86.sse2.psrli.d(768  return _mm_srli_pi32(a, 3);769}770TEST_CONSTEXPR(match_v2si(_mm_srli_pi32((__m64)(__v2si){1, 1025}, 2), 0x0, 0x100));771 772__m64 test_mm_srli_si64(__m64 a) {773  // CHECK-LABEL: test_mm_srli_si64774  // CHECK: call <2 x i64> @llvm.x86.sse2.psrli.q(775  return _mm_srli_si64(a, 3);776}777TEST_CONSTEXPR(match_v1di(_mm_srli_si64((__m64)(__v1di){1025}, 2), 0x100));778 779void test_mm_stream_pi(__m64 *p, __m64 a) {780  // CHECK-LABEL: test_mm_stream_pi781  // CHECK: store <1 x i64> {{%.*}}, ptr {{%.*}}, align 8, !nontemporal782  _mm_stream_pi(p, a);783}784 785void test_mm_stream_pi_void(void *p, __m64 a) {786  // CHECK-LABEL: test_mm_stream_pi_void787  // CHECK: store <1 x i64> {{%.*}}, ptr {{%.*}}, align 8, !nontemporal788  _mm_stream_pi(p, a);789}790 791__m64 test_mm_sub_pi8(__m64 a, __m64 b) {792  // CHECK-LABEL: test_mm_sub_pi8793  // CHECK: sub <8 x i8> {{%.*}}, {{%.*}}794  return _mm_sub_pi8(a, b);795}796TEST_CONSTEXPR(match_v8qi(_mm_sub_pi8((__m64)(__v8qs){-3, +2, -1, 0, +1, -2, +3, -4}, (__m64)(__v8qs){-18, +16, -14, +12, -10, +8, +6, -4}), +15, -14, +13, -12, +11, -10, -3, 0));797 798__m64 test_mm_sub_pi16(__m64 a, __m64 b) {799  // CHECK-LABEL: test_mm_sub_pi16800  // CHECK: sub <4 x i16> {{%.*}}, {{%.*}}801  return _mm_sub_pi16(a, b);802}803TEST_CONSTEXPR(match_v4hi(_mm_sub_pi16((__m64)(__v4hi){+1, -2, +3, -4}, (__m64)(__v4hi){-10, +8, +6, -4}), +11, -10, -3, 0));804 805__m64 test_mm_sub_pi32(__m64 a, __m64 b) {806  // CHECK-LABEL: test_mm_sub_pi32807  // CHECK: sub <2 x i32> {{%.*}}, {{%.*}}808  return _mm_sub_pi32(a, b);809}810TEST_CONSTEXPR(match_v2si(_mm_sub_pi32((__m64)(__v2si){+5, -3}, (__m64)(__v2si){-9, +8}), +14, -11));811 812__m64 test_mm_sub_si64(__m64 a, __m64 b) {813  // CHECK-LABEL: test_mm_sub_si64814  // CHECK: sub i64 {{%.*}}, {{%.*}}815  return _mm_sub_si64(a, b);816}817TEST_CONSTEXPR(match_v1di(_mm_sub_si64((__m64)(__v1di){+42}, (__m64)(__v1di){-100}), +142));818 819__m64 test_mm_subs_pi8(__m64 a, __m64 b) {820  // CHECK-LABEL: test_mm_subs_pi8821  // CHECK: call <8 x i8> @llvm.ssub.sat.v8i8(822  return _mm_subs_pi8(a, b);823}824TEST_CONSTEXPR(match_v8qi(_mm_subs_pi8((__m64)(__v8qs){+100, +50, -100, +20, +80, -50, +120, -20}, (__m64)(__v8qs){-50, -80, +50, -110, -60, +30, -20, +10}), +127, +127, -128, +127, +127, -80, +127, -30));825 826__m64 test_mm_subs_pi16(__m64 a, __m64 b) {827  // CHECK-LABEL: test_mm_subs_pi16828  // CHECK: call <4 x i16> @llvm.ssub.sat.v4i16(829  return _mm_subs_pi16(a, b);830}831TEST_CONSTEXPR(match_v4hi(_mm_subs_pi16((__m64)(__v4hi){+32000, -32000, +32000, -32000}, (__m64)(__v4hi){-800, +800, +800, -800}), +32767, -32768, +31200, -31200));832 833__m64 test_mm_subs_pu8(__m64 a, __m64 b) {834  // CHECK-LABEL: test_mm_subs_pu8835  // CHECK: call <8 x i8> @llvm.usub.sat.v8i8(836  return _mm_subs_pu8(a, b);837}838TEST_CONSTEXPR(match_v8qu(_mm_subs_pu8((__m64)(__v8qu){0, +1, +2, +3, +180, +250, +120, +200}, (__m64)(__v8qu){0, +1, +1, +255, +200, +30, +200, +10}), 0, 0, +1, 0, 0, +220, 0, +190));839 840__m64 test_mm_subs_pu16(__m64 a, __m64 b) {841  // CHECK-LABEL: test_mm_subs_pu16842  // CHECK: call <4 x i16> @llvm.usub.sat.v4i16(843  return _mm_subs_pu16(a, b);844}845TEST_CONSTEXPR(match_v4hu(_mm_subs_pu16((__m64)(__v4hu){+0, +1, +32000, +33000}, (__m64)(__v4hu){0, +65535, +800, +34000}), 0, 0, +31200, 0));846 847int test_m_to_int(__m64 a) {848  // CHECK-LABEL: test_m_to_int849  // CHECK: extractelement <2 x i32>850  return _m_to_int(a);851}852TEST_CONSTEXPR(_m_to_int((__m64)(__v4hi){0, -2, -1, -1}) == -131072);853 854long long test_m_to_int64(__m64 a) {855  // CHECK-LABEL: test_m_to_int64856  return _m_to_int64(a);857}858TEST_CONSTEXPR(_m_to_int64((__m64)(__v4hi){0, -2, 0, -1}) == -281470681874432LL);859 860__m64 test_mm_unpackhi_pi8(__m64 a, __m64 b) {861  // CHECK-LABEL: test_mm_unpackhi_pi8862  // CHECK: shufflevector <8 x i8> {{%.*}}, <8 x i8> {{%.*}}, <8 x i32> <i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>863  return _mm_unpackhi_pi8(a, b);864}865TEST_CONSTEXPR(match_v8qi(_mm_unpackhi_pi8((__m64)(__v8qi){0, 1, 2, 3, 4, 5, 6, 7}, (__m64)(__v8qi){8, 9, 10, 11, 12, 13, 14, 15}), 4, 12, 5, 13, 6, 14, 7, 15));866 867__m64 test_mm_unpackhi_pi16(__m64 a, __m64 b) {868  // CHECK-LABEL: test_mm_unpackhi_pi16869  // CHECK: shufflevector <4 x i16> {{%.*}}, <4 x i16> {{%.*}}, <4 x i32> <i32 2, i32 6, i32 3, i32 7>870  return _mm_unpackhi_pi16(a, b);871}872TEST_CONSTEXPR(match_v4hi(_mm_unpackhi_pi16((__m64)(__v4hi){0, 1, 2, 3}, (__m64)(__v4hi){ 4, 5, 6, 7}), 2, 6, 3, 7));873 874__m64 test_mm_unpackhi_pi32(__m64 a, __m64 b) {875  // CHECK-LABEL: test_mm_unpackhi_pi32876  // CHECK: shufflevector <2 x i32> {{%.*}}, <2 x i32> {{%.*}}, <2 x i32> <i32 1, i32 3>877  return _mm_unpackhi_pi32(a, b);878}879TEST_CONSTEXPR(match_v2si(_mm_unpackhi_pi32((__m64)(__v2si){0, 1}, (__m64)(__v2si){2, 3}), 1, 3));880 881__m64 test_mm_unpacklo_pi8(__m64 a, __m64 b) {882  // CHECK-LABEL: test_mm_unpacklo_pi8883  // CHECK: shufflevector <8 x i8> {{%.*}}, <8 x i8> {{%.*}}, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11>884  return _mm_unpacklo_pi8(a, b);885}886TEST_CONSTEXPR(match_v8qi(_mm_unpacklo_pi8((__m64)(__v8qi){0, 1, 2, 3, 4, 5, 6, 7}, (__m64)(__v8qi){8, 9, 10, 11, 12, 13, 14, 15}), 0, 8, 1, 9, 2, 10, 3, 11));887 888__m64 test_mm_unpacklo_pi16(__m64 a, __m64 b) {889  // CHECK-LABEL: test_mm_unpacklo_pi16890  // CHECK: shufflevector <4 x i16> {{%.*}}, <4 x i16> {{%.*}}, <4 x i32> <i32 0, i32 4, i32 1, i32 5>891  return _mm_unpacklo_pi16(a, b);892}893TEST_CONSTEXPR(match_v4hi(_mm_unpacklo_pi16((__m64)(__v4hi){0, 1, 2, 3}, (__m64)(__v4hi){ 4, 5, 6, 7}), 0, 4, 1, 5));894 895__m64 test_mm_unpacklo_pi32(__m64 a, __m64 b) {896  // CHECK-LABEL: test_mm_unpacklo_pi32897  // CHECK: shufflevector <2 x i32> {{%.*}}, <2 x i32> {{%.*}}, <2 x i32> <i32 0, i32 2>898  return _mm_unpacklo_pi32(a, b);899}900TEST_CONSTEXPR(match_v2si(_mm_unpacklo_pi32((__m64)(__v2si){0, 1}, (__m64)(__v2si){2, 3}), 0, 2));901 902__m64 test_mm_xor_si64(__m64 a, __m64 b) {903  // CHECK-LABEL: test_mm_xor_si64904  // CHECK: xor <1 x i64> {{%.*}}, {{%.*}}905  return _mm_xor_si64(a, b);906}907TEST_CONSTEXPR(match_v4hi(_mm_xor_si64((__m64)(__v4hi){0, -1, 0, -1}, (__m64)(__v4hi){0, 0, -1, -1}), 0, -1, -1, 0));908