brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.0 KiB · 44389fb Raw
93 lines · c
1// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror | FileCheck %s2// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror | FileCheck %s3// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror | FileCheck %s4// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror | FileCheck %s5 6// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s7// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s8// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s9// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror  -fexperimental-new-constant-interpreter | FileCheck %s10 11 12#include <immintrin.h>13#include "builtin_test_helpers.h"14 15// NOTE: This should match the tests in llvm/test/CodeGen/X86/sse3-intrinsics-fast-isel.ll16 17__m128d test_mm_addsub_pd(__m128d A, __m128d B) {18  // CHECK-LABEL: test_mm_addsub_pd19  // CHECK: call {{.*}}<2 x double> @llvm.x86.sse3.addsub.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}})20  return _mm_addsub_pd(A, B);21}22TEST_CONSTEXPR(match_m128d(_mm_addsub_pd((__m128d){+2.0, +2.0}, (__m128d){+1.0, +2.0}), +1.0, +4.0));23 24__m128 test_mm_addsub_ps(__m128 A, __m128 B) {25  // CHECK-LABEL: test_mm_addsub_ps26  // CHECK: call {{.*}}<4 x float> @llvm.x86.sse3.addsub.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}})27  return _mm_addsub_ps(A, B);28}29TEST_CONSTEXPR(match_m128(_mm_addsub_ps((__m128){+3.0f, +4.0f, +5.0f, +6.0f}, (__m128){+1.0f, +2.0f, +3.0f, +4.0f}), +2.0f, +6.0f, +2.0f, +10.0f));30 31__m128d test_mm_hadd_pd(__m128d A, __m128d B) {32  // CHECK-LABEL: test_mm_hadd_pd33  // CHECK: call {{.*}}<2 x double> @llvm.x86.sse3.hadd.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}})34  return _mm_hadd_pd(A, B);35}36TEST_CONSTEXPR(match_m128d(_mm_hadd_pd((__m128d){+1.0, +2.0}, (__m128d){+3.0, +4.0}), +3.0, +7.0));37 38__m128 test_mm_hadd_ps(__m128 A, __m128 B) {39  // CHECK-LABEL: test_mm_hadd_ps40  // CHECK: call {{.*}}<4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}})41  return _mm_hadd_ps(A, B);42}43TEST_CONSTEXPR(match_m128(_mm_hadd_ps((__m128){+1.0f, +2.0f, +3.0f, +4.0f}, (__m128){+5.0f,+6.0f,+7.0f,+8.0f}), +3.0f, +7.0f, +11.0f, +15.0f));44 45__m128d test_mm_hsub_pd(__m128d A, __m128d B) {46  // CHECK-LABEL: test_mm_hsub_pd47  // CHECK: call {{.*}}<2 x double> @llvm.x86.sse3.hsub.pd(<2 x double> %{{.*}}, <2 x double> %{{.*}})48  return _mm_hsub_pd(A, B);49}50TEST_CONSTEXPR(match_m128d(_mm_hsub_pd((__m128d){+1.0, +2.0}, (__m128d){+4.0, +3.0}), -1.0, +1.0));51 52__m128 test_mm_hsub_ps(__m128 A, __m128 B) {53  // CHECK-LABEL: test_mm_hsub_ps54  // CHECK: call {{.*}}<4 x float> @llvm.x86.sse3.hsub.ps(<4 x float> %{{.*}}, <4 x float> %{{.*}})55  return _mm_hsub_ps(A, B);56}57TEST_CONSTEXPR(match_m128(_mm_hsub_ps((__m128){+1.0f, +2.0f, +4.0f, +3.0f}, (__m128){+5.0f,+7.0f,+10.0f,+8.0f}), -1.0f, +1.0f, -2.0f, +2.0f));58 59__m128i test_mm_lddqu_si128(__m128i const* P) {60  // CHECK-LABEL: test_mm_lddqu_si12861  // CHECK: call <16 x i8> @llvm.x86.sse3.ldu.dq(ptr %{{.*}})62  return _mm_lddqu_si128(P);63}64 65__m128d test_mm_loaddup_pd(double const* P) {66  // CHECK-LABEL: test_mm_loaddup_pd67  // CHECK: load ptr68  // CHECK: insertelement <2 x double> poison, double %{{.*}}, i32 069  // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 170  return _mm_loaddup_pd(P);71}72 73__m128d test_mm_movedup_pd(__m128d A) {74  // CHECK-LABEL: test_mm_movedup_pd75  // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> zeroinitializer76  return _mm_movedup_pd(A);77}78TEST_CONSTEXPR(match_m128d(_mm_movedup_pd((__m128d){+7.0, -7.0}), +7.0, +7.0));79 80__m128 test_mm_movehdup_ps(__m128 A) {81  // CHECK-LABEL: test_mm_movehdup_ps82  // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 1, i32 1, i32 3, i32 3>83  return _mm_movehdup_ps(A);84}85TEST_CONSTEXPR(match_m128(_mm_movehdup_ps((__m128){+1.0f,-1.0f,+2.0f,+4.0f}), -1.0f, -1.0f, +4.0f, +4.0f));86 87__m128 test_mm_moveldup_ps(__m128 A) {88  // CHECK-LABEL: test_mm_moveldup_ps89  // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 0, i32 2, i32 2>90  return _mm_moveldup_ps(A);91}92TEST_CONSTEXPR(match_m128(_mm_moveldup_ps((__m128){+1.0f,-1.0f,+2.0f,+4.0f}), +1.0f, +1.0f, +2.0f, +2.0f));93