|
1 |
| -// RUN: %clang_cc1 -ffreestanding -fms-extensions -Wno-implicit-function-declaration -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir |
2 |
| -// RUN: FileCheck %s --check-prefix=CIR --input-file=%t.cir |
3 |
| -// RUN: %clang_cc1 -ffreestanding -fms-extensions -Wno-implicit-function-declaration -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll |
4 |
| -// RUN: FileCheck %s --check-prefix=LLVM --input-file=%t.ll |
5 |
| - |
6 |
| -unsigned short test__lzcnt16(unsigned short x) { |
7 |
| - return __lzcnt16(x); |
8 |
| -} |
9 |
| -// CIR-LABEL: test__lzcnt16 |
10 |
| -// CIR: {{%.*}} = cir.bit.clz({{%.*}} : !u16i) : !u16i |
11 |
| - |
12 |
| -// LLVM-LABEL: test__lzcnt16 |
13 |
| -// LLVM: {{%.*}} = call i16 @llvm.ctlz.i16(i16 {{%.*}}, i1 false) |
14 |
| - |
15 |
| -unsigned int test__lzcnt(unsigned int x) { |
16 |
| - return __lzcnt(x); |
17 |
| -} |
18 |
| -// CIR-LABEL: test__lzcnt |
19 |
| -// CIR: {{%.*}} = cir.bit.clz({{%.*}} : !u32i) : !u32i |
20 |
| - |
21 |
| -// LLVM-LABEL: test__lzcnt |
22 |
| -// LLVM: {{%.*}} = call i32 @llvm.ctlz.i32(i32 {{%.*}}, i1 false) |
23 |
| - |
24 |
| -unsigned __int64 test__lzcnt64(unsigned __int64 x) { |
25 |
| - return __lzcnt64(x); |
26 |
| -} |
27 |
| -// CIR-LABEL: test__lzcnt64 |
28 |
| -// CIR: {{%.*}} = cir.bit.clz({{%.*}} : !u64i) : !u64i |
29 |
| - |
30 |
| -// LLVM-LABEL: test__lzcnt64 |
31 |
| -// LLVM: {{%.*}} = call i64 @llvm.ctlz.i64(i64 {{%.*}}, i1 false) |
| 1 | +// RUN: %clang_cc1 -ffreestanding -fms-extensions -Wno-implicit-function-declaration -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir |
| 2 | +// RUN: FileCheck %s --check-prefix=CIR --input-file=%t.cir |
| 3 | +// RUN: %clang_cc1 -ffreestanding -fms-extensions -Wno-implicit-function-declaration -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll |
| 4 | +// RUN: FileCheck %s --check-prefix=LLVM --input-file=%t.ll |
| 5 | + |
| 6 | +// This test mimics clang/test/CodeGen/ms-intrinsics-other.c, which eventually |
| 7 | +// CIR shall be able to support fully. |
| 8 | + |
| 9 | +unsigned short test__lzcnt16(unsigned short x) { |
| 10 | + return __lzcnt16(x); |
| 11 | +} |
| 12 | +// CIR-LABEL: test__lzcnt16 |
| 13 | +// CIR: {{%.*}} = cir.bit.clz({{%.*}} : !u16i) : !u16i |
| 14 | +// LLVM-LABEL: test__lzcnt16 |
| 15 | +// LLVM: {{%.*}} = call i16 @llvm.ctlz.i16(i16 {{%.*}}, i1 false) |
| 16 | + |
| 17 | +unsigned int test__lzcnt(unsigned int x) { |
| 18 | + return __lzcnt(x); |
| 19 | +} |
| 20 | +// CIR-LABEL: test__lzcnt |
| 21 | +// CIR: {{%.*}} = cir.bit.clz({{%.*}} : !u32i) : !u32i |
| 22 | +// LLVM-LABEL: test__lzcnt |
| 23 | +// LLVM: {{%.*}} = call i32 @llvm.ctlz.i32(i32 {{%.*}}, i1 false) |
| 24 | + |
| 25 | +unsigned __int64 test__lzcnt64(unsigned __int64 x) { |
| 26 | + return __lzcnt64(x); |
| 27 | +} |
| 28 | +// CIR-LABEL: test__lzcnt64 |
| 29 | +// CIR: {{%.*}} = cir.bit.clz({{%.*}} : !u64i) : !u64i |
| 30 | +// LLVM-LABEL: test__lzcnt64 |
| 31 | +// LLVM: {{%.*}} = call i64 @llvm.ctlz.i64(i64 {{%.*}}, i1 false) |
| 32 | + |
| 33 | +unsigned short test__popcnt16(unsigned short x) { |
| 34 | + return __popcnt16(x); |
| 35 | +} |
| 36 | +// CIR-LABEL: test__popcnt16 |
| 37 | +// CIR: {{%.*}} = cir.bit.popcount({{%.*}} : !u16i) : !u16i |
| 38 | +// LLVM-LABEL: test__popcnt16 |
| 39 | +// LLVM: {{%.*}} = call i16 @llvm.ctpop.i16(i16 {{%.*}}) |
| 40 | + |
| 41 | +unsigned int test__popcnt(unsigned int x) { |
| 42 | + return __popcnt(x); |
| 43 | +} |
| 44 | +// CIR-LABEL: test__popcnt |
| 45 | +// CIR: {{%.*}} = cir.bit.popcount({{%.*}} : !u32i) : !u32i |
| 46 | +// LLVM-LABEL: test__popcnt |
| 47 | +// LLVM: {{%.*}} = call i32 @llvm.ctpop.i32(i32 {{%.*}}) |
| 48 | + |
| 49 | +unsigned __int64 test__popcnt64(unsigned __int64 x) { |
| 50 | + return __popcnt64(x); |
| 51 | +} |
| 52 | +// CIR-LABEL: test__popcnt64 |
| 53 | +// CIR: {{%.*}} = cir.bit.popcount({{%.*}} : !u64i) : !u64i |
| 54 | +// LLVM-LABEL: test__popcnt64 |
| 55 | +// LLVM: {{%.*}} = call i64 @llvm.ctpop.i64(i64 {{%.*}}) |
0 commit comments