1 // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
2 // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
3 // RUN: -emit-llvm -disable-llvm-passes -O3 -o - | FileCheck %s
4 // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
5 // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
6 // RUN: -D__HLSL_ENABLE_16_BIT -o - | FileCheck %s --check-prefix=NO_HALF
10 // CHECK: define noundef i16 @
11 // CHECK: call i16 @llvm.abs.i16(
12 int16_t test_abs_int16_t ( int16_t p0 ) {
15 // CHECK: define noundef <2 x i16> @
16 // CHECK: call <2 x i16> @llvm.abs.v2i16(
17 int16_t2 test_abs_int16_t2 ( int16_t2 p0 ) {
20 // CHECK: define noundef <3 x i16> @
21 // CHECK: call <3 x i16> @llvm.abs.v3i16(
22 int16_t3 test_abs_int16_t3 ( int16_t3 p0 ) {
25 // CHECK: define noundef <4 x i16> @
26 // CHECK: call <4 x i16> @llvm.abs.v4i16(
27 int16_t4 test_abs_int16_t4 ( int16_t4 p0 ) {
30 // CHECK: define noundef half @
31 // CHECK: call half @llvm.fabs.f16(
32 // NO_HALF: define noundef float @"?test_abs_half@@YA$halff@$halff@@Z"(
33 // NO_HALF: call float @llvm.fabs.f32(float %0)
34 half test_abs_half ( half p0 ) {
37 // CHECK: define noundef <2 x half> @
38 // CHECK: call <2 x half> @llvm.fabs.v2f16(
39 // NO_HALF: define noundef <2 x float> @"?test_abs_half2@@YAT?$__vector@$halff@$01@__clang@@T12@@Z"(
40 // NO_HALF: call <2 x float> @llvm.fabs.v2f32(
41 half2 test_abs_half2 ( half2 p0 ) {
44 // CHECK: define noundef <3 x half> @
45 // CHECK: call <3 x half> @llvm.fabs.v3f16(
46 // NO_HALF: define noundef <3 x float> @"?test_abs_half3@@YAT?$__vector@$halff@$02@__clang@@T12@@Z"(
47 // NO_HALF: call <3 x float> @llvm.fabs.v3f32(
48 half3 test_abs_half3 ( half3 p0 ) {
51 // CHECK: define noundef <4 x half> @
52 // CHECK: call <4 x half> @llvm.fabs.v4f16(
53 // NO_HALF: define noundef <4 x float> @"?test_abs_half4@@YAT?$__vector@$halff@$03@__clang@@T12@@Z"(
54 // NO_HALF: call <4 x float> @llvm.fabs.v4f32(
55 half4 test_abs_half4 ( half4 p0 ) {
58 // CHECK: define noundef i32 @
59 // CHECK: call i32 @llvm.abs.i32(
60 // NO_HALF: define noundef i32 @"?test_abs_int@@YAHH@Z"
61 int test_abs_int ( int p0 ) {
64 // CHECK: define noundef <2 x i32> @
65 // CHECK: call <2 x i32> @llvm.abs.v2i32(
66 int2 test_abs_int2 ( int2 p0 ) {
69 // CHECK: define noundef <3 x i32> @
70 // CHECK: call <3 x i32> @llvm.abs.v3i32(
71 int3 test_abs_int3 ( int3 p0 ) {
74 // CHECK: define noundef <4 x i32> @
75 // CHECK: call <4 x i32> @llvm.abs.v4i32(
76 int4 test_abs_int4 ( int4 p0 ) {
79 // CHECK: define noundef float @
80 // CHECK: call float @llvm.fabs.f32(
81 float test_abs_float ( float p0 ) {
84 // CHECK: define noundef <2 x float> @
85 // CHECK: call <2 x float> @llvm.fabs.v2f32(
86 float2 test_abs_float2 ( float2 p0 ) {
89 // CHECK: define noundef <3 x float> @
90 // CHECK: call <3 x float> @llvm.fabs.v3f32(
91 float3 test_abs_float3 ( float3 p0 ) {
94 // CHECK: define noundef <4 x float> @
95 // CHECK: call <4 x float> @llvm.fabs.v4f32(
96 float4 test_abs_float4 ( float4 p0 ) {
99 // CHECK: define noundef i64 @
100 // CHECK: call i64 @llvm.abs.i64(
101 int64_t test_abs_int64_t ( int64_t p0 ) {
104 // CHECK: define noundef <2 x i64> @
105 // CHECK: call <2 x i64> @llvm.abs.v2i64(
106 int64_t2 test_abs_int64_t2 ( int64_t2 p0 ) {
109 // CHECK: define noundef <3 x i64> @
110 // CHECK: call <3 x i64> @llvm.abs.v3i64(
111 int64_t3 test_abs_int64_t3 ( int64_t3 p0 ) {
114 // CHECK: define noundef <4 x i64> @
115 // CHECK: call <4 x i64> @llvm.abs.v4i64(
116 int64_t4 test_abs_int64_t4 ( int64_t4 p0 ) {
119 // CHECK: define noundef double @
120 // CHECK: call double @llvm.fabs.f64(
121 double test_abs_double ( double p0 ) {
124 // CHECK: define noundef <2 x double> @
125 // CHECK: call <2 x double> @llvm.fabs.v2f64(
126 double2 test_abs_double2 ( double2 p0 ) {
129 // CHECK: define noundef <3 x double> @
130 // CHECK: call <3 x double> @llvm.fabs.v3f64(
131 double3 test_abs_double3 ( double3 p0 ) {
134 // CHECK: define noundef <4 x double> @
135 // CHECK: call <4 x double> @llvm.fabs.v4f64(
136 double4 test_abs_double4 ( double4 p0 ) {