CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
261 lines
11 KiB
HLSL
261 lines
11 KiB
HLSL
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
|
|
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
|
|
// RUN: -fnative-int16-type -emit-llvm -O1 -o - | FileCheck %s -DTARGET=dx \
|
|
// RUN: --check-prefixes=CHECK,DXCHECK
|
|
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
|
|
// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \
|
|
// RUN: -fnative-int16-type -emit-llvm -O1 -o - | FileCheck %s -DTARGET=spv
|
|
|
|
#ifdef __HLSL_ENABLE_16_BIT
|
|
// CHECK-LABEL: test_firstbithigh_ushort
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}i32 @llvm.[[TARGET]].firstbituhigh.i16
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub i32 15, [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq i32 [[FBH]], -1
|
|
// DXCHECK-NEXT: select i1 %cmp.i.i, i32 -1, i32 [[SUB]]
|
|
// CHECK-NEXT: ret i32
|
|
uint test_firstbithigh_ushort(uint16_t p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_ushort2
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<2 x i32> @llvm.[[TARGET]].firstbituhigh.v2i16
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <2 x i32> splat (i32 15), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <2 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <2 x i1> %cmp.i.i, <2 x i32> splat (i32 -1), <2 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <2 x i32>
|
|
uint2 test_firstbithigh_ushort2(uint16_t2 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_ushort3
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<3 x i32> @llvm.[[TARGET]].firstbituhigh.v3i16
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <3 x i32> splat (i32 15), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <3 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <3 x i1> %cmp.i.i, <3 x i32> splat (i32 -1), <3 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <3 x i32>
|
|
uint3 test_firstbithigh_ushort3(uint16_t3 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_ushort4
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i16
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <4 x i32> splat (i32 15), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <4 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <4 x i1> %cmp.i.i, <4 x i32> splat (i32 -1), <4 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <4 x i32>
|
|
uint4 test_firstbithigh_ushort4(uint16_t4 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_short
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}i32 @llvm.[[TARGET]].firstbitshigh.i16
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub i32 15, [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq i32 [[FBH]], -1
|
|
// DXCHECK-NEXT: select i1 %cmp.i.i, i32 -1, i32 [[SUB]]
|
|
// CHECK-NEXT: ret i32
|
|
uint test_firstbithigh_short(int16_t p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_short2
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<2 x i32> @llvm.[[TARGET]].firstbitshigh.v2i16
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <2 x i32> splat (i32 15), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <2 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <2 x i1> %cmp.i.i, <2 x i32> splat (i32 -1), <2 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <2 x i32>
|
|
uint2 test_firstbithigh_short2(int16_t2 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_short3
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<3 x i32> @llvm.[[TARGET]].firstbitshigh.v3i16
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <3 x i32> splat (i32 15), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <3 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <3 x i1> %cmp.i.i, <3 x i32> splat (i32 -1), <3 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <3 x i32>
|
|
uint3 test_firstbithigh_short3(int16_t3 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_short4
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<4 x i32> @llvm.[[TARGET]].firstbitshigh.v4i16
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <4 x i32> splat (i32 15), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <4 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <4 x i1> %cmp.i.i, <4 x i32> splat (i32 -1), <4 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <4 x i32>
|
|
uint4 test_firstbithigh_short4(int16_t4 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
#endif // __HLSL_ENABLE_16_BIT
|
|
|
|
// CHECK-LABEL: test_firstbithigh_uint
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}i32 @llvm.[[TARGET]].firstbituhigh.i32
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub i32 31, [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq i32 [[FBH]], -1
|
|
// DXCHECK-NEXT: select i1 %cmp.i.i, i32 -1, i32 [[SUB]]
|
|
// CHECK-NEXT: ret i32
|
|
uint test_firstbithigh_uint(uint p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_uint2
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<2 x i32> @llvm.[[TARGET]].firstbituhigh.v2i32
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <2 x i32> splat (i32 31), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <2 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <2 x i1> %cmp.i.i, <2 x i32> splat (i32 -1), <2 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <2 x i32>
|
|
uint2 test_firstbithigh_uint2(uint2 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_uint3
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<3 x i32> @llvm.[[TARGET]].firstbituhigh.v3i32
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <3 x i32> splat (i32 31), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <3 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <3 x i1> %cmp.i.i, <3 x i32> splat (i32 -1), <3 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <3 x i32>
|
|
uint3 test_firstbithigh_uint3(uint3 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_uint4
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i32
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <4 x i32> splat (i32 31), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <4 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <4 x i1> %cmp.i.i, <4 x i32> splat (i32 -1), <4 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <4 x i32>
|
|
uint4 test_firstbithigh_uint4(uint4 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_ulong
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}i32 @llvm.[[TARGET]].firstbituhigh.i64
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub i32 63, [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq i32 [[FBH]], -1
|
|
// DXCHECK-NEXT: select i1 %cmp.i.i, i32 -1, i32 [[SUB]]
|
|
// CHECK-NEXT: ret i32
|
|
uint test_firstbithigh_ulong(uint64_t p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_ulong2
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<2 x i32> @llvm.[[TARGET]].firstbituhigh.v2i64
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <2 x i32> splat (i32 63), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <2 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <2 x i1> %cmp.i.i, <2 x i32> splat (i32 -1), <2 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <2 x i32>
|
|
uint2 test_firstbithigh_ulong2(uint64_t2 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_ulong3
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<3 x i32> @llvm.[[TARGET]].firstbituhigh.v3i64
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <3 x i32> splat (i32 63), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <3 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <3 x i1> %cmp.i.i, <3 x i32> splat (i32 -1), <3 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <3 x i32>
|
|
uint3 test_firstbithigh_ulong3(uint64_t3 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_ulong4
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i64
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <4 x i32> splat (i32 63), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <4 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <4 x i1> %cmp.i.i, <4 x i32> splat (i32 -1), <4 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <4 x i32>
|
|
uint4 test_firstbithigh_ulong4(uint64_t4 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_int
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}i32 @llvm.[[TARGET]].firstbitshigh.i32
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub i32 31, [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq i32 [[FBH]], -1
|
|
// DXCHECK-NEXT: select i1 %cmp.i.i, i32 -1, i32 [[SUB]]
|
|
// CHECK-NEXT: ret i32
|
|
uint test_firstbithigh_int(int p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_int2
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<2 x i32> @llvm.[[TARGET]].firstbitshigh.v2i32
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <2 x i32> splat (i32 31), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <2 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <2 x i1> %cmp.i.i, <2 x i32> splat (i32 -1), <2 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <2 x i32>
|
|
uint2 test_firstbithigh_int2(int2 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_int3
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<3 x i32> @llvm.[[TARGET]].firstbitshigh.v3i32
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <3 x i32> splat (i32 31), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <3 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <3 x i1> %cmp.i.i, <3 x i32> splat (i32 -1), <3 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <3 x i32>
|
|
uint3 test_firstbithigh_int3(int3 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_int4
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<4 x i32> @llvm.[[TARGET]].firstbitshigh.v4i32
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <4 x i32> splat (i32 31), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <4 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <4 x i1> %cmp.i.i, <4 x i32> splat (i32 -1), <4 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <4 x i32>
|
|
uint4 test_firstbithigh_int4(int4 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_long
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}i32 @llvm.[[TARGET]].firstbitshigh.i64
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub i32 63, [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq i32 [[FBH]], -1
|
|
// DXCHECK-NEXT: select i1 %cmp.i.i, i32 -1, i32 [[SUB]]
|
|
// CHECK-NEXT: ret i32
|
|
uint test_firstbithigh_long(int64_t p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_long2
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<2 x i32> @llvm.[[TARGET]].firstbitshigh.v2i64
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <2 x i32> splat (i32 63), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <2 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <2 x i1> %cmp.i.i, <2 x i32> splat (i32 -1), <2 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <2 x i32>
|
|
uint2 test_firstbithigh_long2(int64_t2 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_long3
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<3 x i32> @llvm.[[TARGET]].firstbitshigh.v3i64
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <3 x i32> splat (i32 63), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <3 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <3 x i1> %cmp.i.i, <3 x i32> splat (i32 -1), <3 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <3 x i32>
|
|
uint3 test_firstbithigh_long3(int64_t3 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_long4
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<4 x i32> @llvm.[[TARGET]].firstbitshigh.v4i64
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <4 x i32> splat (i32 63), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <4 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <4 x i1> %cmp.i.i, <4 x i32> splat (i32 -1), <4 x i32> [[SUB]]
|
|
// CHECK-NEXT: ret <4 x i32>
|
|
uint4 test_firstbithigh_long4(int64_t4 p0) {
|
|
return firstbithigh(p0);
|
|
}
|
|
|
|
// CHECK-LABEL: test_firstbithigh_upcast
|
|
// CHECK: [[FBH:%.*]] = tail call {{.*}}<4 x i32> @llvm.[[TARGET]].firstbituhigh.v4i32(<4 x i32> %{{.*}})
|
|
// DXCHECK-NEXT: [[SUB:%.*]] = sub <4 x i32> splat (i32 31), [[FBH]]
|
|
// DXCHECK-NEXT: [[ICMP:%.*]] = icmp eq <4 x i32> [[FBH]], splat (i32 -1)
|
|
// DXCHECK-NEXT: select <4 x i1> %cmp.i.i, <4 x i32> splat (i32 -1), <4 x i32> [[SUB]]
|
|
// CHECK-NEXT: [[ZEXT:%.*]] = zext <4 x i32> {{.*}} to <4 x i64>
|
|
// CHECK-NEXT: ret <4 x i64> [[ZEXT]]
|
|
uint64_t4 test_firstbithigh_upcast(uint4 p0) {
|
|
return firstbithigh(p0);
|
|
}
|