brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 1e202ca Raw
50 lines · c
1// RUN: %clang_cc1 -x c -ffreestanding -triple x86_64-unknown-linux -Wno-implicit-function-declaration -fclangir -emit-cir -o %t.cir %s2// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s3// RUN: %clang_cc1 -x c++ -ffreestanding -triple x86_64-unknown-linux -Wno-implicit-function-declaration -fclangir -emit-cir -o %t.cir %s4// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s5 6// RUN: %clang_cc1 -x c -ffreestanding -triple x86_64-unknown-linux -Wno-implicit-function-declaration -fclangir -emit-llvm -o %t.ll %s7// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s8// RUN: %clang_cc1 -x c++ -ffreestanding -triple x86_64-unknown-linux -Wno-implicit-function-declaration -fclangir -emit-llvm -o %t.ll %s9// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s10 11// RUN: %clang_cc1 -x c -ffreestanding -triple=x86_64-unknown-linux -emit-llvm -Wall -Werror %s -o - | FileCheck %s -check-prefix=OGCG12// RUN: %clang_cc1 -x c++ -ffreestanding -triple=x86_64-unknown-linux -emit-llvm -Wall -Werror %s -o - | FileCheck %s -check-prefix=OGCG13 14// This test mimics clang/test/CodeGen/X86/bmi-builtins.c, which eventually15// CIR shall be able to support fully.16 17#include <immintrin.h>18 19unsigned short test__tzcnt_u16(unsigned short __X) {20  // CIR-LABEL: __tzcnt_u1621  // CIR: {{%.*}} = cir.call_llvm_intrinsic "cttz" {{%.*}} : (!u16i, !cir.bool) -> !u16i22  // LLVM-LABEL: __tzcnt_u1623  // LLVM: i16 @llvm.cttz.i16(i16 %{{.*}}, i1 false)24  // OGCG-LABEL: __tzcnt_u1625  // OGCG: i16 @llvm.cttz.i16(i16 %{{.*}}, i1 false)26  return __tzcnt_u16(__X);27}28 29unsigned int test__tzcnt_u32(unsigned int __X) {30  // CIR-LABEL: __tzcnt_u3231  // CIR: {{%.*}} = cir.call_llvm_intrinsic "cttz" {{%.*}} : (!u32i, !cir.bool) -> !u32i32  // LLVM-LABEL: __tzcnt_u3233  // LLVM: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 false)34  // OGCG-LABEL: __tzcnt_u3235  // OGCG: i32 @llvm.cttz.i32(i32 %{{.*}}, i1 false)36  return __tzcnt_u32(__X);37}38 39#ifdef __x86_64__40unsigned long long test__tzcnt_u64(unsigned long long __X) {41  // CIR-LABEL: __tzcnt_u6442  // CIR: {{%.*}} = cir.call_llvm_intrinsic "cttz" {{%.*}} : (!u64i, !cir.bool) -> !u64i43  // LLVM-LABEL: __tzcnt_u6444  // LLVM: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false)45  // OGCG-LABEL: __tzcnt_u6446  // OGCG: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false)47  return __tzcnt_u64(__X);48}49#endif50