| 1 |
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ |
| 2 |
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type -fnative-int16-type \ |
| 3 |
// RUN: -emit-llvm -disable-llvm-passes -O3 -o - | FileCheck %s |
| 4 |
|
| 5 |
#ifdef __HLSL_ENABLE_16_BIT |
| 6 |
// CHECK-LABEL: test_countbits_ushort |
| 7 |
// CHECK: [[A:%.*]] = call i16 @llvm.ctpop.i16 |
| 8 |
// CHECK-NEXT: zext i16 [[A]] to i32 |
| 9 |
uint test_countbits_ushort(uint16_t p0) |
| 10 |
{ |
| 11 |
return countbits(p0); |
| 12 |
} |
| 13 |
// CHECK-LABEL: test_countbits_short |
| 14 |
// CHECK: [[A:%.*]] = call i16 @llvm.ctpop.i16 |
| 15 |
// CHECK-NEXT: sext i16 [[A]] to i32 |
| 16 |
uint test_countbits_short(int16_t p0) |
| 17 |
{ |
| 18 |
return countbits(p0); |
| 19 |
} |
| 20 |
// CHECK-LABEL: test_countbits_ushort2 |
| 21 |
// CHECK: [[A:%.*]] = call <2 x i16> @llvm.ctpop.v2i16 |
| 22 |
// CHECK-NEXT: zext <2 x i16> [[A]] to <2 x i32> |
| 23 |
uint2 test_countbits_ushort2(uint16_t2 p0) |
| 24 |
{ |
| 25 |
return countbits(p0); |
| 26 |
} |
| 27 |
// CHECK-LABEL: test_countbits_ushort3 |
| 28 |
// CHECK: [[A:%.*]] = call <3 x i16> @llvm.ctpop.v3i16 |
| 29 |
// CHECK-NEXT: zext <3 x i16> [[A]] to <3 x i32> |
| 30 |
uint3 test_countbits_ushort3(uint16_t3 p0) |
| 31 |
{ |
| 32 |
return countbits(p0); |
| 33 |
} |
| 34 |
// CHECK-LABEL: test_countbits_ushort4 |
| 35 |
// CHECK: [[A:%.*]] = call <4 x i16> @llvm.ctpop.v4i16 |
| 36 |
// CHECK-NEXT: zext <4 x i16> [[A]] to <4 x i32> |
| 37 |
uint4 test_countbits_ushort4(uint16_t4 p0) |
| 38 |
{ |
| 39 |
return countbits(p0); |
| 40 |
} |
| 41 |
#endif |
| 42 |
|
| 43 |
// CHECK-LABEL: test_countbits_uint |
| 44 |
// CHECK: call i32 @llvm.ctpop.i32 |
| 45 |
uint test_countbits_uint(uint p0) |
| 46 |
{ |
| 47 |
return countbits(p0); |
| 48 |
} |
| 49 |
// CHECK-LABEL: test_countbits_int |
| 50 |
// CHECK: call i32 @llvm.ctpop.i32 |
| 51 |
uint test_countbits_int(int p0) |
| 52 |
{ |
| 53 |
return countbits(p0); |
| 54 |
} |
| 55 |
// CHECK-LABEL: test_countbits_uint2 |
| 56 |
// CHECK: call <2 x i32> @llvm.ctpop.v2i32 |
| 57 |
uint2 test_countbits_uint2(uint2 p0) |
| 58 |
{ |
| 59 |
return countbits(p0); |
| 60 |
} |
| 61 |
// CHECK-LABEL: test_countbits_uint3 |
| 62 |
// CHECK: call <3 x i32> @llvm.ctpop.v3i32 |
| 63 |
uint3 test_countbits_uint3(uint3 p0) |
| 64 |
{ |
| 65 |
return countbits(p0); |
| 66 |
} |
| 67 |
// CHECK-LABEL: test_countbits_uint4 |
| 68 |
// CHECK: call <4 x i32> @llvm.ctpop.v4i32 |
| 69 |
uint4 test_countbits_uint4(uint4 p0) |
| 70 |
{ |
| 71 |
return countbits(p0); |
| 72 |
} |
| 73 |
|
| 74 |
// CHECK-LABEL: test_countbits_long |
| 75 |
// CHECK: [[A:%.*]] = call i64 @llvm.ctpop.i64 |
| 76 |
// CHECK-NEXT: trunc i64 [[A]] to i32 |
| 77 |
uint test_countbits_long(uint64_t p0) |
| 78 |
{ |
| 79 |
return countbits(p0); |
| 80 |
} |
| 81 |
// CHECK-LABEL: test_countbits_slong |
| 82 |
// CHECK: [[A:%.*]] = call i64 @llvm.ctpop.i64 |
| 83 |
// CHECK-NEXT: trunc i64 [[A]] to i32 |
| 84 |
uint test_countbits_slong(int64_t p0) |
| 85 |
{ |
| 86 |
return countbits(p0); |
| 87 |
} |
| 88 |
// CHECK-LABEL: test_countbits_long2 |
| 89 |
// CHECK: [[A:%.*]] = call <2 x i64> @llvm.ctpop.v2i64 |
| 90 |
// CHECK-NEXT: trunc <2 x i64> [[A]] to <2 x i32> |
| 91 |
uint2 test_countbits_long2(uint64_t2 p0) |
| 92 |
{ |
| 93 |
return countbits(p0); |
| 94 |
} |
| 95 |
// CHECK-LABEL: test_countbits_long3 |
| 96 |
// CHECK: [[A:%.*]] = call <3 x i64> @llvm.ctpop.v3i64 |
| 97 |
// CHECK-NEXT: trunc <3 x i64> [[A]] to <3 x i32> |
| 98 |
uint3 test_countbits_long3(uint64_t3 p0) |
| 99 |
{ |
| 100 |
return countbits(p0); |
| 101 |
} |
| 102 |
// CHECK-LABEL: test_countbits_long4 |
| 103 |
// CHECK: [[A:%.*]] = call <4 x i64> @llvm.ctpop.v4i64 |
| 104 |
// CHECK-NEXT: trunc <4 x i64> [[A]] to <4 x i32> |
| 105 |
uint4 test_countbits_long4(uint64_t4 p0) |
| 106 |
{ |
| 107 |
return countbits(p0); |
| 108 |
} |