-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Description
The current sqrt intrinsic is incomplete in some cases and not correct in others.
For example there is no double
support. Doubles need to cast down to floats:
https://godbolt.org/z/Pc73srEr7
Yet we added it here: https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/hlsl/hlsl_intrinsics.h#L1421
Second we should be using __builtin_elementwise_sqrt
and not multiple different builtins especially since all sqrt builtins map to the same Intrinsic::sqrt
https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGBuiltin.cpp#L2908
Using one builtin makes it easier to apply type check rules in sema.
Finally lowering support needs to be added. Sqrt lowering is very simple and has a one to one mapping between
Intrinsic::sqrt
and dx.op.unary 24
Metadata
Metadata
Assignees
Labels
Type
Projects
Status