|
| 1 | +// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +sse2 -fclangir -emit-cir -o %t.cir -Wall -Werror |
| 2 | +// RUN: FileCheck --check-prefixes=CIR-CHECK,CIR-X64 --input-file=%t.cir %s |
| 3 | +// RUN: %clang_cc1 -x c -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +sse2 -fno-signed-char -fclangir -emit-cir -o %t.cir -Wall -Werror |
| 4 | +// RUN: FileCheck --check-prefixes=CIR-CHECK,CIR-X64 --input-file=%t.cir %s |
| 5 | + |
| 6 | +// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +sse2 -fclangir -emit-llvm -o %t.ll -Wall -Werror |
| 7 | +// RUN: FileCheck --check-prefixes=LLVM-CHECK,LLVM-X64 --input-file=%t.ll %s |
| 8 | +// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +sse2 -fno-signed-char -fclangir -emit-llvm -o %t.ll -Wall -Werror |
| 9 | +// RUN: FileCheck --check-prefixes=LLVM-CHECK,LLVM-X64 --input-file=%t.ll %s |
| 10 | + |
| 11 | +// This test mimics clang/test/CodeGen/X86/sse2-builtins.c, which eventually |
| 12 | +// CIR shall be able to support fully. |
| 13 | + |
| 14 | +#include <immintrin.h> |
| 15 | + |
| 16 | +__m128d test_mm_undefined_pd(void) { |
| 17 | + // CIR-X64-LABEL: _mm_undefined_pd |
| 18 | + // CIR-X64: %{{.*}} = cir.const #cir.zero : !cir.vector<2 x !cir.double> |
| 19 | + // CIR-X64: cir.return %{{.*}} : !cir.vector<2 x !cir.double> |
| 20 | + |
| 21 | + // LLVM-X64-LABEL: test_mm_undefined_pd |
| 22 | + // LLVM-X64: store <2 x double> zeroinitializer, ptr %[[A:.*]], align 16 |
| 23 | + // LLVM-X64: %{{.*}} = load <2 x double>, ptr %[[A]], align 16 |
| 24 | + // LLVM-X64: ret <2 x double> %{{.*}} |
| 25 | + return _mm_undefined_pd(); |
| 26 | +} |
| 27 | + |
| 28 | +__m128i test_mm_undefined_si128(void) { |
| 29 | + // CIR-LABEL: _mm_undefined_si128 |
| 30 | + // CIR-CHECK: %[[A:.*]] = cir.const #cir.zero : !cir.vector<2 x !cir.double> |
| 31 | + // CIR-CHECK: %{{.*}} = cir.cast bitcast %[[A]] : !cir.vector<2 x !cir.double> -> !cir.vector<2 x !s64i> |
| 32 | + // CIR-CHECK: cir.return %{{.*}} : !cir.vector<2 x !s64i> |
| 33 | + |
| 34 | + // LLVM-CHECK-LABEL: test_mm_undefined_si128 |
| 35 | + // LLVM-CHECK: store <2 x i64> zeroinitializer, ptr %[[A:.*]], align 16 |
| 36 | + // LLVM-CHECK: %{{.*}} = load <2 x i64>, ptr %[[A]], align 16 |
| 37 | + // LLVM-CHECK: ret <2 x i64> %{{.*}} |
| 38 | + return _mm_undefined_si128(); |
| 39 | +} |
0 commit comments