| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| #ifdef __HLSL_ENABLE_16_BIT | ||
| // NATIVE_HALF: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.i16 | ||
| // NATIVE_HALF: ret i1 %dx.any | ||
| bool test_any_int16_t(int16_t p0) { return any(p0); } | ||
| // NATIVE_HALF: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.v2i16 | ||
| // NATIVE_HALF: ret i1 %dx.any | ||
| bool test_any_int16_t2(int16_t2 p0) { return any(p0); } | ||
| // NATIVE_HALF: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.v3i16 | ||
| // NATIVE_HALF: ret i1 %dx.any | ||
| bool test_any_int16_t3(int16_t3 p0) { return any(p0); } | ||
| // NATIVE_HALF: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.v4i16 | ||
| // NATIVE_HALF: ret i1 %dx.any | ||
| bool test_any_int16_t4(int16_t4 p0) { return any(p0); } | ||
|
|
||
| // NATIVE_HALF: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.i16 | ||
| // NATIVE_HALF: ret i1 %dx.any | ||
| bool test_any_uint16_t(uint16_t p0) { return any(p0); } | ||
| // NATIVE_HALF: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.v2i16 | ||
| // NATIVE_HALF: ret i1 %dx.any | ||
| bool test_any_uint16_t2(uint16_t2 p0) { return any(p0); } | ||
| // NATIVE_HALF: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.v3i16 | ||
| // NATIVE_HALF: ret i1 %dx.any | ||
| bool test_any_uint16_t3(uint16_t3 p0) { return any(p0); } | ||
| // NATIVE_HALF: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.v4i16 | ||
| // NATIVE_HALF: ret i1 %dx.any | ||
| bool test_any_uint16_t4(uint16_t4 p0) { return any(p0); } | ||
| #endif // __HLSL_ENABLE_16_BIT | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.f16 | ||
| // NO_HALF: %dx.any = call i1 @llvm.dx.any.f32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_half(half p0) { return any(p0); } | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.v2f16 | ||
| // NO_HALF: %dx.any = call i1 @llvm.dx.any.v2f32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_half2(half2 p0) { return any(p0); } | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.v3f16 | ||
| // NO_HALF: %dx.any = call i1 @llvm.dx.any.v3f32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_half3(half3 p0) { return any(p0); } | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // NATIVE_HALF: %dx.any = call i1 @llvm.dx.any.v4f16 | ||
| // NO_HALF: %dx.any = call i1 @llvm.dx.any.v4f32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_half4(half4 p0) { return any(p0); } | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.f32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_float(float p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v2f32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_float2(float2 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v3f32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_float3(float3 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v4f32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_float4(float4 p0) { return any(p0); } | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.f64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_double(double p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v2f64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_double2(double2 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v3f64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_double3(double3 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v4f64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_double4(double4 p0) { return any(p0); } | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.i32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_int(int p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v2i32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_int2(int2 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v3i32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_int3(int3 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v4i32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_int4(int4 p0) { return any(p0); } | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.i32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_uint(uint p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v2i32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_uint2(uint2 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v3i32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_uint3(uint3 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v4i32 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_uint4(uint4 p0) { return any(p0); } | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.i64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_int64_t(int64_t p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v2i64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_int64_t2(int64_t2 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v3i64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_int64_t3(int64_t3 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v4i64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_int64_t4(int64_t4 p0) { return any(p0); } | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.i64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_uint64_t(uint64_t p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v2i64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_uint64_t2(uint64_t2 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v3i64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_uint64_t3(uint64_t3 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v4i64 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_uint64_t4(uint64_t4 p0) { return any(p0); } | ||
|
|
||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.i1 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_bool(bool p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v2i1 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_bool2(bool2 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v3i1 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_bool3(bool3 p0) { return any(p0); } | ||
| // CHECK: define noundef i1 @ | ||
| // CHECK: %dx.any = call i1 @llvm.dx.any.v4i1 | ||
| // CHECK: ret i1 %dx.any | ||
| bool test_any_bool4(bool4 p0) { return any(p0); } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: %elt.exp = call half @llvm.exp.f16( | ||
| // NATIVE_HALF: ret half %elt.exp | ||
| // NO_HALF: define noundef float @"?test_exp_half@@YA$halff@$halff@@Z"( | ||
| // NO_HALF: %elt.exp = call float @llvm.exp.f32( | ||
| // NO_HALF: ret float %elt.exp | ||
| half test_exp_half(half p0) { return exp(p0); } | ||
| // NATIVE_HALF: define noundef <2 x half> @ | ||
| // NATIVE_HALF: %elt.exp = call <2 x half> @llvm.exp.v2f16 | ||
| // NATIVE_HALF: ret <2 x half> %elt.exp | ||
| // NO_HALF: define noundef <2 x float> @ | ||
| // NO_HALF: %elt.exp = call <2 x float> @llvm.exp.v2f32( | ||
| // NO_HALF: ret <2 x float> %elt.exp | ||
| half2 test_exp_half2(half2 p0) { return exp(p0); } | ||
| // NATIVE_HALF: define noundef <3 x half> @ | ||
| // NATIVE_HALF: %elt.exp = call <3 x half> @llvm.exp.v3f16 | ||
| // NATIVE_HALF: ret <3 x half> %elt.exp | ||
| // NO_HALF: define noundef <3 x float> @ | ||
| // NO_HALF: %elt.exp = call <3 x float> @llvm.exp.v3f32( | ||
| // NO_HALF: ret <3 x float> %elt.exp | ||
| half3 test_exp_half3(half3 p0) { return exp(p0); } | ||
| // NATIVE_HALF: define noundef <4 x half> @ | ||
| // NATIVE_HALF: %elt.exp = call <4 x half> @llvm.exp.v4f16 | ||
| // NATIVE_HALF: ret <4 x half> %elt.exp | ||
| // NO_HALF: define noundef <4 x float> @ | ||
| // NO_HALF: %elt.exp = call <4 x float> @llvm.exp.v4f32( | ||
| // NO_HALF: ret <4 x float> %elt.exp | ||
| half4 test_exp_half4(half4 p0) { return exp(p0); } | ||
|
|
||
| // CHECK: define noundef float @ | ||
| // CHECK: %elt.exp = call float @llvm.exp.f32( | ||
| // CHECK: ret float %elt.exp | ||
| float test_exp_float(float p0) { return exp(p0); } | ||
| // CHECK: define noundef <2 x float> @ | ||
| // CHECK: %elt.exp = call <2 x float> @llvm.exp.v2f32 | ||
| // CHECK: ret <2 x float> %elt.exp | ||
| float2 test_exp_float2(float2 p0) { return exp(p0); } | ||
| // CHECK: define noundef <3 x float> @ | ||
| // CHECK: %elt.exp = call <3 x float> @llvm.exp.v3f32 | ||
| // CHECK: ret <3 x float> %elt.exp | ||
| float3 test_exp_float3(float3 p0) { return exp(p0); } | ||
| // CHECK: define noundef <4 x float> @ | ||
| // CHECK: %elt.exp = call <4 x float> @llvm.exp.v4f32 | ||
| // CHECK: ret <4 x float> %elt.exp | ||
| float4 test_exp_float4(float4 p0) { return exp(p0); } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: %elt.exp2 = call half @llvm.exp2.f16( | ||
| // NATIVE_HALF: ret half %elt.exp2 | ||
| // NO_HALF: define noundef float @"?test_exp2_half@@YA$halff@$halff@@Z"( | ||
| // NO_HALF: %elt.exp2 = call float @llvm.exp2.f32( | ||
| // NO_HALF: ret float %elt.exp2 | ||
| half test_exp2_half(half p0) { return exp2(p0); } | ||
| // NATIVE_HALF: define noundef <2 x half> @ | ||
| // NATIVE_HALF: %elt.exp2 = call <2 x half> @llvm.exp2.v2f16 | ||
| // NATIVE_HALF: ret <2 x half> %elt.exp2 | ||
| // NO_HALF: define noundef <2 x float> @ | ||
| // NO_HALF: %elt.exp2 = call <2 x float> @llvm.exp2.v2f32( | ||
| // NO_HALF: ret <2 x float> %elt.exp2 | ||
| half2 test_exp2_half2(half2 p0) { return exp2(p0); } | ||
| // NATIVE_HALF: define noundef <3 x half> @ | ||
| // NATIVE_HALF: %elt.exp2 = call <3 x half> @llvm.exp2.v3f16 | ||
| // NATIVE_HALF: ret <3 x half> %elt.exp2 | ||
| // NO_HALF: define noundef <3 x float> @ | ||
| // NO_HALF: %elt.exp2 = call <3 x float> @llvm.exp2.v3f32( | ||
| // NO_HALF: ret <3 x float> %elt.exp2 | ||
| half3 test_exp2_half3(half3 p0) { return exp2(p0); } | ||
| // NATIVE_HALF: define noundef <4 x half> @ | ||
| // NATIVE_HALF: %elt.exp2 = call <4 x half> @llvm.exp2.v4f16 | ||
| // NATIVE_HALF: ret <4 x half> %elt.exp2 | ||
| // NO_HALF: define noundef <4 x float> @ | ||
| // NO_HALF: %elt.exp2 = call <4 x float> @llvm.exp2.v4f32( | ||
| // NO_HALF: ret <4 x float> %elt.exp2 | ||
| half4 test_exp2_half4(half4 p0) { return exp2(p0); } | ||
|
|
||
| // CHECK: define noundef float @ | ||
| // CHECK: %elt.exp2 = call float @llvm.exp2.f32( | ||
| // CHECK: ret float %elt.exp2 | ||
| float test_exp2_float(float p0) { return exp2(p0); } | ||
| // CHECK: define noundef <2 x float> @ | ||
| // CHECK: %elt.exp2 = call <2 x float> @llvm.exp2.v2f32 | ||
| // CHECK: ret <2 x float> %elt.exp2 | ||
| float2 test_exp2_float2(float2 p0) { return exp2(p0); } | ||
| // CHECK: define noundef <3 x float> @ | ||
| // CHECK: %elt.exp2 = call <3 x float> @llvm.exp2.v3f32 | ||
| // CHECK: ret <3 x float> %elt.exp2 | ||
| float3 test_exp2_float3(float3 p0) { return exp2(p0); } | ||
| // CHECK: define noundef <4 x float> @ | ||
| // CHECK: %elt.exp2 = call <4 x float> @llvm.exp2.v4f32 | ||
| // CHECK: ret <4 x float> %elt.exp2 | ||
| float4 test_exp2_float4(float4 p0) { return exp2(p0); } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,191 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| #ifdef __HLSL_ENABLE_16_BIT | ||
| // NATIVE_HALF: %dx.umad = call i16 @llvm.dx.umad.i16(i16 %0, i16 %1, i16 %2) | ||
| // NATIVE_HALF: ret i16 %dx.umad | ||
| uint16_t test_mad_uint16_t(uint16_t p0, uint16_t p1, uint16_t p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // NATIVE_HALF: %dx.umad = call <2 x i16> @llvm.dx.umad.v2i16(<2 x i16> %0, <2 x i16> %1, <2 x i16> %2) | ||
| // NATIVE_HALF: ret <2 x i16> %dx.umad | ||
| uint16_t2 test_mad_uint16_t2(uint16_t2 p0, uint16_t2 p1, uint16_t2 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // NATIVE_HALF: %dx.umad = call <3 x i16> @llvm.dx.umad.v3i16(<3 x i16> %0, <3 x i16> %1, <3 x i16> %2) | ||
| // NATIVE_HALF: ret <3 x i16> %dx.umad | ||
| uint16_t3 test_mad_uint16_t3(uint16_t3 p0, uint16_t3 p1, uint16_t3 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // NATIVE_HALF: %dx.umad = call <4 x i16> @llvm.dx.umad.v4i16(<4 x i16> %0, <4 x i16> %1, <4 x i16> %2) | ||
| // NATIVE_HALF: ret <4 x i16> %dx.umad | ||
| uint16_t4 test_mad_uint16_t4(uint16_t4 p0, uint16_t4 p1, uint16_t4 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // NATIVE_HALF: %dx.imad = call i16 @llvm.dx.imad.i16(i16 %0, i16 %1, i16 %2) | ||
| // NATIVE_HALF: ret i16 %dx.imad | ||
| int16_t test_mad_int16_t(int16_t p0, int16_t p1, int16_t p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // NATIVE_HALF: %dx.imad = call <2 x i16> @llvm.dx.imad.v2i16(<2 x i16> %0, <2 x i16> %1, <2 x i16> %2) | ||
| // NATIVE_HALF: ret <2 x i16> %dx.imad | ||
| int16_t2 test_mad_int16_t2(int16_t2 p0, int16_t2 p1, int16_t2 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // NATIVE_HALF: %dx.imad = call <3 x i16> @llvm.dx.imad.v3i16(<3 x i16> %0, <3 x i16> %1, <3 x i16> %2) | ||
| // NATIVE_HALF: ret <3 x i16> %dx.imad | ||
| int16_t3 test_mad_int16_t3(int16_t3 p0, int16_t3 p1, int16_t3 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // NATIVE_HALF: %dx.imad = call <4 x i16> @llvm.dx.imad.v4i16(<4 x i16> %0, <4 x i16> %1, <4 x i16> %2) | ||
| // NATIVE_HALF: ret <4 x i16> %dx.imad | ||
| int16_t4 test_mad_int16_t4(int16_t4 p0, int16_t4 p1, int16_t4 p2) { return mad(p0, p1, p2); } | ||
| #endif // __HLSL_ENABLE_16_BIT | ||
|
|
||
| // NATIVE_HALF: %dx.fmad = call half @llvm.fmuladd.f16(half %0, half %1, half %2) | ||
| // NATIVE_HALF: ret half %dx.fmad | ||
| // NO_HALF: %dx.fmad = call float @llvm.fmuladd.f32(float %0, float %1, float %2) | ||
| // NO_HALF: ret float %dx.fmad | ||
| half test_mad_half(half p0, half p1, half p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // NATIVE_HALF: %dx.fmad = call <2 x half> @llvm.fmuladd.v2f16(<2 x half> %0, <2 x half> %1, <2 x half> %2) | ||
| // NATIVE_HALF: ret <2 x half> %dx.fmad | ||
| // NO_HALF: %dx.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2) | ||
| // NO_HALF: ret <2 x float> %dx.fmad | ||
| half2 test_mad_half2(half2 p0, half2 p1, half2 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // NATIVE_HALF: %dx.fmad = call <3 x half> @llvm.fmuladd.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2) | ||
| // NATIVE_HALF: ret <3 x half> %dx.fmad | ||
| // NO_HALF: %dx.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2) | ||
| // NO_HALF: ret <3 x float> %dx.fmad | ||
| half3 test_mad_half3(half3 p0, half3 p1, half3 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // NATIVE_HALF: %dx.fmad = call <4 x half> @llvm.fmuladd.v4f16(<4 x half> %0, <4 x half> %1, <4 x half> %2) | ||
| // NATIVE_HALF: ret <4 x half> %dx.fmad | ||
| // NO_HALF: %dx.fmad = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2) | ||
| // NO_HALF: ret <4 x float> %dx.fmad | ||
| half4 test_mad_half4(half4 p0, half4 p1, half4 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call float @llvm.fmuladd.f32(float %0, float %1, float %2) | ||
| // CHECK: ret float %dx.fmad | ||
| float test_mad_float(float p0, float p1, float p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2) | ||
| // CHECK: ret <2 x float> %dx.fmad | ||
| float2 test_mad_float2(float2 p0, float2 p1, float2 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2) | ||
| // CHECK: ret <3 x float> %dx.fmad | ||
| float3 test_mad_float3(float3 p0, float3 p1, float3 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2) | ||
| // CHECK: ret <4 x float> %dx.fmad | ||
| float4 test_mad_float4(float4 p0, float4 p1, float4 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call double @llvm.fmuladd.f64(double %0, double %1, double %2) | ||
| // CHECK: ret double %dx.fmad | ||
| double test_mad_double(double p0, double p1, double p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %0, <2 x double> %1, <2 x double> %2) | ||
| // CHECK: ret <2 x double> %dx.fmad | ||
| double2 test_mad_double2(double2 p0, double2 p1, double2 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call <3 x double> @llvm.fmuladd.v3f64(<3 x double> %0, <3 x double> %1, <3 x double> %2) | ||
| // CHECK: ret <3 x double> %dx.fmad | ||
| double3 test_mad_double3(double3 p0, double3 p1, double3 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call <4 x double> @llvm.fmuladd.v4f64(<4 x double> %0, <4 x double> %1, <4 x double> %2) | ||
| // CHECK: ret <4 x double> %dx.fmad | ||
| double4 test_mad_double4(double4 p0, double4 p1, double4 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.imad = call i32 @llvm.dx.imad.i32(i32 %0, i32 %1, i32 %2) | ||
| // CHECK: ret i32 %dx.imad | ||
| int test_mad_int(int p0, int p1, int p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.imad = call <2 x i32> @llvm.dx.imad.v2i32(<2 x i32> %0, <2 x i32> %1, <2 x i32> %2) | ||
| // CHECK: ret <2 x i32> %dx.imad | ||
| int2 test_mad_int2(int2 p0, int2 p1, int2 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.imad = call <3 x i32> @llvm.dx.imad.v3i32(<3 x i32> %0, <3 x i32> %1, <3 x i32> %2) | ||
| // CHECK: ret <3 x i32> %dx.imad | ||
| int3 test_mad_int3(int3 p0, int3 p1, int3 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.imad = call <4 x i32> @llvm.dx.imad.v4i32(<4 x i32> %0, <4 x i32> %1, <4 x i32> %2) | ||
| // CHECK: ret <4 x i32> %dx.imad | ||
| int4 test_mad_int4(int4 p0, int4 p1, int4 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.imad = call i64 @llvm.dx.imad.i64(i64 %0, i64 %1, i64 %2) | ||
| // CHECK: ret i64 %dx.imad | ||
| int64_t test_mad_int64_t(int64_t p0, int64_t p1, int64_t p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.imad = call <2 x i64> @llvm.dx.imad.v2i64(<2 x i64> %0, <2 x i64> %1, <2 x i64> %2) | ||
| // CHECK: ret <2 x i64> %dx.imad | ||
| int64_t2 test_mad_int64_t2(int64_t2 p0, int64_t2 p1, int64_t2 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.imad = call <3 x i64> @llvm.dx.imad.v3i64(<3 x i64> %0, <3 x i64> %1, <3 x i64> %2) | ||
| // CHECK: ret <3 x i64> %dx.imad | ||
| int64_t3 test_mad_int64_t3(int64_t3 p0, int64_t3 p1, int64_t3 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.imad = call <4 x i64> @llvm.dx.imad.v4i64(<4 x i64> %0, <4 x i64> %1, <4 x i64> %2) | ||
| // CHECK: ret <4 x i64> %dx.imad | ||
| int64_t4 test_mad_int64_t4(int64_t4 p0, int64_t4 p1, int64_t4 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.umad = call i32 @llvm.dx.umad.i32(i32 %0, i32 %1, i32 %2) | ||
| // CHECK: ret i32 %dx.umad | ||
| uint test_mad_uint(uint p0, uint p1, uint p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.umad = call <2 x i32> @llvm.dx.umad.v2i32(<2 x i32> %0, <2 x i32> %1, <2 x i32> %2) | ||
| // CHECK: ret <2 x i32> %dx.umad | ||
| uint2 test_mad_uint2(uint2 p0, uint2 p1, uint2 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.umad = call <3 x i32> @llvm.dx.umad.v3i32(<3 x i32> %0, <3 x i32> %1, <3 x i32> %2) | ||
| // CHECK: ret <3 x i32> %dx.umad | ||
| uint3 test_mad_uint3(uint3 p0, uint3 p1, uint3 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.umad = call <4 x i32> @llvm.dx.umad.v4i32(<4 x i32> %0, <4 x i32> %1, <4 x i32> %2) | ||
| // CHECK: ret <4 x i32> %dx.umad | ||
| uint4 test_mad_uint4(uint4 p0, uint4 p1, uint4 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.umad = call i64 @llvm.dx.umad.i64(i64 %0, i64 %1, i64 %2) | ||
| // CHECK: ret i64 %dx.umad | ||
| uint64_t test_mad_uint64_t(uint64_t p0, uint64_t p1, uint64_t p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.umad = call <2 x i64> @llvm.dx.umad.v2i64(<2 x i64> %0, <2 x i64> %1, <2 x i64> %2) | ||
| // CHECK: ret <2 x i64> %dx.umad | ||
| uint64_t2 test_mad_uint64_t2(uint64_t2 p0, uint64_t2 p1, uint64_t2 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.umad = call <3 x i64> @llvm.dx.umad.v3i64(<3 x i64> %0, <3 x i64> %1, <3 x i64> %2) | ||
| // CHECK: ret <3 x i64> %dx.umad | ||
| uint64_t3 test_mad_uint64_t3(uint64_t3 p0, uint64_t3 p1, uint64_t3 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.umad = call <4 x i64> @llvm.dx.umad.v4i64(<4 x i64> %0, <4 x i64> %1, <4 x i64> %2) | ||
| // CHECK: ret <4 x i64> %dx.umad | ||
| uint64_t4 test_mad_uint64_t4(uint64_t4 p0, uint64_t4 p1, uint64_t4 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %splat.splat, <2 x float> %1, <2 x float> %2) | ||
| // CHECK: ret <2 x float> %dx.fmad | ||
| float2 test_mad_float2_splat(float p0, float2 p1, float2 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %splat.splat, <3 x float> %1, <3 x float> %2) | ||
| // CHECK: ret <3 x float> %dx.fmad | ||
| float3 test_mad_float3_splat(float p0, float3 p1, float3 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %dx.fmad = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %splat.splat, <4 x float> %1, <4 x float> %2) | ||
| // CHECK: ret <4 x float> %dx.fmad | ||
| float4 test_mad_float4_splat(float p0, float4 p1, float4 p2) { return mad(p0, p1, p2); } | ||
|
|
||
| // CHECK: %conv = sitofp i32 %2 to float | ||
| // CHECK: %splat.splatinsert = insertelement <2 x float> poison, float %conv, i64 0 | ||
| // CHECK: %splat.splat = shufflevector <2 x float> %splat.splatinsert, <2 x float> poison, <2 x i32> zeroinitializer | ||
| // CHECK: %dx.fmad = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %splat.splat) | ||
| // CHECK: ret <2 x float> %dx.fmad | ||
| float2 test_mad_float2_int_splat(float2 p0, float2 p1, int p2) { | ||
| return mad(p0, p1, p2); | ||
| } | ||
|
|
||
| // CHECK: %conv = sitofp i32 %2 to float | ||
| // CHECK: %splat.splatinsert = insertelement <3 x float> poison, float %conv, i64 0 | ||
| // CHECK: %splat.splat = shufflevector <3 x float> %splat.splatinsert, <3 x float> poison, <3 x i32> zeroinitializer | ||
| // CHECK: %dx.fmad = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %splat.splat) | ||
| // CHECK: ret <3 x float> %dx.fmad | ||
| float3 test_mad_float3_int_splat(float3 p0, float3 p1, int p2) { | ||
| return mad(p0, p1, p2); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: %dx.rcp = call half @llvm.dx.rcp.f16( | ||
| // NATIVE_HALF: ret half %dx.rcp | ||
| // NO_HALF: define noundef float @"?test_rcp_half@@YA$halff@$halff@@Z"( | ||
| // NO_HALF: %dx.rcp = call float @llvm.dx.rcp.f32( | ||
| // NO_HALF: ret float %dx.rcp | ||
| half test_rcp_half(half p0) { return rcp(p0); } | ||
| // NATIVE_HALF: define noundef <2 x half> @ | ||
| // NATIVE_HALF: %dx.rcp = call <2 x half> @llvm.dx.rcp.v2f16 | ||
| // NATIVE_HALF: ret <2 x half> %dx.rcp | ||
| // NO_HALF: define noundef <2 x float> @ | ||
| // NO_HALF: %dx.rcp = call <2 x float> @llvm.dx.rcp.v2f32( | ||
| // NO_HALF: ret <2 x float> %dx.rcp | ||
| half2 test_rcp_half2(half2 p0) { return rcp(p0); } | ||
| // NATIVE_HALF: define noundef <3 x half> @ | ||
| // NATIVE_HALF: %dx.rcp = call <3 x half> @llvm.dx.rcp.v3f16 | ||
| // NATIVE_HALF: ret <3 x half> %dx.rcp | ||
| // NO_HALF: define noundef <3 x float> @ | ||
| // NO_HALF: %dx.rcp = call <3 x float> @llvm.dx.rcp.v3f32( | ||
| // NO_HALF: ret <3 x float> %dx.rcp | ||
| half3 test_rcp_half3(half3 p0) { return rcp(p0); } | ||
| // NATIVE_HALF: define noundef <4 x half> @ | ||
| // NATIVE_HALF: %dx.rcp = call <4 x half> @llvm.dx.rcp.v4f16 | ||
| // NATIVE_HALF: ret <4 x half> %dx.rcp | ||
| // NO_HALF: define noundef <4 x float> @ | ||
| // NO_HALF: %dx.rcp = call <4 x float> @llvm.dx.rcp.v4f32( | ||
| // NO_HALF: ret <4 x float> %dx.rcp | ||
| half4 test_rcp_half4(half4 p0) { return rcp(p0); } | ||
|
|
||
| // CHECK: define noundef float @ | ||
| // CHECK: %dx.rcp = call float @llvm.dx.rcp.f32( | ||
| // CHECK: ret float %dx.rcp | ||
| float test_rcp_float(float p0) { return rcp(p0); } | ||
| // CHECK: define noundef <2 x float> @ | ||
| // CHECK: %dx.rcp = call <2 x float> @llvm.dx.rcp.v2f32 | ||
| // CHECK: ret <2 x float> %dx.rcp | ||
| float2 test_rcp_float2(float2 p0) { return rcp(p0); } | ||
| // CHECK: define noundef <3 x float> @ | ||
| // CHECK: %dx.rcp = call <3 x float> @llvm.dx.rcp.v3f32 | ||
| // CHECK: ret <3 x float> %dx.rcp | ||
| float3 test_rcp_float3(float3 p0) { return rcp(p0); } | ||
| // CHECK: define noundef <4 x float> @ | ||
| // CHECK: %dx.rcp = call <4 x float> @llvm.dx.rcp.v4f32 | ||
| // CHECK: ret <4 x float> %dx.rcp | ||
| float4 test_rcp_float4(float4 p0) { return rcp(p0); } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,25 @@ | ||
| // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DXIL | ||
| // RUN: %clang_cc1 -triple spirv-linux-vulkan-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-SPIRV | ||
|
|
||
| // Make sure SV_DispatchThreadID translated into dx.thread.id. | ||
|
|
||
| // CHECK: define void @foo() | ||
| // CHECK-DXIL: %[[#ID:]] = call i32 @llvm.dx.thread.id(i32 0) | ||
| // CHECK-SPIRV: %[[#ID:]] = call i32 @llvm.spv.thread.id(i32 0) | ||
| // CHECK: call void @{{.*}}foo{{.*}}(i32 %[[#ID]]) | ||
| [shader("compute")] | ||
| [numthreads(8,8,1)] | ||
| void foo(uint Idx : SV_DispatchThreadID) {} | ||
|
|
||
| // CHECK: define void @bar() | ||
| // CHECK-DXIL: %[[#ID_X:]] = call i32 @llvm.dx.thread.id(i32 0) | ||
| // CHECK-SPIRV: %[[#ID_X:]] = call i32 @llvm.spv.thread.id(i32 0) | ||
| // CHECK: %[[#ID_X_:]] = insertelement <2 x i32> poison, i32 %[[#ID_X]], i64 0 | ||
| // CHECK-DXIL: %[[#ID_Y:]] = call i32 @llvm.dx.thread.id(i32 1) | ||
| // CHECK-SPIRV: %[[#ID_Y:]] = call i32 @llvm.spv.thread.id(i32 1) | ||
| // CHECK: %[[#ID_XY:]] = insertelement <2 x i32> %[[#ID_X_]], i32 %[[#ID_Y]], i64 1 | ||
| // CHECK-DXIL: call void @{{.*}}bar{{.*}}(<2 x i32> %[[#ID_XY]]) | ||
| [shader("compute")] | ||
| [numthreads(8,8,1)] | ||
| void bar(uint2 Idx : SV_DispatchThreadID) {} | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // RUN: %clang_cc1 -fsyntax-only -std=c++20 -Wno-unused -Wunsequenced -verify %s | ||
|
|
||
| struct A { | ||
| int x, y; | ||
| }; | ||
|
|
||
| void test() { | ||
| int a = 0; | ||
|
|
||
| A agg1( a++, a++ ); // no warning | ||
| A agg2( a++ + a, a++ ); // expected-warning {{unsequenced modification and access to 'a'}} | ||
|
|
||
| int arr1[]( a++, a++ ); // no warning | ||
| int arr2[]( a++ + a, a++ ); // expected-warning {{unsequenced modification and access to 'a'}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -verify -verify-ignore-unexpected | ||
|
|
||
| bool test_too_few_arg() { | ||
| return __builtin_hlsl_elementwise_any(); | ||
| // expected-error@-1 {{too few arguments to function call, expected 1, have 0}} | ||
| } | ||
|
|
||
| bool test_too_many_arg(float2 p0) { | ||
| return __builtin_hlsl_elementwise_any(p0, p0); | ||
| // expected-error@-1 {{too many arguments to function call, expected 1, have 2}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
|
|
||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -verify -verify-ignore-unexpected -DTEST_FUNC=__builtin_elementwise_exp | ||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -verify -verify-ignore-unexpected -DTEST_FUNC=__builtin_elementwise_exp2 | ||
| float test_too_few_arg() { | ||
| return TEST_FUNC(); | ||
| // expected-error@-1 {{too few arguments to function call, expected 1, have 0}} | ||
| } | ||
|
|
||
| float2 test_too_many_arg(float2 p0) { | ||
| return TEST_FUNC(p0, p0); | ||
| // expected-error@-1 {{too many arguments to function call, expected 1, have 2}} | ||
| } | ||
|
|
||
| float builtin_bool_to_float_type_promotion(bool p1) { | ||
| return TEST_FUNC(p1); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'bool')}} | ||
| } | ||
|
|
||
| float builtin_exp_int_to_float_promotion(int p1) { | ||
| return TEST_FUNC(p1); | ||
| // expected-error@-1 {{1st argument must be a floating point type (was 'int')}} | ||
| } | ||
|
|
||
| float2 builtin_exp_int2_to_float2_promotion(int2 p1) { | ||
| return TEST_FUNC(p1); | ||
| // expected-error@-1 {{1st argument must be a floating point type (was 'int2' (aka 'vector<int, 2>'))}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -verify -verify-ignore-unexpected | ||
|
|
||
| float2 test_no_second_arg(float2 p0) { | ||
| return __builtin_hlsl_mad(p0); | ||
| // expected-error@-1 {{too few arguments to function call, expected 3, have 1}} | ||
| } | ||
|
|
||
| float2 test_no_third_arg(float2 p0) { | ||
| return __builtin_hlsl_mad(p0, p0); | ||
| // expected-error@-1 {{too few arguments to function call, expected 3, have 2}} | ||
| } | ||
|
|
||
| float2 test_too_many_arg(float2 p0) { | ||
| return __builtin_hlsl_mad(p0, p0, p0, p0); | ||
| // expected-error@-1 {{too many arguments to function call, expected 3, have 4}} | ||
| } | ||
|
|
||
| float2 test_mad_no_second_arg(float2 p0) { | ||
| return mad(p0); | ||
| // expected-error@-1 {{no matching function for call to 'mad'}} | ||
| } | ||
|
|
||
| float2 test_mad_vector_size_mismatch(float3 p0, float2 p1) { | ||
| return mad(p0, p0, p1); | ||
| // expected-warning@-1 {{implicit conversion truncates vector: 'float3' (aka 'vector<float, 3>') to 'float __attribute__((ext_vector_type(2)))' (vector of 2 'float' values)}} | ||
| } | ||
|
|
||
| float2 test_mad_builtin_vector_size_mismatch(float3 p0, float2 p1) { | ||
| return __builtin_hlsl_mad(p0, p1, p1); | ||
| // expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must have the same type}} | ||
| } | ||
|
|
||
| float test_mad_scalar_mismatch(float p0, half p1) { | ||
| return mad(p1, p0, p1); | ||
| // expected-error@-1 {{call to 'mad' is ambiguous}} | ||
| } | ||
|
|
||
| float2 test_mad_element_type_mismatch(half2 p0, float2 p1) { | ||
| return mad(p1, p0, p1); | ||
| // expected-error@-1 {{call to 'mad' is ambiguous}} | ||
| } | ||
|
|
||
| float2 test_builtin_mad_float2_splat(float p0, float2 p1) { | ||
| return __builtin_hlsl_mad(p0, p1, p1); | ||
| // expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}} | ||
| } | ||
|
|
||
| float3 test_builtin_mad_float3_splat(float p0, float3 p1) { | ||
| return __builtin_hlsl_mad(p0, p1, p1); | ||
| // expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}} | ||
| } | ||
|
|
||
| float4 test_builtin_mad_float4_splat(float p0, float4 p1) { | ||
| return __builtin_hlsl_mad(p0, p1, p1); | ||
| // expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}} | ||
| } | ||
|
|
||
| float2 test_mad_float2_int_splat(float2 p0, int p1) { | ||
| return __builtin_hlsl_mad(p0, p1, p1); | ||
| // expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}} | ||
| } | ||
|
|
||
| float3 test_mad_float3_int_splat(float3 p0, int p1) { | ||
| return __builtin_hlsl_mad(p0, p1, p1); | ||
| // expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}} | ||
| } | ||
|
|
||
| float2 test_builtin_mad_int_vect_to_float_vec_promotion(int2 p0, float p1) { | ||
| return __builtin_hlsl_mad(p0, p1, p1); | ||
| // expected-error@-1 {{all arguments to '__builtin_hlsl_mad' must be vectors}} | ||
| } | ||
|
|
||
| float builtin_bool_to_float_type_promotion(float p0, bool p1) { | ||
| return __builtin_hlsl_mad(p0, p0, p1); | ||
| // expected-error@-1 {{3rd argument must be a vector, integer or floating point type (was 'bool')}} | ||
| } | ||
|
|
||
| float builtin_bool_to_float_type_promotion2(bool p0, float p1) { | ||
| return __builtin_hlsl_mad(p1, p0, p1); | ||
| // expected-error@-1 {{2nd argument must be a vector, integer or floating point type (was 'bool')}} | ||
| } | ||
|
|
||
| float builtin_mad_int_to_float_promotion(float p0, int p1) { | ||
| return __builtin_hlsl_mad(p0, p0, p1); | ||
| // expected-error@-1 {{arguments are of different types ('double' vs 'int')}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
|
|
||
| // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -verify -verify-ignore-unexpected | ||
|
|
||
| float test_too_few_arg() { | ||
| return __builtin_hlsl_elementwise_rcp(); | ||
| // expected-error@-1 {{too few arguments to function call, expected 1, have 0}} | ||
| } | ||
|
|
||
| float2 test_too_many_arg(float2 p0) { | ||
| return __builtin_hlsl_elementwise_rcp(p0, p0); | ||
| // expected-error@-1 {{too many arguments to function call, expected 1, have 2}} | ||
| } | ||
|
|
||
| float builtin_bool_to_float_type_promotion(bool p1) { | ||
| return __builtin_hlsl_elementwise_rcp(p1); | ||
| // expected-error@-1 {{1st argument must be a vector, integer or floating point type (was 'bool')}} | ||
| } | ||
|
|
||
| float builtin_rcp_int_to_float_promotion(int p1) { | ||
| return __builtin_hlsl_elementwise_rcp(p1); | ||
| // expected-error@-1 {{passing 'int' to parameter of incompatible type 'float'}} | ||
| } | ||
|
|
||
| float2 builtin_rcp_int2_to_float2_promotion(int2 p1) { | ||
| return __builtin_hlsl_elementwise_rcp(p1); | ||
| // expected-error@-1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s | ||
|
|
||
| template<typename T> | ||
| struct A : T { | ||
| using T::f; | ||
| using T::g; | ||
| using T::h; | ||
|
|
||
| void f(); | ||
| void g(); | ||
|
|
||
| void i() { | ||
| f<int>(); | ||
| g<int>(); // expected-error{{no member named 'g' in 'A<B>'}} | ||
| h<int>(); // expected-error{{expected '(' for function-style cast or type construction}} | ||
| // expected-error@-1{{expected expression}} | ||
| } | ||
| }; | ||
|
|
||
| struct B { | ||
| template<typename T> | ||
| void f(); | ||
|
|
||
| void g(); | ||
|
|
||
| template<typename T> | ||
| void h(); | ||
| }; | ||
|
|
||
| template struct A<B>; // expected-note{{in instantiation of member function 'A<B>::i' requested here}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| // RUN: clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins | FileCheck %s | ||
| // RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_LANES 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_LANES | ||
| // RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_COMMA 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_COMMA | ||
| // RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_TYPE 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_TYPE | ||
| // RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_A 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_A | ||
| // RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_B 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_B | ||
| // RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_C 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_C | ||
| // RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_D 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_D | ||
|
|
||
| include "clang/Basic/BuiltinsBase.td" | ||
|
|
||
| def : Builtin { | ||
| // CHECK: BUILTIN(__builtin_01, "E8idE4b", "") | ||
| let Prototype = "_ExtVector<8,int>(double, _ExtVector<4, bool>)"; | ||
| let Spellings = ["__builtin_01"]; | ||
| } | ||
|
|
||
| def : Builtin { | ||
| // CHECK: BUILTIN(__builtin_02, "E8UiE4s", "") | ||
| let Prototype = "_ExtVector<8,unsigned int>(_ExtVector<4, short>)"; | ||
| let Spellings = ["__builtin_02"]; | ||
| } | ||
|
|
||
| def : Builtin { | ||
| // CHECK: BUILTIN(__builtin_03, "di", "") | ||
| let Prototype = "double(int)"; | ||
| let Spellings = ["__builtin_03"]; | ||
| } | ||
|
|
||
| def : Builtin { | ||
| // CHECK: BUILTIN(__builtin_04, "diIUi", "") | ||
| let Prototype = "double(int, _Constant unsigned int)"; | ||
| let Spellings = ["__builtin_04"]; | ||
| } | ||
|
|
||
| def : Builtin { | ||
| // CHECK: BUILTIN(__builtin_05, "v&v&", "") | ||
| let Prototype = "void&(void&)"; | ||
| let Spellings = ["__builtin_05"]; | ||
| } | ||
|
|
||
| def : Builtin { | ||
| // CHECK: BUILTIN(__builtin_06, "v*v*cC*.", "") | ||
| let Prototype = "void*(void*, char const*, ...)"; | ||
| let Spellings = ["__builtin_06"]; | ||
| } | ||
|
|
||
| def : Builtin { | ||
| // CHECK: BUILTIN(__builtin_07, "E8iE4dE4b.", "") | ||
| let Prototype = "_ExtVector<8, int>(_ExtVector<4,double>, _ExtVector<4, bool>, ...)"; | ||
| let Spellings = ["__builtin_07"]; | ||
| } | ||
|
|
||
| def : Builtin { | ||
| // CHECK: BUILTIN(__builtin_08, "di*R", "") | ||
| let Prototype = "double(int * restrict)"; | ||
| let Spellings = ["__builtin_08"]; | ||
| } | ||
|
|
||
| #ifdef ERROR_EXPECTED_LANES | ||
| def : Builtin { | ||
| // ERROR_EXPECTED_LANES: :[[# @LINE + 1]]:7: error: Expected number of lanes after '_ExtVector<' | ||
| let Prototype = "_ExtVector<int>(double)"; | ||
| let Spellings = ["__builtin_test_use_clang_extended_vectors"]; | ||
| } | ||
| #endif | ||
|
|
||
| #ifdef ERROR_EXPECTED_COMMA | ||
| def : Builtin { | ||
| // ERROR_EXPECTED_COMMA: :[[# @LINE + 1]]:7: error: Expected ',' after number of lanes in '_ExtVector<' | ||
| let Prototype = "_ExtVector<8 int>(double)"; | ||
| let Spellings = ["__builtin_test_use_clang_extended_vectors"]; | ||
| } | ||
| #endif | ||
|
|
||
| #ifdef ERROR_EXPECTED_TYPE | ||
| def : Builtin { | ||
| // ERROR_EXPECTED_TYPE: :[[# @LINE + 1]]:7: error: Expected '>' after scalar type in '_ExtVector<N, type>' | ||
| let Prototype = "_ExtVector<8, int (double)"; | ||
| let Spellings = ["__builtin_test_use_clang_extended_vectors"]; | ||
| } | ||
| #endif | ||
|
|
||
| #ifdef ERROR_EXPECTED_A | ||
| def : Builtin { | ||
| // ERROR_EXPECTED_A: :[[# @LINE + 1]]:7: error: Expected '<' after '_ExtVector' | ||
| let Prototype = "_ExtVector(8, int) (double)"; | ||
| let Spellings = ["__builtin_test_use_clang_extended_vectors"]; | ||
| } | ||
| #endif | ||
|
|
||
| #ifdef ERROR_EXPECTED_B | ||
| def : Builtin { | ||
| // ERROR_EXPECTED_B: :[[# @LINE + 1]]:7: error: Expected '<' after '_ExtVector' | ||
| let Prototype = "double(_ExtVector(8, int))"; | ||
| let Spellings = ["__builtin_test_use_clang_extended_vectors"]; | ||
| } | ||
| #endif | ||
|
|
||
| #ifdef ERROR_EXPECTED_C | ||
| def : Builtin { | ||
| // ERROR_EXPECTED_C: :[[# @LINE + 1]]:7: error: Unknown Type: _EtxVector<8, int> | ||
| let Prototype = "_EtxVector<8, int>(void)"; | ||
| let Spellings = ["__builtin_test_use_clang_extended_vectors"]; | ||
| } | ||
| #endif | ||
|
|
||
| #ifdef ERROR_EXPECTED_D | ||
| def : Builtin { | ||
| // ERROR_EXPECTED_D: :[[# @LINE + 1]]:7: error: Expected number of lanes after '_ExtVector<' | ||
| let Prototype = "_ExtVector<>(void)"; | ||
| let Spellings = ["__builtin_test_use_clang_extended_vectors"]; | ||
| } | ||
| #endif | ||
|
|