[clang] [llvm] [clang] Reland Add tanf16 builtin and support for tan constrained intrinsic (PR #94559)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 00:24:52 PDT 2024
farzonl wrote:
> Can we change the target-independent bits of the tan() implementation in the backend so it doesn't require each target to explicitly request that tan() needs to be expanded? It should be possible to adjust the code in TargetLoweringBase.cpp a bit so FTAN defaults to being expanded for all types.
> It might be better to default FTAN to expand in
>
> https://github.com/llvm/llvm-project/blob/64c9a1e1266ec7bc4c4896b2df116fa12dbacf15/llvm/lib/CodeGen/TargetLoweringBase.cpp#L960
>
> , which seems to only be done for f32/f64/f128 at the moment.
I don't think we can default on vector types to Expand as it would expand on vector that are not supported for tan. For example VT in this case is `MVT::all_valuetypes()` That includes integer vectors.
https://github.com/llvm/llvm-project/blob/64c9a1e1266ec7bc4c4896b2df116fa12dbacf15/llvm/lib/CodeGen/TargetLoweringBase.cpp#L894
Even if it only included floats it would not necessarily be correct For example in ARM
https://github.com/llvm/llvm-project/blob/64c9a1e1266ec7bc4c4896b2df116fa12dbacf15/llvm/lib/Target/ARM/ARMISelLowering.cpp#L324-L325
some cases like MVE it is MVT::v8f16, MVT::v4f32
but for NEON MVT::v2f64, MVT::v4f32, and MVT::v2f32 are supported. Doing it per target seems intential so as to have more precision so only intrinsics that are valid to lower get expanded.
https://github.com/llvm/llvm-project/pull/94559
More information about the llvm-commits
mailing list