Files
clang-p2996/llvm/test/CodeGen/DirectX/sqrt.ll
Farzon Lotfi 4cea2d049f [HLSL][DXIL] implement sqrt intrinsic (#86560)
completes #86187
- fix hlsl_intrinsic to cover the correct cases
- move to using `__builtin_elementwise_sqrt`
- add lowering of `Intrinsic::sqrt` to dxilop 24.
2024-03-25 18:02:30 -04:00

21 lines
592 B
LLVM

; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
; Make sure dxil operation function calls for sqrt are generated for float and half.
define noundef float @sqrt_float(float noundef %a) #0 {
entry:
; CHECK:call float @dx.op.unary.f32(i32 24, float %{{.*}})
%elt.sqrt = call float @llvm.sqrt.f32(float %a)
ret float %elt.sqrt
}
define noundef half @sqrt_half(half noundef %a) #0 {
entry:
; CHECK:call half @dx.op.unary.f16(i32 24, half %{{.*}})
%elt.sqrt = call half @llvm.sqrt.f16(half %a)
ret half %elt.sqrt
}
declare half @llvm.sqrt.f16(half)
declare float @llvm.sqrt.f32(float)