162 lines · plain
1// RUN: %clang_cc1 -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 -o - | FileCheck %s -DTARGET=dx4// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \5// RUN: spirv-unknown-vulkan-compute %s -fnative-half-type -fnative-int16-type \6// RUN: -emit-llvm -disable-llvm-passes \7// RUN: -o - | FileCheck %s -DTARGET=spv8 9#ifdef __HLSL_ENABLE_16_BIT10// CHECK-LABEL: test_firstbitlow_ushort11// CHECK: call i32 @llvm.[[TARGET]].firstbitlow.i1612uint test_firstbitlow_ushort(uint16_t p0) {13 return firstbitlow(p0);14}15 16// CHECK-LABEL: test_firstbitlow_ushort217// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbitlow.v2i1618uint2 test_firstbitlow_ushort2(uint16_t2 p0) {19 return firstbitlow(p0);20}21 22// CHECK-LABEL: test_firstbitlow_ushort323// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbitlow.v3i1624uint3 test_firstbitlow_ushort3(uint16_t3 p0) {25 return firstbitlow(p0);26}27 28// CHECK-LABEL: test_firstbitlow_ushort429// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbitlow.v4i1630uint4 test_firstbitlow_ushort4(uint16_t4 p0) {31 return firstbitlow(p0);32}33 34// CHECK-LABEL: test_firstbitlow_short35// CHECK: call i32 @llvm.[[TARGET]].firstbitlow.i1636uint test_firstbitlow_short(int16_t p0) {37 return firstbitlow(p0);38}39 40// CHECK-LABEL: test_firstbitlow_short241// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbitlow.v2i1642uint2 test_firstbitlow_short2(int16_t2 p0) {43 return firstbitlow(p0);44}45 46// CHECK-LABEL: test_firstbitlow_short347// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbitlow.v3i1648uint3 test_firstbitlow_short3(int16_t3 p0) {49 return firstbitlow(p0);50}51 52// CHECK-LABEL: test_firstbitlow_short453// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbitlow.v4i1654uint4 test_firstbitlow_short4(int16_t4 p0) {55 return firstbitlow(p0);56}57#endif // __HLSL_ENABLE_16_BIT58 59// CHECK-LABEL: test_firstbitlow_uint60// CHECK: call i32 @llvm.[[TARGET]].firstbitlow.i3261uint test_firstbitlow_uint(uint p0) {62 return firstbitlow(p0);63}64 65// CHECK-LABEL: test_firstbitlow_uint266// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbitlow.v2i3267uint2 test_firstbitlow_uint2(uint2 p0) {68 return firstbitlow(p0);69}70 71// CHECK-LABEL: test_firstbitlow_uint372// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbitlow.v3i3273uint3 test_firstbitlow_uint3(uint3 p0) {74 return firstbitlow(p0);75}76 77// CHECK-LABEL: test_firstbitlow_uint478// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbitlow.v4i3279uint4 test_firstbitlow_uint4(uint4 p0) {80 return firstbitlow(p0);81}82 83// CHECK-LABEL: test_firstbitlow_ulong84// CHECK: call i32 @llvm.[[TARGET]].firstbitlow.i6485uint test_firstbitlow_ulong(uint64_t p0) {86 return firstbitlow(p0);87}88 89// CHECK-LABEL: test_firstbitlow_ulong290// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbitlow.v2i6491uint2 test_firstbitlow_ulong2(uint64_t2 p0) {92 return firstbitlow(p0);93}94 95// CHECK-LABEL: test_firstbitlow_ulong396// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbitlow.v3i6497uint3 test_firstbitlow_ulong3(uint64_t3 p0) {98 return firstbitlow(p0);99}100 101// CHECK-LABEL: test_firstbitlow_ulong4102// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbitlow.v4i64103uint4 test_firstbitlow_ulong4(uint64_t4 p0) {104 return firstbitlow(p0);105}106 107// CHECK-LABEL: test_firstbitlow_int108// CHECK: call i32 @llvm.[[TARGET]].firstbitlow.i32109uint test_firstbitlow_int(int p0) {110 return firstbitlow(p0);111}112 113// CHECK-LABEL: test_firstbitlow_int2114// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbitlow.v2i32115uint2 test_firstbitlow_int2(int2 p0) {116 return firstbitlow(p0);117}118 119// CHECK-LABEL: test_firstbitlow_int3120// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbitlow.v3i32121uint3 test_firstbitlow_int3(int3 p0) {122 return firstbitlow(p0);123}124 125// CHECK-LABEL: test_firstbitlow_int4126// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbitlow.v4i32127uint4 test_firstbitlow_int4(int4 p0) {128 return firstbitlow(p0);129}130 131// CHECK-LABEL: test_firstbitlow_long132// CHECK: call i32 @llvm.[[TARGET]].firstbitlow.i64133uint test_firstbitlow_long(int64_t p0) {134 return firstbitlow(p0);135}136 137// CHECK-LABEL: test_firstbitlow_long2138// CHECK: call <2 x i32> @llvm.[[TARGET]].firstbitlow.v2i64139uint2 test_firstbitlow_long2(int64_t2 p0) {140 return firstbitlow(p0);141}142 143// CHECK-LABEL: test_firstbitlow_long3144// CHECK: call <3 x i32> @llvm.[[TARGET]].firstbitlow.v3i64145uint3 test_firstbitlow_long3(int64_t3 p0) {146 return firstbitlow(p0);147}148 149// CHECK-LABEL: test_firstbitlow_long4150// CHECK: call <4 x i32> @llvm.[[TARGET]].firstbitlow.v4i64151uint4 test_firstbitlow_long4(int64_t4 p0) {152 return firstbitlow(p0);153}154 155// CHECK-LABEL: test_firstbitlow_upcast156// CHECK: [[FBL:%.*]] = call <4 x i32> @llvm.[[TARGET]].firstbitlow.v4i32(<4 x i32> %{{.*}})157// CHECK: [[CONV:%.*]] = zext <4 x i32> [[FBL]] to <4 x i64>158// CHECK: ret <4 x i64> [[CONV]]159uint64_t4 test_firstbitlow_upcast(uint4 p0) {160 return firstbitlow(p0);161}162