373 lines · c
1// REQUIRES: powerpc-registered-target2 3// RUN: %clang -S -emit-llvm -target powerpc64-gnu-linux -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \4// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE5// RUN: %clang -S -emit-llvm -target powerpc64le-gnu-linux -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \6// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE7 8// RUN: %clang -S -emit-llvm -target powerpc64-unknown-freebsd13.0 -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \9// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE10// RUN: %clang -S -emit-llvm -target powerpc64le-unknown-freebsd13.0 -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \11// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE12 13// RUN: %clang -S -emit-llvm -target powerpc64-ibm-aix -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \14// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE15 16// RUN: %clang -x c++ -S -emit-llvm -target powerpc64le-gnu-linux -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \17// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -fsyntax-only18 19#include <tmmintrin.h>20 21__m64 res, m1, m2;22__m128i resi, mi1, mi2;23 24void __attribute__((noinline))25test_abs() {26 resi = _mm_abs_epi16(mi1);27 resi = _mm_abs_epi32(mi1);28 resi = _mm_abs_epi8(mi1);29 res = _mm_abs_pi16(m1);30 res = _mm_abs_pi32(m1);31 res = _mm_abs_pi8(m1);32}33 34// CHECK-LABEL: @test_abs35 36// CHECK-LABEL: define available_externally <2 x i64> @_mm_abs_epi1637// CHECK: call <8 x i16> @vec_abs(short vector[8])38 39// CHECK-LABEL: define available_externally <2 x i64> @_mm_abs_epi3240// CHECK: call <4 x i32> @vec_abs(int vector[4])41 42// CHECK-LABEL: define available_externally <2 x i64> @_mm_abs_epi843// CHECK: call <16 x i8> @vec_abs(signed char vector[16])44 45// CHECK-LABEL: define available_externally i64 @_mm_abs_pi1646// CHECK: %[[ABS:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_abs(short vector[8])47// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %[[ABS]] to <2 x i64>48// CHECK: extractelement <2 x i64> %[[CAST]], i32 049 50// CHECK-LABEL: define available_externally i64 @_mm_abs_pi3251// CHECK: %[[ABS:[0-9a-zA-Z_.]+]] = call <4 x i32> @vec_abs(int vector[4])52// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <4 x i32> %[[ABS]] to <2 x i64>53// CHECK: extractelement <2 x i64> %[[CAST]], i32 054 55// CHECK-LABEL: define available_externally i64 @_mm_abs_pi856// CHECK: %[[ABS:[0-9a-zA-Z_.]+]] = call <16 x i8> @vec_abs(signed char vector[16])57// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <16 x i8> %[[ABS]] to <2 x i64>58// CHECK: extractelement <2 x i64> %[[CAST]], i32 059 60void __attribute__((noinline))61test_alignr() {62 resi = _mm_alignr_epi8(mi1, mi2, 1U);63 res = _mm_alignr_pi8(m1, m2, 1U);64}65 66// CHECK-LABEL: @test_alignr67 68// CHECK-LABEL: define available_externally <2 x i64> @_mm_alignr_epi869// CHECK: %[[CONST:[0-9a-zA-Z_.]+]] = call i1 @llvm.is.constant.i32(i32 %0)70// CHECK: br i1 %[[CONST]]71// CHECK-BE: call <16 x i8> @vec_sld(unsigned char vector[16], unsigned char vector[16], unsigned int)72// CHECK-LE: call <16 x i8> @vec_reve(unsigned char vector[16])73// CHECK-LE: call <16 x i8> @vec_reve(unsigned char vector[16])74// CHECK-LE: call <16 x i8> @vec_sld(unsigned char vector[16], unsigned char vector[16], unsigned int)75// CHECK-LE: call <16 x i8> @vec_reve(unsigned char vector[16])76// CHECK: store <16 x i8> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 1677// CHECK: store <2 x i64> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 1678// CHECK: %[[SUB:[0-9a-zA-Z_.]+]] = sub i32 %{{[0-9a-zA-Z_.]+}}, 1679// CHECK: %[[MUL:[0-9a-zA-Z_.]+]] = mul i32 %[[SUB]], 880// CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %[[MUL]] to i881// CHECK: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext %[[TRUNC]])82// CHECK-BE: call <16 x i8> @vec_slo(unsigned char vector[16], unsigned char vector[16])83// CHECK-LE: call <16 x i8> @vec_sro(unsigned char vector[16], unsigned char vector[16])84// CHECK: %[[SUB2:[0-9a-zA-Z_.]+]] = sub i32 16, %{{[0-9a-zA-Z_.]+}}85// CHECK: %[[MUL2:[0-9a-zA-Z_.]+]] = mul i32 %[[SUB2]], 886// CHECK-BE: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %[[MUL2]] to i887// CHECK-BE: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext %[[TRUNC]])88// CHECK-BE: mul i32 %{{[0-9a-zA-Z_.]+}}, 889// CHECK-BE: call <16 x i8> @vec_sro(unsigned char vector[16], unsigned char vector[16])90// CHECK-BE: call <16 x i8> @vec_slo(unsigned char vector[16], unsigned char vector[16])91// CHECK-BE: call <16 x i8> @vec_or(unsigned char vector[16], unsigned char vector[16])92// CHECK-LE: %[[MUL3:[0-9a-zA-Z_.]+]] = mul i32 %{{[0-9a-zA-Z_.]+}}, 893// CHECK-LE: trunc i32 %[[MUL3]] to i894// CHECK-LE: call <16 x i8> @vec_splats(unsigned char)95// CHECK-LE: call <16 x i8> @vec_slo(unsigned char vector[16], unsigned char vector[16])96// CHECK-LE: call <16 x i8> @vec_sro(unsigned char vector[16], unsigned char vector[16])97// CHECK-LE: call <16 x i8> @vec_or(unsigned char vector[16], unsigned char vector[16])98 99// CHECK-LABEL: define available_externally i64 @_mm_alignr_pi8100// CHECK: %[[CMP:[0-9a-zA-Z_.]+]] = icmp ult i32 %{{[0-9a-zA-Z_.]+}}, 16101// CHECK: br i1 %[[CMP]]102// CHECK-BE: call <16 x i8> @vec_slo(unsigned char vector[16], unsigned char vector[16])103// CHECK-LE: call <16 x i8> @vec_sro(unsigned char vector[16], unsigned char vector[16])104// CHECK: extractelement <2 x i64> %{{[0-9a-zA-Z_.]+}}, i32 0105// CHECK: store i64 0, ptr %{{[0-9a-zA-Z_.]+}}, align 8106// CHECK: store i64 0, ptr %{{[0-9a-zA-Z_.]+}}, align 8107 108void __attribute__((noinline))109test_hadd() {110 resi = _mm_hadd_epi16(mi1, mi2);111 resi = _mm_hadd_epi32(mi1, mi2);112 res = _mm_hadd_pi16(m1, m2);113 res = _mm_hadd_pi32(m1, m2);114 resi = _mm_hadds_epi16(mi1, mi2);115 res = _mm_hadds_pi16(m1, m2);116}117 118// CHECK-LABEL: @test_hadd119 120// CHECK-LABEL: define available_externally <2 x i64> @_mm_hadd_epi16121// CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>, ptr %{{[0-9a-zA-Z_.]+}}, align 16122// CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16123// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>)124// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>)125// CHECK: call <8 x i16> @vec_add(short vector[8], short vector[8])126 127// CHECK-LABEL: define available_externally <2 x i64> @_mm_hadd_epi32128// CHECK: store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 16, i8 17, i8 18, i8 19, i8 24, i8 25, i8 26, i8 27>, ptr %{{[0-9a-zA-Z_.]+}}, align 16129// CHECK: store <16 x i8> <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 20, i8 21, i8 22, i8 23, i8 28, i8 29, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16130// CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 16, i8 17, i8 18, i8 19, i8 24, i8 25, i8 26, i8 27>)131// CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 20, i8 21, i8 22, i8 23, i8 28, i8 29, i8 30, i8 31>)132// CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])133 134// CHECK-LABEL: define available_externally i64 @_mm_hadd_pi16135// CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>, ptr %{{[0-9a-zA-Z_.]+}}, align 16136// CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>, ptr %{{[0-9a-zA-Z_.]+}}, align 16137// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>)138// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>)139// CHECK: call <8 x i16> @vec_add(short vector[8], short vector[8])140// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>141// CHECK: extractelement <2 x i64> %[[CAST]], i32 1142 143// CHECK-LABEL: define available_externally i64 @_mm_hadd_pi32144// CHECK: store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11>, ptr %{{[0-9a-zA-Z_.]+}}, align 16145// CHECK: store <16 x i8> <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15>, ptr %{{[0-9a-zA-Z_.]+}}, align 16146// CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15>)147// CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11>)148// CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])149// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <4 x i32> %{{[0-9a-zA-Z_.]+}} to <2 x i64>150// CHECK: extractelement <2 x i64> %[[CAST]], i32 1151 152// CHECK-LABEL: define available_externally <2 x i64> @_mm_hadds_epi16153// CHECK: store <4 x i32> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16154// CHECK: store <4 x i32> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16155// CHECK: call <4 x i32> @vec_sum4s(short vector[8], int vector[4])156// CHECK: call <4 x i32> @vec_sum4s(short vector[8], int vector[4])157// CHECK: call <8 x i16> @vec_packs(int vector[4], int vector[4])158 159// CHECK-LABEL: define available_externally i64 @_mm_hadds_pi16160// CHECK: call <4 x i32> @vec_sum4s(short vector[8], int vector[4])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef zeroinitializer)161// CHECK: call <8 x i16> @vec_packs(int vector[4], int vector[4])162// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>163// CHECK: extractelement <2 x i64> %[[CAST]], i32 1164 165void __attribute__((noinline))166test_hsub() {167 resi = _mm_hsub_epi16(mi1, mi2);168 resi = _mm_hsub_epi32(mi1, mi2);169 res = _mm_hsub_pi16(m1, m2);170 res = _mm_hsub_pi32(m1, m2);171 resi = _mm_hsubs_epi16(mi1, mi2);172 res = _mm_hsubs_pi16(m1, m2);173}174 175// CHECK-LABEL: @test_hsub176 177// CHECK-LABEL: define available_externally <2 x i64> @_mm_hsub_epi16178// CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>, ptr %{{[0-9a-zA-Z_.]+}}, align 16179// CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16180// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>)181// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>)182// CHECK: call <8 x i16> @vec_sub(short vector[8], short vector[8])183 184// CHECK-LABEL: define available_externally <2 x i64> @_mm_hsub_epi32185// CHECK: store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 16, i8 17, i8 18, i8 19, i8 24, i8 25, i8 26, i8 27>, ptr %{{[0-9a-zA-Z_.]+}}, align 16186// CHECK: store <16 x i8> <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 20, i8 21, i8 22, i8 23, i8 28, i8 29, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16187// CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 16, i8 17, i8 18, i8 19, i8 24, i8 25, i8 26, i8 27>)188// CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 20, i8 21, i8 22, i8 23, i8 28, i8 29, i8 30, i8 31>)189// CHECK: call <4 x i32> @vec_sub(int vector[4], int vector[4])190 191// CHECK-LABEL: define available_externally i64 @_mm_hsub_pi16192// CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>, ptr %{{[0-9a-zA-Z_.]+}}, align 16193// CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>, ptr %{{[0-9a-zA-Z_.]+}}, align 16194// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>)195// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>)196// CHECK: call <8 x i16> @vec_sub(short vector[8], short vector[8])197// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>198// CHECK: extractelement <2 x i64> %[[CAST]], i32 1199 200// CHECK-LABEL: define available_externally i64 @_mm_hsub_pi32201// CHECK: store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11>, ptr %{{[0-9a-zA-Z_.]+}}, align 16202// CHECK: store <16 x i8> <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15>, ptr %{{[0-9a-zA-Z_.]+}}, align 16203// CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15>)204// CHECK: call <4 x i32> @vec_perm(int vector[4], int vector[4], unsigned char vector[16])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11, i8 0, i8 1, i8 2, i8 3, i8 8, i8 9, i8 10, i8 11>)205// CHECK: call <4 x i32> @vec_sub(int vector[4], int vector[4])206// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <4 x i32> %{{[0-9a-zA-Z_.]+}} to <2 x i64>207// CHECK: extractelement <2 x i64> %[[CAST]], i32 1208 209// CHECK-LABEL: define available_externally <2 x i64> @_mm_hsubs_epi16210// CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>, ptr %{{[0-9a-zA-Z_.]+}}, align 16211// CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16212// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>)213// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>)214// CHECK: call <8 x i16> @vec_subs(short vector[8], short vector[8])215 216// CHECK-LABEL: define available_externally i64 @_mm_hsubs_pi16217// CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>, ptr %{{[0-9a-zA-Z_.]+}}, align 16218// CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>, ptr %{{[0-9a-zA-Z_.]+}}, align 16219// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13>)220// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15>)221// CHECK: call <8 x i16> @vec_subs(short vector[8], short vector[8])222// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>223// CHECK: extractelement <2 x i64> %[[CAST]], i32 1224 225void __attribute__((noinline))226test_shuffle() {227 resi = _mm_shuffle_epi8(mi1, mi2);228 res = _mm_shuffle_pi8(m1, m2);229}230 231// CHECK-LABEL: @test_shuffle232 233// CHECK-LABEL: define available_externally <2 x i64> @_mm_shuffle_epi8234// CHECK: store <16 x i8> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16235// CHECK: call <16 x i8> @vec_cmplt(signed char vector[16], signed char vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer)236// CHECK: call <16 x i8> @vec_perm(signed char vector[16], signed char vector[16], unsigned char vector[16])237// CHECK: call <16 x i8> @vec_sel(signed char vector[16], signed char vector[16], bool vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer, <16 x i8> noundef %{{[0-9a-zA-Z_.]+}})238 239// CHECK-LABEL: define available_externally i64 @_mm_shuffle_pi8240// CHECK: call <16 x i8> @vec_cmplt(signed char vector[16], signed char vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer)241// CHECK: call <16 x i8> @vec_perm(signed char vector[16], signed char vector[16], unsigned char vector[16])242// CHECK: call <16 x i8> @vec_sel(signed char vector[16], signed char vector[16], bool vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer, <16 x i8> noundef %{{[0-9a-zA-Z_.]+}})243// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <16 x i8> %{{[0-9a-zA-Z_.]+}} to <2 x i64>244// CHECK: extractelement <2 x i64> %[[CAST]], i32 0245 246void __attribute__((noinline))247test_sign() {248 resi = _mm_sign_epi8(mi1, mi2);249 resi = _mm_sign_epi16(mi1, mi2);250 resi = _mm_sign_epi32(mi1, mi2);251 res = _mm_sign_pi8(m1, m2);252 res = _mm_sign_pi16(m1, m2);253 res = _mm_sign_pi32(m1, m2);254}255 256// CHECK-LABEL: @test_sign257 258// CHECK-LABEL: define available_externally <2 x i64> @_mm_sign_epi8259// CHECK: call <16 x i8> @vec_cmplt(signed char vector[16], signed char vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer)260// CHECK: call <16 x i8> @vec_cmpgt(signed char vector[16], signed char vector[16])(<16 x i8> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef zeroinitializer)261// CHECK: call <16 x i8> @vec_neg(signed char vector[16])262// CHECK: call <16 x i8> @vec_add(signed char vector[16], signed char vector[16])263// CHECK: call <16 x i8> @vec_mul(signed char vector[16], signed char vector[16])264 265// CHECK-LABEL: define available_externally <2 x i64> @_mm_sign_epi16266// CHECK: call <8 x i16> @vec_cmplt(short vector[8], short vector[8])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef zeroinitializer)267// CHECK: call <8 x i16> @vec_cmpgt(short vector[8], short vector[8])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef zeroinitializer)268// CHECK: call <8 x i16> @vec_neg(short vector[8])269// CHECK: call <8 x i16> @vec_add(short vector[8], short vector[8])270// CHECK: call <8 x i16> @vec_mul(short vector[8], short vector[8])271 272// CHECK-LABEL: define available_externally <2 x i64> @_mm_sign_epi32273// CHECK: store <4 x i32> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16274// CHECK: call <4 x i32> @vec_cmplt(int vector[4], int vector[4])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef zeroinitializer)275// CHECK: call <4 x i32> @vec_cmpgt(int vector[4], int vector[4])(<4 x i32> noundef %{{[0-9a-zA-Z_.]+}}, <4 x i32> noundef zeroinitializer)276// CHECK: call <4 x i32> @vec_neg(int vector[4])277// CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])278// CHECK: call <4 x i32> @vec_mul(int vector[4], int vector[4])279 280// CHECK-LABEL: define available_externally i64 @_mm_sign_pi8281// CHECK: store <16 x i8> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16282// CHECK: call <2 x i64> @_mm_sign_epi8283// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <16 x i8> %{{[0-9a-zA-Z_.]+}} to <2 x i64>284// CHECK: extractelement <2 x i64> %[[CAST]], i32 0285 286// CHECK-LABEL: define available_externally i64 @_mm_sign_pi16287// CHECK: store <8 x i16> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16288// CHECK: call <2 x i64> @_mm_sign_epi16289// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>290// CHECK: extractelement <2 x i64> %[[CAST]], i32 0291 292// CHECK-LABEL: define available_externally i64 @_mm_sign_pi32293// CHECK: store <4 x i32> zeroinitializer, ptr %{{[0-9a-zA-Z_.]+}}, align 16294// CHECK: call <2 x i64> @_mm_sign_epi32295// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <4 x i32> %{{[0-9a-zA-Z_.]+}} to <2 x i64>296// CHECK: extractelement <2 x i64> %[[CAST]], i32 0297 298void __attribute__((noinline))299test_maddubs() {300 resi = _mm_maddubs_epi16(mi1, mi2);301 res = _mm_maddubs_pi16(m1, m2);302}303 304// CHECK-LABEL: @test_maddubs305 306// CHECK-LABEL: define available_externally <2 x i64> @_mm_maddubs_epi16307// CHECK: call <8 x i16> @vec_splats(short)(i16 noundef signext 255)308// CHECK: call <8 x i16> @vec_unpackh(signed char vector[16])309// CHECK: call <8 x i16> @vec_and(short vector[8], short vector[8])310// CHECK: call <8 x i16> @vec_unpackl(signed char vector[16])311// CHECK: call <8 x i16> @vec_and(short vector[8], short vector[8])312// CHECK: call <8 x i16> @vec_unpackh(signed char vector[16])313// CHECK: call <8 x i16> @vec_unpackl(signed char vector[16])314// CHECK: call <8 x i16> @vec_mul(short vector[8], short vector[8])315// CHECK: call <8 x i16> @vec_mul(short vector[8], short vector[8])316// CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>, ptr %{{[0-9a-zA-Z_.]+}}, align 16317// CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16318// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>)319// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>)320// CHECK: call <8 x i16> @vec_adds(short vector[8], short vector[8])321 322// CHECK-LABEL: define available_externally i64 @_mm_maddubs_pi16323// CHECK: call <8 x i16> @vec_unpackl(signed char vector[16])324// CHECK: call <8 x i16> @vec_splats(short)(i16 noundef signext 255)325// CHECK: call <8 x i16> @vec_and(short vector[8], short vector[8])326// CHECK: call <8 x i16> @vec_unpackl(signed char vector[16])327// CHECK: call <8 x i16> @vec_mul(short vector[8], short vector[8])328// CHECK: store <16 x i8> <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>, ptr %{{[0-9a-zA-Z_.]+}}, align 16329// CHECK: store <16 x i8> <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>, ptr %{{[0-9a-zA-Z_.]+}}, align 16330// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 0, i8 1, i8 4, i8 5, i8 8, i8 9, i8 12, i8 13, i8 16, i8 17, i8 20, i8 21, i8 24, i8 25, i8 28, i8 29>)331// CHECK: call <8 x i16> @vec_perm(short vector[8], short vector[8], unsigned char vector[16])(<8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <8 x i16> noundef %{{[0-9a-zA-Z_.]+}}, <16 x i8> noundef <i8 2, i8 3, i8 6, i8 7, i8 10, i8 11, i8 14, i8 15, i8 18, i8 19, i8 22, i8 23, i8 26, i8 27, i8 30, i8 31>)332// CHECK: call <8 x i16> @vec_adds(short vector[8], short vector[8])333// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>334// CHECK: extractelement <2 x i64> %[[CAST]], i32 0335 336void __attribute__((noinline))337test_mulhrs() {338 resi = _mm_mulhrs_epi16(mi1, mi2);339 res = _mm_mulhrs_pi16(m1, m2);340}341 342// CHECK-LABEL: @test_mulhrs343 344// CHECK-LABEL: define available_externally <2 x i64> @_mm_mulhrs_epi16345// CHECK: call <4 x i32> @vec_unpackh(short vector[8])346// CHECK: call <4 x i32> @vec_unpackh(short vector[8])347// CHECK: call <4 x i32> @vec_mul(int vector[4], int vector[4])348// CHECK: call <4 x i32> @vec_unpackl(short vector[8])349// CHECK: call <4 x i32> @vec_unpackl(short vector[8])350// CHECK: call <4 x i32> @vec_mul(int vector[4], int vector[4])351// CHECK: call <4 x i32> @vec_splats(unsigned int)(i32 noundef zeroext 14)352// CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])353// CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])354// CHECK: call <4 x i32> @vec_splats(int)(i32 noundef signext 1)355// CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])356// CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])357// CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])358// CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])359// CHECK: %[[PACK:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_pack(int vector[4], int vector[4])360 361// CHECK-LABEL: define available_externally i64 @_mm_mulhrs_pi16362// CHECK: call <4 x i32> @vec_unpackh(short vector[8])363// CHECK: call <4 x i32> @vec_unpackh(short vector[8])364// CHECK: call <4 x i32> @vec_mul(int vector[4], int vector[4])365// CHECK: call <4 x i32> @vec_splats(unsigned int)(i32 noundef zeroext 14)366// CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])367// CHECK: call <4 x i32> @vec_splats(int)(i32 noundef signext 1)368// CHECK: call <4 x i32> @vec_add(int vector[4], int vector[4])369// CHECK: call <4 x i32> @vec_sr(int vector[4], unsigned int vector[4])370// CHECK: call <8 x i16> @vec_pack(int vector[4], int vector[4])371// CHECK: %[[CAST:[0-9a-zA-Z_.]+]] = bitcast <8 x i16> %{{[0-9a-zA-Z_.]+}} to <2 x i64>372// CHECK: extractelement <2 x i64> %[[CAST]], i32 0373