llvm-project/clang/test/CodeGenHLSL/builtins/normalize-builtin.hlsl
Farzon Lotfi 3026fa0eb6
[HLSL] add CustomTypeChecking to float builtins (#133441)
- Add CustomTypeChecking to HLSL builtins that take float arguments
- Add new builtin tests to confirm CustomTypeChecking doesn't promote
scalar float arguments aren't promoted to double
- fixes #133440
2025-03-28 17:34:20 -04:00

17 lines
698 B
HLSL

// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s
// CHECK-LABEL: builtin_normalize_half
// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn half @llvm.dx.normalize.f16(half %{{.*}})
// CHECK: ret half %hlsl.normalize
half builtin_normalize_half(half p0) {
return __builtin_hlsl_normalize(p0);
}
// CHECK-LABEL: builtin_normalize_float
// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn float @llvm.dx.normalize.f32(float %{{.*}})
// CHECK: ret float %hlsl.normalize
float builtin_normalize_float (float p0) {
return __builtin_hlsl_normalize(p0);
}